xsl-list
[Top] [All Lists]

Re: [xsl] Which executes faster: templates with specific match-patterns and simple content or templates with simple match-patterns and specific content ?

2014-11-04 14:53:47
On Tue, Nov 4, 2014 at 12:32 PM, Costello, Roger L. 
costello(_at_)mitre(_dot_)org
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
Which executes faster:

<xsl:template match="A[@x eq 'a']/B[@y eq 'b']/C">
                <xsl:if test="D eq 10">...

or

<xsl:template match="A[@x eq 'a' ]">
                <xsl:if test="B[@y eq 'b']/C/D eq 10">...

I am not sure there would be great performance difference (and this
might depend on the <xsl:apply-templates> instructions that are not
shown), but as a good programming practice I would recommend to
eliminate the <xsl:if> instructions completely and instead use:


   <xsl:template match="A[@x eq 'a']/B[@y eq 'b']/C[D[1] eq 10]">


-- 
Cheers,
Dimitre Novatchev
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>