[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] XSLT optimisation


Subject: Re: [xsl] XSLT optimisation
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 28 Mar 2003 16:36:52 GMT

> I realise that both key() and <xsl:copy> are ways of improving
> the speed of processing,

<xsl:copy doesn't really spedd anything, it just generates one node in
the result with the same name as a node ion the source.

<xsl:copy-of can speed things up: If you want to copy an entire branch
copy-of select="." is probaby quicker than doing a recursive walk over
the tree copying each node individually.

Keys on the other hand can speed things up a lot (by several orders of
magnitude in some cases), but it depends what you are doing.  if you
are repeatedly doing //*[@id='foo'] for different values of foo then you
are walking over the tree lots of times, however if you do <xsl:key
name="x" match="*" use="@id""/> then essentially you geta hash table
which gives quick access to the nodes returned by the above, by going
key('x','foo') Note however you have to walk over the tree to build the
key, and you have to have the space to store the indexs so if you are
only doing each access once you probably don't win by using a key.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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



Current Thread