The lack of indentation here makes it very hard to see the structure, but
I'll try.
<xsl:template match="/">
<html>
<h4>Report</h4>
<body>
That's really sloppy HTML. If you're generating HTML using XSLT, there's
really no excuse for not making it something that at least approximates to
valid HTML.
<xsl:for-each select="pmr6sum/item[count(. | key('d-due',due)[1])=1]">
You're doing Muenchian grouping here. That doesn't by itself explain why the
performance is bad, but you would improve your code and perhaps make the
problem more visible by using xsl:for-each-group instead.
<xsl:for-each select="pmr6sum/item[count(. | key('c-code',ccode)[1])=1]">
...
<xsl:for-each select="../item[count(. | key('d-due',due)[1])=1]">
...
<xsl:value-of select="format-number(sum(../item[(ccode=$c-code) and
(due=current()/due)]/book),'########')" />
I think this is the heart of your problem. For each item (well, each
distinct item) you are processing ../item - that is, all the sibling items;
and for each of these you have another .//item which is again processing all
the sibling items. So if you double the number of items, your code will take
8 times as long: it's O(n^3).
I'm not inclined to suggest improvements to this code without first
understanding something about your data and the requirements your code is
designed to meet.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Eugene Bernard [mailto:eugene(_dot_)bernard(_at_)gmail(_dot_)com]
Sent: 19 November 2008 07:52
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Slow Transformation
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-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>
--~--