xsl-list
[Top] [All Lists]

[xsl] Slow Transformation

2008-11-19 02:52:29
Hi all,

I am using the below xsl file to transform a xml file of size
approximately 3MB to a HTML file.

The transformation takes more time...

Can anybody help me to sort this out.

Note : using java version "1.6.0_04" and saxon9

XSL ....

  <?xml version="1.0" encoding="UTF-8" ?>
- <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="xml" encoding="UTF-8" indent="yes" />
  <xsl:key name="c-code" match="item" use="ccode" />
  <xsl:key name="d-due" match="item" use="due" />
- <xsl:template match="/">
- <html>
  <h4>Report</h4>
- <body>
- <table border="1" width="100%">
- <tr>
- <td bgcolor="#BDBDBD" align="center" rowspan="2">
- <b>
  <font size="2">code</font>
  </b>
  </td>
- <td bgcolor="#BDBDBD" align="center" rowspan="2">
- <b>
  <font size="2">Desc</font>
  </b>
  </td>
- <td bgcolor="#BDBDBD" align="center" rowspan="2">
- <b>
  <font size="2">M Process</font>
  </b>
  </td>
- <td bgcolor="#BDBDBD" align="center" rowspan="2">
- <b>
  <font size="2">C Process</font>
  </b>
  </td>
- <td bgcolor="#BDBDBD" align="center" rowspan="2">
- <b>
  <font size="2">Unit Weight</font>
  </b>
  </td>
- <td bgcolor="#BDBDBD" align="center" rowspan="2">
- <b>
  <font size="2">Pcs</font>
  </b>
  </td>
- <xsl:for-each select="pmr6sum/item[count(. | key('d-due',due)[1])=1]">
  <xsl:sort select="due" data-type="text" />
- <td bgcolor="#BDBDBD" align="center" colspan="3">
- <b>
- <font size="2">
  <xsl:value-of select="due" />
  </font>
  </b>
  </td>
  </xsl:for-each>
- <td bgcolor="#BDBDBD" align="center" colspan="3">
- <b>
  <font size="2">Total</font>
  </b>
  </td>
  </tr>
- <tr>
- <xsl:for-each select="pmr6sum/item[count(. | key('d-due',due)[1])=1]">
  <xsl:sort select="due" data-type="text" />
- <td bgcolor="#BDBDBD" align="center" colspan="1">
- <b>
  <font size="2">Booked</font>
  </b>
  </td>
- <td bgcolor="#BDBDBD" align="center" colspan="1">
- <b>
  <font size="2">Poured</font>
  </b>
  </td>
- <td bgcolor="#BDBDBD" align="center" colspan="1">
- <b>
  <font size="2">Despatched</font>
  </b>
  </td>
  </xsl:for-each>
- <td bgcolor="#BDBDBD" align="center" colspan="1">
- <b>
  <font size="2">Booked</font>
  </b>
  </td>
- <td bgcolor="#BDBDBD" align="center" colspan="1">
- <b>
  <font size="2">Poured</font>
  </b>
  </td>
- <td bgcolor="#BDBDBD" align="center" colspan="1">
- <b>
  <font size="2">Despatched</font>
  </b>
  </td>
  </tr>
- <xsl:for-each select="pmr6sum/item[count(. | key('c-code',ccode)[1])=1]">
  <xsl:sort select="ccode" data-type="number" />
  <xsl:variable name="c-code" select="ccode" />
- <tr>
- <td align="center">
  <xsl:value-of select="$c-code" />
  </td>
- <td align="center">
  <xsl:value-of select="desc" />
  </td>
- <td align="center">
  <xsl:value-of select="mld" />
  </td>
- <td align="center">
  <xsl:value-of select="cre" />
  </td>
- <td align="center">
  <xsl:value-of select="uwt" />
  </td>
- <td align="center">
  <xsl:value-of select="ppm" />
  </td>
- <xsl:for-each select="../item[count(. | key('d-due',due)[1])=1]">
  <xsl:sort select="due" data-type="text" />
- <td align="right">
  <xsl:value-of select="format-number(sum(../item[(ccode=$c-code) and
(due=current()/due)]/book),'########')" />
  </td>
- <td align="right">
  <xsl:value-of select="format-number(sum(../item[(ccode=$c-code) and
(due=current()/due)]/pour),'########')" />
  </td>
- <td align="right">
  <xsl:value-of select="format-number(sum(../item[(ccode=$c-code) and
(due=current()/due)]/desp),'########')" />
  </td>
  </xsl:for-each>
- <td align="right">
  <xsl:value-of
select="format-number(sum(../item[ccode=$c-code]/book),'########.##')"
/>
  </td>
- <td align="right">
  <xsl:value-of
select="format-number(sum(../item[ccode=$c-code]/pour),'########.##')"
/>
  </td>
- <td align="right">
  <xsl:value-of
select="format-number(sum(../item[ccode=$c-code]/desp),'########.##')"
/>
  </td>
  </tr>
  </xsl:for-each>
- <tr>
- <td bgcolor="#BDBDBD" align="center">
- <b>
  <font size="2">Grand Total</font>
  </b>
  </td>
- <xsl:for-each select="pmr6sum/item[count(. | key('d-due', due)[1])=1]">
  <xsl:sort select="due" data-type="text" />
  <xsl:variable name="d-due" select="due" />
- <td bgcolor="#BDBDBD" align="right">
- <b>
- <font size="2">
  <xsl:value-of
select="format-number(sum(../item[(due=$d-due)]/molds),'########.##')"
/>
  </font>
  </b>
  </td>
- <td bgcolor="#BDBDBD" align="right">
- <b>
- <font size="2">
  <xsl:value-of
select="format-number(sum(../item[(due=$d-due)]/pour),'########.##')"
/>
  </font>
  </b>
  </td>
- <td bgcolor="#BDBDBD" align="right">
- <b>
- <font size="2">
  <xsl:value-of
select="format-number(sum(../item[(due=$d-due)]/weight),'########.##')"
/>
  </font>
  </b>
  </td>
  </xsl:for-each>
- <xsl:for-each select="pmr6sum/item[1]">
- <td bgcolor="#BDBDBD" align="right">
- <b>
- <font size="2">
  <xsl:value-of select="format-number(sum(../item/book),'########.##')" />
  </font>
  </b>
  </td>
- <td bgcolor="#BDBDBD" align="right">
- <b>
- <font size="2">
  <xsl:value-of select="format-number(sum(../item/pour),'########.##')" />
  </font>
  </b>
  </td>
- <td bgcolor="#BDBDBD" align="right">
- <b>
- <font size="2">
  <xsl:value-of select="format-number(sum(../item/desp),'########.##')" />
  </font>
  </b>
  </td>
  </xsl:for-each>
  </tr>
  </table>
  </body>
  </html>
  </xsl:template>
  </xsl:stylesheet>



Regards
Eugene

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>