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

How to do for-each on nodeset returned by key() functi

Subject: How to do for-each on nodeset returned by key() function
From: SoumenS@xxxxxxxxx
Date: Mon, 23 Sep 2002 12:55:21 -0700
do for each
Hi,

I have a declaration like this:

<xsl:key  name = "nodeInfoMap" match= "//nodeInfo" use = "name"/>

Now when I do key('nodeInfoMap', @name) at some context, more than one nodes
are returned. i.e.

count(key('nodeInfoMap', @name) ) > 1

In other words there are more than one nodeInfo with same name but other
children/text() could
be different. Now, I wish to do a for-each loop over the nodes. I tried 

<xsl:for-each select='key('nodeInfoMap', @name)'> -- DID NOT WORK
<xsl:for-each select='key('nodeInfoMap', @name)//nodeInfo'> -- DID NOT WORK

How would I iterate over the nodes returned by key function? The XML
document
in brief is given below. Basically I am trying to select a nodeInfo which

1. matches name
2. matches some other criteria

I know I can have other maps but I am interested to know how may
I iterate over nodeset returned by key().

Thanks,
Soumen.

<?xml version="1.0" encoding="iso-8859-1"?>
<snmp-metadata>
....
....
<nodeInfo>
<name>snmpOutGetRequests</name>
<oid>1.3.6.1.2.1.11.25</oid>
<full-path>iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).snmp(11).snmpOu
tGetRequests(25)</full-path>
<module>SNMPv2-MIB</module>
<parent>snmp</parent>
<prev-sibling>snmpOutGenErrs</prev-sibling>
<next-sibling>snmpOutGetNexts</next-sibling>
<type>OBJECT-TYPE</type>
<numerical-syntax>SNMP_SYNTAX_CNTR32</numerical-syntax>
<base-syntax>Counter32</base-syntax>
<composed-syntax>Counter32</composed-syntax>
<status>obsolete</status>
<max-access>read-only</max-access>
<description><![CDATA[
The total number of SNMP Get-Request PDUs whichhave been generated by the
SNMP protocol entity. 
 
]]></description>
</nodeInfo>

<nodeInfo>
<name>snmpOutGetNexts</name>
<oid>1.3.6.1.2.1.11.26</oid>
<full-path>iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).snmp(11).snmpOu
tGetNexts(26)</full-path>
<module>SNMPv2-MIB</module>
<parent>snmp</parent>
<prev-sibling>snmpOutGetRequests</prev-sibling>
<next-sibling>snmpOutSetRequests</next-sibling>
<type>OBJECT-TYPE</type>
<numerical-syntax>SNMP_SYNTAX_CNTR32</numerical-syntax>
<base-syntax>Counter32</base-syntax>
<composed-syntax>Counter32</composed-syntax>
<status>obsolete</status>
<max-access>read-only</max-access>
<description><![CDATA[
The total number of SNMP Get-Next PDUs which havebeen generated by the SNMP
protocol entity. 
 
]]></description>
</nodeInfo>
.....
.....
</snmp-metadata>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.