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

Re: Theory question about keys (no code)

Subject: Re: Theory question about keys (no code)
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Mon, 06 Aug 2012 21:57:47 +0100
Re:  Theory question about keys (no code)
I can't tell you how other implementations work. However, key definitions aren't linked to any particular input document, so the processor don't know until the key() function is called whether a particular key will be used to search a particular document. Therefore, a fairly obvious strategy is to build the index for a key/document pair (which might be a hash table or a B-tree or any other kind of data structure) the first time that the key() function is used to search that document using that key.

I can't quite see how building the key incrementally could be useful, except in conjunction with the XSLT 2.0 feature where the third argument of key() allows you to search part of a document only. When that feature is used I can imagine an implementation only indexing the parts of the document that are searched (though that's not what Saxon actually does.)

Michael Kay
Saxonica


On 06/08/2012 18:16, FAIR, ED wrote:
Hi,

I am not totally new to xslt but have a very basic question about keys.

My stylesheets are working but performance is starting to suffer as document sizes have grown. I'm trying to improve performance by adding and using keys.

I understand that an xsl:key creates something like an associative array that can be used to cross-reference elements in my document using the key() function. I have no problem understanding these concepts.

My question is: when is the associative array built? Is it built entirely in the beginning, as the source document is first read into memory? Or is it built incrementally, as each template is matched during transformation?

FWIW, I am using xslt 1.0, xsltproc in Solaris 10:

       $ xsltproc -V
       Using libxml 20623, libxslt 10115 and libexslt 812
       xsltproc was compiled against libxml 20623, libxslt 10115 and libexslt 812
       libxslt 10115 was compiled against libxml 20623
       libexslt 812 was compiled against libxml 20623
       [vsadm@alnvitalpol2: /usr/home/vsadm/csv-pcrf-1 ]
       $

ed

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.