Since I had taken only partial list, and also this code does not have
values for presses C and D.
If presses does not have values, the output should appear with either
blank or zero.
I have reformatted for better clarity.
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 <- Heading
-------------------------------------------+--------------------------+---------------------------+----------------------
A B C D | A B C D | A
B C D | A B C D <- Sub Heading...
----------------------------------------------------------------------------------------------------------------------------
A001 100 219 0 0 | 47 365 0 0 | 84 256
0 0 | 0 2 0 0
----------------------------------------------------------------------------------------------------------------------------
Regards
Eugene
"Michael Kay" <mike(_at_)saxonica(_dot_)com>
15/02/2008 06:47 PM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
cc
Subject RE: [xsl] Grouping problem
Unfortunately your desired output is very badly formatted. I'm having
trouble interpreting it. It seems to have Cs and Ds in it and I can't see
where these are supposed to come from.
The basic problem of creating one column for each distinct value of "due" is
best handled using logic like this:
<xsl:value-of select="due-values" select="distinct-values(item/due)"/>
<tr>
<td/>
<xsl:for-each select="$due-values">
<td><xsl:value-of select="."/></td>
</xsl:for-each>
</tr>
<xsl:for-each-group select="item" group-by="ccode">
<tr>
<td><xsl:value-of select="current-grouping-key()"/></td>
<xsl:for-each select="$due-values">
<td><xsl:value-of select="current-group()[(_at_)due = current()]"/></td>
</xsl:for-each>
</tr>
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--