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

Re: Benefits of using xsl:key

Subject: Re: Benefits of using xsl:key
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Tue, 3 Nov 2009 09:20:35 +0000
Re:  Benefits of using xsl:key
2009/11/3 Jesper Tverskov <jesper.tverskov@xxxxxxxxx>:
> On Tue, Nov 3, 2009 at 9:03 AM, David Carlisle <davidc@xxxxxxxxx> wrote:
>>However a typical
>> muenchian grouping example can easily be orders of magnitude faster and
>> so measurable on really quite small documents as you are avoiding
>> an order  n^2 along the sibling axis looking for duplicates.
> What about XSLT 2.0 then, where we use xsl:for-each-group?
> A set of XSLT 2.0 test files demonstrating a dramatic difference would
> really be much appreciated?

Create a large index file along the lines of:

<entry id="nnn1" value="vvv1"/>
<entry id="nnn2" value="vvv2"/>

then in another stylesheet do multiple lookups into that file:

$entry-doc//entry[@id eq $id]/@value

then use a key instead:

<xsl:key name="entry-by-id" match="entry" use="@id"/>


key('entry-by-id', $id, $entry-doc)/@value

Provided the processor doesn't optimize // (such as the paid-for
version of Saxon) then you should see a measurable difference between
the former and the latter.

Andrew Welch
Kernow: http://kernowforsaxon.sf.net/

Current Thread


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.
First Name
Last Name
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.