Hi all,
WIth following XML & XSL files, after transformation i get an html
file as below.
XML :
<?xml version="1.0" ?>
+ <sum>
- <record>
<mon cat="OT">Sep2005</mon>
<qty>3.00</qty>
<weight>15.66000</weight>
</record>
- <record>
<mon cat="1X">Sep2005</mon>
<qty>12.00</qty>
<weight>36.12000</weight>
</record>
- <record>
<mon cat="OT">Sep2005</mon>
<qty>2.00</qty>
<weight>39.90000</weight>
</record>
- <record>
<mon cat="1X">Sep2005</mon>
<qty>16.00</qty>
<weight>7.05600</weight>
</record>
- <record>
<mon cat="1X">Sep2005</mon>
<qty>32.00</qty>
<weight>12.48000</weight>
</record>
</sum>
XSL :
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="/">
- <html>
- <body>
- <table border="1" cellpadding="4" cellspacing="0">
- <tr bgcolor="#9acd32">
<th rowspan="2">Month</th>
<th rowspan="2">Cat</th>
<th colspan="2">P Qty</th>
</tr>
- <tr bgcolor="#9acd32">
<th>Qty</th>
<th>Value</th>
</tr>
- <xsl:for-each select="sum/record">
- <tr>
- <td>
<xsl:value-of select="mon" />
</td>
- <td>
<xsl:value-of select="mon/@cat" />
</td>
- <td align="right">
<xsl:value-of select="qty" />
</td>
- <td align="right">
<xsl:value-of select="weight" />
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
HTML actual Output :
|---------------------+-----------+ ----------------------|
| Month | Cat | P Qty | |
|---------------------+-----------+---------------+----------------------|
| | | Qty | Value |
|---------------------+-----------+---------------+----------------------|
| Sep2005 | OT | 3.00| 15.66000|
|---------------------+-----------+---------------+----------------------|
| Sep2005 | 1X | 12.00| 36.12000|
|---------------------+-----------+---------------+----------------------|
| Sep2005 | OT | 2.00| 39.90000|
|---------------------+-----------+---------------+----------------------|
| Sep2005 | 1X | 16.00| 7.05600|
|---------------------+-----------+---------------+----------------------|
| Sep2005 | 1X | 32.00| 12.48000|
|---------------------+-----------+---------------+----------------------|
But to get the output like below, what changes should i made in xsl.
Mon Cat Qty Value
Sep2005 OT 5 55.56
Sep2005 1X 60 55.656
Any help greatly appreciated.
Thanks
Eugene
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
The information contained in this message is legally privileged and
confidential information intended only for the use of the addressed
individual or entity indicated in this message (or responsible for
delivery of the message to such person). It must not be read, copied,
disclosed, distributed or used by any person other than the addressee.
Unauthorised use, disclosure or copying is strictly prohibited and may be
unlawful.
Opinions, conclusions and other information on this message that do not
relate to the official business of any of the constituent companies of
the SANMAR GROUP shall be understood as neither given nor endorsed by
the Group.
If you have received this message in error, you should destroy this
message and kindly notify the sender by e-mail.
Thank you.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
--~------------------------------------------------------------------
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>
--~--