xsl-list
[Top] [All Lists]

RE: [xsl] multiple values for the key

2008-07-31 09:44:11
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(_at_)yahoo(_dot_)com] 
Sent: 31 July 2008 17:29
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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.


      

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