Re: [xsl] Can templates be invoked based on the value of a variable?

Subject: Re: [xsl] Can templates be invoked based on the value of a variable?
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Thu, 02 Apr 2009 18:57:53 +0200
pilgrim cnonline.net schrieb:

New question:  Is there any execution efficiency advantage between
using "child::*"  or  "element()"?

These are not only equivalent, but identical regarding their semantics, and *should* boil down to exactly the same binary instruction set:

    <xsl:apply-templates select="*"/>
    <xsl:apply-templates select="child::*"/>
    <xsl:apply-templates select="element()"/>
    <xsl:apply-templates select="child::element()"/>

But I'm not an implementor, so I have no idea.

Execution efficiency is always processor dependent. What leads to
good execution in one processor doesn't have to do so in another.
If you want to find out, install various processors and collect some
empirical data.

Doing this for a couple of well-understood test-cases and a couple of
processors, you'll get a feeling for what's efficient and what isn't,
and how processors vary.

In general, I've found <xsl:key> very versatile and useful in order
to allow both cleaner code and faster execution.

Michael Ludwig

Current Thread