Re: [xsl] Optimizing a XSLT

Subject: Re: [xsl] Optimizing a XSLT
From: "Mike Haarman" <mhaarman@xxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Apr 2003 13:37:54 -0500
Eric,

You seem to be solely using string manipulation to create elements and
attributes in your output.  I wonder if it would be quicker to use the features
of XSL provided to build and populate element and attribute nodes:

>  <xsl:template name="PricePointProcess">
>   <xsl:text disable-output-escaping="yes">&lt;PricePoint MW="</xsl:text>
>    <xsl:value-of select="mw"/>
>   <xsl:text disable-output-escaping="yes">" price="</xsl:text>
>    <xsl:value-of select="price"/>
>   <xsl:text disable-output-escaping="yes">"/&gt;</xsl:text>
>  </xsl:template>

<xsl:template name="PricePointProcess">
<xsl:element name="PricePoint">
<xsl:attribute name="MW">
<xsl:value-of select="mw"/>
</xsl:attribute>
<xsl:attribute name="price">
<xsl:value-of select="price"/>
</xsl:attribute>
</xsl:element>
</xsl:template>

I daresay that this will be rather quicker.  Particularly if you are using a
processor implemented in Java this will be doing less mucking with strings and
more building your output tree for the same amount of processing.  Untested.

hth,

Mike


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread