[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSL sheet Optimisation

Subject: Re: XSL sheet Optimisation
From: "Robert Koberg" <rob@xxxxxxxxxx>
Date: Mon, 23 Apr 2001 07:29:18 -0700
xsl 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@xxxxxxxxxxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, April 23, 2001 6:56 AM
Subject: Re:  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@xxxxxxxxxxxxxxxxxxxxxxx             |
> |  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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.