424,294 Members | 1,898 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,294 IT Pros & Developers. It's quick & easy.

XML/XSLT Display Recursive Node

P: 3
Hi all,

I have the following XSL file:


<xsl:template match="/">
<HTML>
<BODY>
<font face="Arial" size="4">Purchase Order Details</font>
<xsl:apply-templates />
</BODY>
</HTML>
</xsl:template>
<xsl:template match="/por:Orders">
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="1">
<TR bgcolor="#6090CF" >
<TD STYLE="fontface:Arial"><font color="white"><CENTER><STRONG>User</STRONG></CENTER></font></TD>
<TD STYLE="fontface:Arial"><font color="white"><CENTER><STRONG>Authorisor</STRONG></CENTER></font></TD>
<TD STYLE="fontface:Arial"><font color="white"><CENTER><STRONG>Workgroup</STRONG></CENTER></font></TD>
<TD STYLE="fontface:Arial"><font color="white"><CENTER><STRONG>OrderNo</STRONG></CENTER></font></TD>
<TD STYLE="fontface:Arial"><font color="white"><CENTER><STRONG>Seq</STRONG></CENTER></font></TD>
<TD><font face="Arial" size="2" color="white"><CENTER><STRONG>Supplier</STRONG></CENTER></font></TD>
<TD><font face="Arial" size="2" color="white"><CENTER><STRONG>Value</STRONG></CENTER></font></TD>
<TD><font face="Arial" size="2" color="white"><CENTER><STRONG>Tax Code</STRONG></CENTER></font></TD>
<TD><font face="Arial" size="2" color="white"><CENTER><STRONG>Tax Value</STRONG></CENTER></font></TD>
<TD><font face="Arial" size="2" color="white"><CENTER><STRONG>GL Code</STRONG></CENTER></font></TD>
<TD><font face="Arial" size="2" color="white"><CENTER><STRONG>Product</STRONG></CENTER></font></TD>
<TD><font face="Arial" size="2" color="white"><CENTER><STRONG>Desc</STRONG></CENTER></font></TD>
</TR>

<xsl:for-each select="por:Order">
<TR bgcolor="LightGreen">
<TD>
<font face="Arial" size="2"><xsl:value-of select="por:UserName"/></font>
</TD>
<TD>
<font face="Arial" size="2"><xsl:value-of select="por:Authorisor"/></font>
</TD>
<TD>
<font face="Arial" size="2"><xsl:value-of select="por:Workgroup"/></font>
</TD>
<TD>
<font face="Arial" size="2"><xsl:value-of select="por:OrderNo"/></font>
</TD>
<TD>
<font face="Arial" size="2"><xsl:value-of select="por:OrderNoSeq"/></font>
</TD>
</TR>
</xsl:for-each>

<xsl:for-each select="por:Order/por:Item">
<TR bgcolor="LightGreen">
<TD>
<font face="Arial" size="2"><xsl:value-of select="por:SupplierCode"/></font>
</TD>
<TD>
<font face="Arial" size="2"><xsl:value-of select="por:Value"/></font>
</TD>
<TD>
<font face="Arial" size="2"><xsl:value-of select="por:TaxCode"/></font>
</TD>
<TD>
<font face="Arial" size="2"><xsl:value-of select="por:TaxValue"/></font>
</TD>
<TD>
<font face="Arial" size="2"><xsl:value-of select="por:GLCode"/></font>
</TD>
<TD>
<font face="Arial" size="2"><xsl:value-of select="por:ItemCode"/></font>
</TD>
<TD>
<font face="Arial" size="2"><xsl:value-of select="por: Description"/></font>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>

for the following XML file structure:

<Orders>
<Order>
<UserName, Workgroup etc>
<Item>
<SupplierCode, TaxValue etc>
</Item>
<Item>
<SupplierCode, TaxValue etc>
</Item>
</Order>
<Order>
<UserName, Workgroup etc>
<Item>
<SupplierCode, TaxValue etc>
</Item>
<Item>
<SupplierCode, TaxValue etc>
</Item>
</Order>
</Orders>

The problem I'm facing is the way HTML is displayed. I can't get the hierarchy displayed correctly. I've attached a jpeg to kind of illustrate how i'd like the data displayed (if possible).

I'd appreciate any help/guidance in overcoming this frustrating problem.

Thanks!!
Attached Images
File Type: jpg layout.jpg (13.6 KB, 112 views)
Jul 6 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.