Subject: Re: [xsl] Use predicates/patterns or xsl:choose (was:] Stylesheet optimisation) From: Geert Josten <Geert.Josten@xxxxxxxxxxx> Date: Tue, 11 Jan 2005 16:55:40 +0100 |
I was reading up all stuff about optimizing the performance of xslt. One basic advice I found is:
"Avoid complex patterns in template rules. Instead, use <xsl:choose> within the rule."
(Mike Kay at http://www.dpawson.co.uk/xsl/sect4/N9883.html#d12447e254)
This seems quite old (before July 2000), and I wondered if it is still true with newer Saxon or Xalan versions.
I rather split complex templates in more than one and adjust the match patterns accodingly to shorten and simplify the actual code inside the xsl:template. So I try to avoid using xsl:choose or xsl:if areas as much as possible as they make the stylesheet sometimes quite difficult to read and maintain. And I was under the impression that splitting complex templates in easier ones by making the match as precise as possible would also be quicker as I (naively) thought the processor does something like a lookup table before actually performing the transformation.
> So, is it still better to avoid complex patterns or am I understanding the advice in the wrong > way?
<xsl:template match="my-elem"> <xsl:choose> <xsl:when test="..condition 1.."> <xsl:apply-templates select="." mode="condition1" /> </xsl:when> ... </xsl:choose> </xsl:template>
<xsl:template match="my-elem" mode="condition1"> .. handling of my-elem in condition 1 .. </xsl:template>
Thanks a lot Chris
Cheers, Geert
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Use predicates/patterns or xs, christof.hoeke | Thread | RE: [xsl] Use predicates/patterns o, Michael Kay |
RE: [xsl] Multiple IDs, Pieter Reint Siegers | Date | Re: [xsl] Re: XML / XSL Editors, António Mota |
Month |