[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: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 19 Dec 2008 08:38:04 -0500
Re:  Key lookup without context.
At 2008-12-19 14:21 +0100, peter verhaar wrote:
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"?

By using the third argument of key(): it is defined as the apex of a tree under which which the keyed values are searched.


I tried select="\\key('myKey'...." but this didn't work.

So I have:

<xsl:key name="myKey" match="books/book/...." use="..."/>

Add a variable with global scope:


<xsl:variable name="myBooks" match="/"/>

<xsl:function name="...." as="xs:double">
 <xsl:param name="input"/>
    <xsl:for-each select="key('myKey',$input)">

key('myKey',$input,$myBooks)


        processing goes here
    </xsl:for-each>
</xsl:function>

I hope this helps.


. . . . . . . . . . . . Ken


-- Upcoming XSLT/XSL-FO, UBL and code list hands-on training classes: : Sydney, AU 2009-01/02; Brussels, BE 2009-03; Prague, CZ 2009-03 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video sample lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg Video course overview: http://www.youtube.com/watch?v=VTiodiij6gE G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal

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.