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

Re: Trouble using xsl:key under XSL 1.0

Subject: Re: Trouble using xsl:key under XSL 1.0
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 13 Dec 2007 18:13:28 +0100
Re:  Trouble using xsl:key under XSL 1.0
Scott Trenda wrote:
<xsl:key name="playerResultLookupByWeek" match="playerResult[../@week=$week]" use="@player" />


A big thing to watch out for here - the xsl:key match must be a pattern,
which is required to be context-free. (Same as the match pattern in
xsl:template.) And one of the big limitations to patterns is that you
cannot have variable references inside them. Even if the variable is
top-level, and even if it's something simple like
document('')/*/someElement, it can't be used in the match pattern.

Learn to start thinking around variables in your keys, and you'll end up
banging your head against the wall less often. :)

Unless you start out with XSLT 2.0 of course, which does allow (global) variables in patterns. So leave that wall near by in case you want to switch to 2.0 anytime soon ;)


Cheers,
-- Abel Braaksma

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.