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

RE: Problem with keys in for-each (?)

Subject: RE: Problem with keys in for-each (?)
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 14 Mar 2001 15:31:57 -0000
RE:  Problem with keys in for-each (?)
> mike> Mike Kay wrote:
>
> mike> The key() function looks for nodes that are in the same
> document as
> the
> mike> context node. Your xsl:for-each is changing the context
> node to be one
> in a
> mike> different document.
>
> Now I'm writing again:
>
> Could someone help me understand this?  I believe you Mike,
> obviously, but I
> thought that this
>
> <xsl:key name="itemKey" match="//*[local-name() = 'item']"
> 			use="ancestor-or-self::*[@type][1]/@type" />
>
> created a hash table (or something) in memory that was then
> referenced by
> name via the key() function - the idea that the context would
> somehow affect
> this is bizarre.  How is it that keys can speed up processing
> so much if
> they don't actually keep this information in memory?

It keeps one hash table for each key for each document. (Or at least, in
Saxon's case, for each document against which the key is actually used).


> Maybe I've been
> conceptualizing the idea of key being a hash table too literally.
>
> Also, given this variable:
>
> <xsl:variable name="taxonomy"
> select="document('AlteredTaxonomy.xml')" />
>
> When Mike says that the for-each on this variable changes the
> context to a
> *different document*, it means that the document I'm
> processing does not
> "include" any variables I have created during the processing of the
> stylesheet,
>

Variables belong to the stylesheet, not to any particular source document.

Mike Kay
Software AG


 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.