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

RE: Key lookup without context.

Subject: RE: Key lookup without context.
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 19 Dec 2008 13:36:41 -0000
RE:  Key lookup without context.
Define a global variable

<xsl:variable name="root" select="/"/>

and use $root as the third argument of key().

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: peter verhaar [mailto:peter.verhaar1@xxxxxxxxx] 
> Sent: 19 December 2008 13:21
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Key lookup without context.
> 
> Hello,
> 
> I have a 'context-free' function which does a key() lookup. 
> However, saxon is complaining:
> 
> SXWN9009: Cannot select a node here: the context item is undefined
> 
> Question: How can I say: "Start a key lookup from the root of 
> the file"?
> 
> I tried select="\\key('myKey'...."  but this didn't work.
> 
> So I have:
> 
> <xsl:key name="myKey" match="books/book/...." use="..."/>
> 
> <xsl:function name="...." as="xs:double">  <xsl:param name="input"/>
>     <xsl:for-each select="key('myKey',$input)">
>         processing goes here
>     </xsl:for-each>
> </xsl:function>

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.