|
Subject: Re: Practical Suggestion for XSLT Performance Improvement From: James Clark <jjc@xxxxxxxxxx> Date: Thu, 07 Oct 1999 17:20:30 +0700 |
"Clark C. Evans" wrote:
> Here is a snippet:
>
> <xsl:for-each select="$product-list">
> <xsl:variable name="product" select="." />
> ...
> <xsl:for-each select="$day-list">
> <xsl:variable name="day" select="." />
> ...
>
> <xsl:value-of
> select="sum(//price[../product=$product]
> [../../../dow=$day])" /> .
I found your stylesheet ran a lot faster when I rewrote this as:
<xsl:for-each select="$product-list">
<xsl:variable name="product" select="." />
<xsl:variable name="product-prices"
select="//price[../product=$product]"/>
...
<xsl:for-each select="$day-list">
<xsl:variable name="day" select="." />
...
<xsl:value-of
select="sum($product-prices[../../../dow=$day])" />
I suspect a further improvement would be possible by using keys (not yet
implemented by XT). Declare a key
<xsl:key name="price-by-product" match="price" use="../product"/>
and then use
key('price-by-product',$product)
instead of
//price[product=$product]
James
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: Practical Suggestion for XSLT P, Oren Ben-Kiki | Thread | Re: Practical Suggestion for XSLT P, Clark C. Evans |
| Re: Q: XML+XSL transforms to a prin, Sebastian Rahtz | Date | RE: Practical Suggestion for XSLT P, Kay Michael |
| Month |