 |
 |
 |
Hi,
> <!--This is the template with recursion to add the prices,
> needs test for NaN-->
> <xsl:template name="total-value">
> <xsl:param name="price"/>
> <xsl:param name="result" select="0"/>
> <xsl:choose>
> <xsl:when test="$price">
> <xsl:call-template name="total-value">
> <xsl:with-param name="price"
> select="$price[position() > 1]"/>
> <xsl:with-param name="result"
> select="($result + $price)"/>
E.g.Replace this with
<xsl:with-param name="result">
<xsl:choose>
<xsl:when test="string(number($price[1])) = 'NaN'">
<xsl:value-of select="$result"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$result + $price[1]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
or place the test outside the xsl:call-template to pass the $result always as a number.
> </xsl:call-template>
> </xsl:when>
> <xsl:otherwise><xsl:value-of
> select="$result"/></xsl:otherwise>
> </xsl:choose>
> </xsl:template>
Quick test reveals that e.g. in Saxon 6.5.3 if you keep the $price bound to the same node-set and use a $cursor to point to the node being processed, with large documents the processing time goes down a third. Though you have to test if it helps your complete stylesheets and is faster in your choise of XSLT engine.
Cheers,
Jarno - this weeks Real Synthetic Audio <http://www.synthetic.org/play.html>
|
 | 

|  |
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.
|  |
| |
 |
 |
 |