Re: [xsl] XSL sheet Optimisation

Subject: Re: [xsl] XSL sheet Optimisation
From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 23 Apr 2001 15:56:22 +0200 (MET DST)
Hi Frederic,

> Some of my nodes have an id attribute, but can be at any depth of the tree.
> For example I have a <theme id="t1"> tag. So when I want to "reach" it from
> the root node, I have to use this XPath expression :
> <xsl:apply-templates select="//theme[@id='t1']" />
> Will the XSL processor (I use Xalan in Cocoon) process every node until it
> finds the one ? Just like the XPath expression "://*[name(.)='theme' and
> @id='t1']" ? Or is it better potimized ?

if your id attribute is a *real* id, i.e. of the type ID declared in your
DTD (e.g. <!ATTLIST theme id ID #IMPLIED>) then you can use the id function.
-> select="id('t1')"

Otherwise use keys.
<xsl:key name="mykey" match="theme" use="@id" />

and then select="key('mykey', 't1')"


|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
|  op|qo        WWW: |

 XSL-List info and archive:

Current Thread