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"/> with 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 http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format