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

Re: A problem using the xsl:key facility

Subject: Re: A problem using the xsl:key facility
From: Lars Huttar <lars_huttar@xxxxxxx>
Date: Tue, 20 Jul 2010 16:31:36 -0500
Re:  A problem using the xsl:key facility
On 7/20/2010 3:30 PM, Michael Kay wrote:
> On 20/07/2010 21:17, Nathan Potter wrote:
>
> The key() function, when called with two arguments, always searches
> within the current document (more accurately, the document containing
> the context node). Your xsl:for-each changes the current document, so
> you are searching the wrong thing. In XSLT 2.0 you can use the third
> argument of the key() function to indicate which document you want to
> search.

Maybe this should go on the list of common XSLT mistakes.
http://saxonica.blogharbor.com/blog/_archives/2010/6/11/4550606.html

Even if it's not as common as others, this mistake is one that is hard
to debug because there's a context dependency in the key() that one
often doesn't think about (affected by a context change in the for-each
that one often doesn't think about).

Usually they "just work" fine, but when they don't, it's mysterious,
even baffling.

Lars

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.