|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Practical Suggestion for XSLT Performance Improvement
"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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








