sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
pr33tz's Avatar

XML/XSLT Display Recursive Node


Question posted by: pr33tz (Newbie) on July 6th, 2006 12:02 PM
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, 63 views)
0 Answers Posted
 
Not the answer you were looking for? Post your question . . .
196,987 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,987 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors