Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop through child nodes

Status
Not open for further replies.

rychand

Programmer
May 1, 2003
4
0
0
GB
how do you loop through child nodes to display the values?
For Examle:
XML
<Store>
<Customer>
<Name>a</Name>
<Age>1</Age>
<Address>high street</Address>
</Customer>

<Customer>
<Name>b</Name>
<Age>2</Age>
<Address>low street</Address>
</Customer>
</Store>

XSL
<xsl:template match=&quot;Store&quot;>
<xsl:for-each select=&quot;Customer&quot;>
<tr>
<xsl:for-each select=&quot;????child::Customer?????&quot;>
<td>
<xsl:value-of select=&quot;???child::Customer?????&quot; />
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</xsl:template>

So instead of listing each attribute, such as Name, Age, Address for each customer, is there a way to loop through the children of Customer to display their values in a table?

Please help.
Ask if you need me to explain more.
regards.
 
..
<xsl:for-each select=&quot;*&quot;>
<td>
<xsl:value-of select=&quot;.&quot;/>
</td>
<xsl:for-each>
..

should do the trick :)



matt

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top