xsl-list
[Top] [All Lists]

RE: [xsl] Key lookup without context.

2008-12-19 08:37:11

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(_dot_)verhaar1(_at_)gmail(_dot_)com] 
Sent: 19 December 2008 13:21
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>