I have this stylesheet that makes about 30 different database
queries and produces about 3000 lines of XSL code, which
in the end produces a 4-5 page tabular data form. For each cell I
have a template that allows you to format the cell data, an example
is:
<xsl:template match="col[@mode='simple" >
<xsl:param name="data"/>
<xsl:variable name="colMap" select="./@colMap"/>
<xsl:variable name="val" select="$data/col[@column-label=$colMap]"/>
<fo:block>
<xsl:value-of select="$val"/>
</fo:block>
</xsl:template>
now if I replace that template with the following
<xsl:template match="col[@mode='simple]" >
<xsl:param name="data"/>
<xsl:variable name="colMap" select="./@colMap"/>
<fo:block>
<xsl:value-of select="$data/col[@column-label=$colMap]"/>
</fo:block>
</xsl:template>
the whole stylesheet is processed 2X faster, a difference from 4 sec
to 2.1 sec. I just ca't see why, there is just as many XPath statements
and they are just as complex. It is not the variable assignment because
the following template is only marginally slower.
<xsl:template match="col[@mode='simple]" >
<xsl:param name="data"/>
<xsl:variable name="colMap" select="./@colMap"/>
<xsl:variable name="val" select="$data"/>
<fo:block>
<xsl:value-of select="$data/col[@column-label=$colMap]"/>
</fo:block>
</xsl:template>
This template is called the most times, ~500, but it is also not the
only
template and there is a ton of DB activity besides. I can see a minor
speed
difference but to affect the processing time by half, the performance
penalty
must be incredible
TIA
John G