RE: [xsl] multiple values for the key

Subject: RE: [xsl] multiple values for the key
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 31 Jul 2008 17:43:37 +0100
In XSLT 2.0, you can supply a sequence:

key('keyname', ('111', '222'))

In 1.0, you can supply a node-set with one value per node - but of course
it's hard to set that up, you need the xx:node-set() function.

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

> -----Original Message-----
> From: sudheshna iyer [mailto:sudheshnaiyer@xxxxxxxxx] 
> Sent: 31 July 2008 17:29
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] multiple values for the key
> 
> How do I use multiple key values?
> 
> Declaration:
> <xsl:key name="keyname" match="subroot" use="ccc"/>
> 
> During the usage, I want to specify multiple values:
> 
> <xsl:variable name="keyname" select="key('keyname', '11' or 
> '22')"/> ==>  Here I want to use multiple values 11 and 22.
> 
> For the following xml, result should be:
> aaaaa bbbbb ccccc ddddd ==> note that both values of  ccc= 
> '22' and ccc= '11' 
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <root>    
>     <subroot id="11111">
>         <ccc>11</ccc> ==> needs to be picked
>         <ddd>2005-08-26</ddd>
>         <eee>aaaaa</eee>
>     </subroot>
>     <subroot id="11111">
>         <ccc>22</ccc> ==> needs to be picked
>         <ddd>2005-08-26</ddd>
>         <eee>bbbbb</eee>
>     </subroot>
>     <subroot id="11111">
>         <ccc>11</ccc>
>         <ddd>2005-08-26</ddd>
>         <eee>ccccc</eee>
>     </subroot>
>     <subroot id="11111">
>         <ccc>11</ccc>
>         <ddd>2005-08-26</ddd>
>         <eee>ddddd</eee>
>     </subroot>    
>     <subroot id="11111">
>         <ccc>33</ccc>
>         <ddd>2005-08-26</ddd>
>         <eee>eeeee</eee>
>     </subroot>     
> </root> 
> 
> Thank you for your help.

Current Thread