Subject: [xsl] Grouping Problem From: "Eugene Bernard" <eugene.bernard@xxxxxxxxx> Date: Fri, 15 Feb 2008 18:26:52 +0530 |
Hi all (Sorry, Forgot to mention the Subject in my earlier mail) Using the below XML data (Partial listing) and XSL, I am getting the HTML output as below. How to make it to compact horizontally tabulated HTML output like this (to limit the size of my mail i have removed html tags) HTML Output : Code Due Press ID Qty --------------------------------------------- A001 ---------------------------------------------- Beyond Mar Press A 100 Press B 219 Feb Due Press A 47 Press B 365 Mar Due Press A 84 Press B 256 Over Due Press B 2 -------------------------------- HTML Output (Desired): CODE BEYOND MAR FEB DUE MAR DUE OVER DUE A B C D A B C D A B C D A B C D A001 100 219 47 365 84 256 2 XML: <?xml version="1.0" ?> - <mpour> - <item> <ccode>A004</ccode> <due>Beyond Mar</due> <line>Press A</line> <pour>409</pour> <weight>3476.50</weight> </item> - <item> <ccode>A004</ccode> <due>Beyond Mar</due> <line>Press A</line> <pour>300</pour> <weight>2550.00</weight> </item> - <item> <ccode>A004</ccode> <due>Beyond Mar</due> <line>Press A</line> <pour>500</pour> <weight>4250.00</weight> </item> - <item> XSL : <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="mpour"> <table border="1" cellspacing="0" cellpadding="4"><tr><td>Code</td><td>Due</td><td>Press ID</td><td>Qty</td></tr> <xsl:for-each-group select="item" group-by="ccode"> <xsl:sort select="current-grouping-key()"/> <tr> <td><xsl:value-of select="ccode"/></td> <td/> <td/> <td/> </tr> <xsl:for-each-group select="current-group()" group-by="due"> <xsl:sort select="current-grouping-key()"/> <tr> <td/> <td><xsl:value-of select="due"/></td> <td/> <td/> </tr> <xsl:for-each-group select="current-group()" group-by="line"> <xsl:sort select="current-grouping-key()"/> <tr> <td/> <td/> <td><xsl:value-of select="line"/></td> <td align="right"><xsl:value-of select="format-number(sum(current-group()/pour),'######.##')" /></td> </tr> </xsl:for-each-group> </xsl:for-each-group> </xsl:for-each-group> </table> </xsl:template> </xsl:stylesheet> Regards Eugene
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Accessing input document , Michael Ludwig | Thread | Fwd: Fw: [xsl] Grouping problem, Eugene Bernard |
Re: [xsl] Accessing input document , Michael Ludwig | Date | RE: [xsl] Grouping problem, Michael Kay |
Month |