What's wrong with my XSL ?

Discussion in 'XML' started by WebSLS, Jan 28, 2004.

  1. WebSLS

    WebSLS Guest

    What am I doing wrong ?
    Here is my XML:
    <?xml version="1.0" standalone="yes"?>
    <Specials xmlns="http://tempuri.org/Specials.xsd">
    <Trip>
    <ID>0</ID>
    <Lieux>Canada</Lieux>
    <Hotel>Clarendon</Hotel>
    <Depart>1er janvier</Depart>
    <Duree>1 semaine</Duree>
    <Prix>450$</Prix>
    <ToutCompris>false</ToutCompris>
    <Rating>4.5</Rating>
    <Description>Hotel dans le vieux Québec</Description>
    </Trip>
    </Specials>

    Here is my XSL
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <xsl:for-each select="Specials/Trip">
    <p><xsl:value-of select="Lieux"/></p>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

    Nothing is output
    WebSLS, Jan 28, 2004
    #1
    1. Advertising

  2. WebSLS

    john farrow Guest

    The expression

    <xsl:for-each select="Specials/Trip">

    matches nodes in the default namespace, but your "Specials" node is not in
    the default namespace its in the xmlns="http://tempuri.org/Specials.xsd" so
    there is no match.

    You can confirm this by removing the
    'xmlns="http://tempuri.org/Specials.xsd"' and the transform will then work.

    Hope that helps.

    John Farrow


    "WebSLS" <> wrote in message
    news:...
    > What am I doing wrong ?
    > Here is my XML:
    > <?xml version="1.0" standalone="yes"?>
    > <Specials xmlns="http://tempuri.org/Specials.xsd">
    > <Trip>
    > <ID>0</ID>
    > <Lieux>Canada</Lieux>
    > <Hotel>Clarendon</Hotel>
    > <Depart>1er janvier</Depart>
    > <Duree>1 semaine</Duree>
    > <Prix>450$</Prix>
    > <ToutCompris>false</ToutCompris>
    > <Rating>4.5</Rating>
    > <Description>Hotel dans le vieux Québec</Description>
    > </Trip>
    > </Specials>
    >
    > Here is my XSL
    > <?xml version="1.0" encoding="UTF-8" ?>
    > <xsl:stylesheet version="1.0"

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    > <xsl:template match="/">
    > <xsl:for-each select="Specials/Trip">
    > <p><xsl:value-of select="Lieux"/></p>
    > </xsl:for-each>
    > </xsl:template>
    > </xsl:stylesheet>
    >
    > Nothing is output
    john farrow, Jan 28, 2004
    #2
    1. Advertising

  3. WebSLS

    WebSLS Guest

    Thanks you

    "john farrow" <> wrote in message news:<_FWRb.19435$>...
    > The expression
    >
    > <xsl:for-each select="Specials/Trip">
    >
    > matches nodes in the default namespace, but your "Specials" node is not in
    > the default namespace its in the xmlns="http://tempuri.org/Specials.xsd" so
    > there is no match.
    >
    > You can confirm this by removing the
    > 'xmlns="http://tempuri.org/Specials.xsd"' and the transform will then work.
    >
    > Hope that helps.
    >
    > John Farrow
    >
    >
    > "WebSLS" <> wrote in message
    > news:...
    > > What am I doing wrong ?
    > > Here is my XML:
    > > <?xml version="1.0" standalone="yes"?>
    > > <Specials xmlns="http://tempuri.org/Specials.xsd">
    > > <Trip>
    > > <ID>0</ID>
    > > <Lieux>Canada</Lieux>
    > > <Hotel>Clarendon</Hotel>
    > > <Depart>1er janvier</Depart>
    > > <Duree>1 semaine</Duree>
    > > <Prix>450$</Prix>
    > > <ToutCompris>false</ToutCompris>
    > > <Rating>4.5</Rating>
    > > <Description>Hotel dans le vieux Québec</Description>
    > > </Trip>
    > > </Specials>
    > >
    > > Here is my XSL
    > > <?xml version="1.0" encoding="UTF-8" ?>
    > > <xsl:stylesheet version="1.0"

    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    > > <xsl:template match="/">
    > > <xsl:for-each select="Specials/Trip">
    > > <p><xsl:value-of select="Lieux"/></p>
    > > </xsl:for-each>
    > > </xsl:template>
    > > </xsl:stylesheet>
    > >
    > > Nothing is output
    WebSLS, Jan 29, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Flood
    Replies:
    0
    Views:
    1,010
    Kevin Flood
    Sep 8, 2004
  2. Kevin Flood
    Replies:
    1
    Views:
    2,717
    Kevin Flood
    Sep 13, 2004
  3. Klaus Friese
    Replies:
    0
    Views:
    460
    Klaus Friese
    Nov 22, 2004
  4. Ray Tayek
    Replies:
    3
    Views:
    504
    Ray Tayek
    Nov 30, 2003
  5. Replies:
    1
    Views:
    3,588
    A. Bolmarcich
    May 27, 2005
Loading...

Share This Page