xslt and xml problem

S

Steven

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>
 
M

Martin Honnen

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">
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top