This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: XSL sheet Optimisation


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?

tia,
Rob


----- Original Message -----
From: "Oliver Becker" <obecker@informatik.hu-berlin.de>
To: <xsl-list@lists.mulberrytech.com>
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
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')"
>
> Salut,
> Oliver
>
>
> /-------------------------------------------------------------------\
> |  ob|do        Dipl.Inf. Oliver Becker                             |
> |  --+--        E-Mail: obecker@informatik.hu-berlin.de             |
> |  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
> \-------------------------------------------------------------------/
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]