xsl-list
[Top] [All Lists]

Re: [xsl] Walking a xsl:key

2013-02-22 07:15:46
On Fri, February 22, 2013 10:58 am, Ihe Onwuka wrote:
I thought I saw somewhere that if you omit the 2nd argument to the key
function a set of all nodes in the named xsl:key will be returned.
This is the behaviour I want, is it possible?

It doesn't work as you say.  You can't omit the second argument, and if
you provide an empty sequence as the second argument, XSLT 2.0 [1] says:

   If the second argument is an empty sequence, the result of the
   function will be an empty sequence.

The current XSLT 3.0 WD [2] says you get either the empty sequence or "
the set of nodes having an empty sequence as the value of the key
specifier.", depending on the new xsl:key/@composite value (or its
absence).

You can get the effect you want by making a key where the @use value is
always the same, e.g., 'true()', so "key('my-key', true())" gets you all
the nodes matched by the xsl:key.

Regards,


Tony Graham                                   tgraham(_at_)mentea(_dot_)net
Consultant                                 http://www.mentea.net
Mentea       13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
 --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
    XML, XSL-FO and XSLT consulting, training and programming

[1] http://www.w3.org/TR/xslt20/#keys
[2] http://www.w3.org/TR/xslt-30/#func-key

--~------------------------------------------------------------------
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>