xslt and xml problem

Discussion in 'XML' started by Steven, Jun 25, 2004.

  1. Steven

    Steven Guest

    Hello,

    I have a following situation..
    XML Document contains
    <root>
    <ProductList>
    <Product Name="sometext" Code = "some code">
    <Quantity>
    <Plan>sometext</Plan>
    <Actual>sometext</Actual>
    <Plan>someothertext</Plan>
    <Actual>someothertext</Actual>
     
    Steven, Jun 25, 2004
    #1
    1. Advertising

  2. Steven wrote:


    > I have a following situation..
    > XML Document contains
    > <root>
    > <ProductList>
    > <Product Name="sometext" Code = "some code">
    > <Quantity>
    > <Plan>sometext</Plan>
    > <Actual>sometext</Actual>
    > <Plan>someothertext</Plan>
    > <Actual>someothertext</Actual>
    > .
    > .
    > .
    > </Quantity>
    > </Product>
    > <Product>
    > .
    > .
    > .
    > </Product>
    > </ProductList>
    > </root>
    >
    > When I am looping through Each <Plan> and <Actual> using XSL, I can not get
    > the content. My xsl code is below:
    > <xsl:template match = "/">
    > <HTML> <xsl:apply-template/> </HTML>
    > </xsl:template>
    >
    > <xsl:template match = "root">
    >
    > <xsl:for-each select = "ProductList/Product">
    > <TR><TD><xsl:value-of select = "@Name" /></TD>
    > <xsl:for-each select = "ProductList/Product/Quantity/Plan">


    Your context node here is a <Product> element, now your select looks for
    ProductList/Product/Quantity/Plan inside of that context node and
    doesn't find anything so what you want is probably
    <xsl:for-each select="Quantity/Plan">



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Jun 25, 2004
    #2
    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.

Share This Page