Re: [xsl] XSL sheet Optimisation

Subject: Re: [xsl] XSL sheet Optimisation
From: "Robert Koberg" <rob@xxxxxxxxxx>
Date: Mon, 23 Apr 2001 07:29:18 -0700
Hi all

A question about optimising and keys:

Say I have a large xml file with several sections with several sections
nested within each section, and several sections nested within those, etc...
Each section has an unique ID attribute (no identified in the DTD).

I need to get one section at any level each time I transform the xml at run
time. I transform the xml on the server using xalan or saxon.

Would it be better (faster) to create keys for all the sections and access
the particular section with it's key:
<xsl:apply-templates select="key('mykey', $id)"/>
or would it be better to do something like:
<xsl:apply-templates select="//*[@id=$id]"/>

or is there a better way?


----- Original Message -----
From: "Oliver Becker" <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, April 23, 2001 6:56 AM
Subject: Re: [xsl] XSL sheet Optimisation

> Hi Frederic,
> > Some of my nodes have an id attribute, but can be at any depth of the
> > For example I have a <theme id="t1"> tag. So when I want to "reach" it
> > 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
> > 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
> -> select="id('t1')"
> Otherwise use keys.
> <xsl:key name="mykey" match="theme" use="@id" />
> and then select="key('mykey', 't1')"
> Salut,
> Oliver
> /-------------------------------------------------------------------\
> |  ob|do        Dipl.Inf. Oliver Becker                             |
> |  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
> |  op|qo        WWW: |
> \-------------------------------------------------------------------/
>  XSL-List info and archive:

 XSL-List info and archive:

Current Thread