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

key( 'myKey', 'key', $current) searches only the sub t

Subject: key( 'myKey', 'key', $current) searches only the sub tree from $current
From: Johannes Neubauer <johannes.neubauer@xxxxxxxxxxxxxxxxx>
Date: Sat, 23 Feb 2008 17:08:05 +0100
 key( 'myKey'
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I have a <xsl:key> that maps unique attribute values of sibling-elements
to the respective element. When I use the key() function in a
<xsl:function> I have to submit a node as a third argument, so that it's
clear which source document is used (there's no context node in
functions available).

So I tried this:

xsl:key:
<xsl:key match="book" name="myKey" use="@id"/>

function call in XPath:
key('myKey', '100', $current) (: $current is the context node supplied
as a parameter to the xsl:function :)

source doc:
<test>
~  <book id="100"/>
~  <book id="101"/>
~  <book id="102"/>
~  <book id="103"/>
</test>

But I find the respective book element only if it is $current. When I
change the function call to this:
key('myKey', '100', root($current))

I find it independent from which element $current is, it has to be from
the right source document only.

"XSLT 2.0 3rd edition" from Michael Kay page 574 says, that the supplied
~ third argument must not be the document node, but  any node of the
source document.

Is this a bug in Saxon or one of the things that changed in the spec
after publishing the book? I didn't find the part in the online
documentation, where the xslt functions are described.

wfg,
Jonny.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHwETlGaEJacf6i/cRAoQ/AJ4wkJueQNuLmmTSIUM1zAbW4zA0qgCghSI+
KyJW65lEWL2cGFDWxBmdxJ0=
=nnEt
-----END PGP SIGNATURE-----

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.