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

AW: how to get node with maximum child nodes ??

Subject: AW: how to get node with maximum child nodes ??
From: Dipesh Khakhkhar <dkhakhkh@xxxxxxxxxxxxxxx>
Date: Thu, 28 Aug 2003 18:28:53 -0400
get child elements
Hi Markus,


Thanks once again for replying.

I finally got it. I used full path for the child element i.e 
count(OBJECT/ATTRIBUTE) and took the generated id for the OBJECT node.

Previously i was running two for loop i.e. one for the CLASS node which is the 
parent of the OBJECT node and then one for OBJECT node and I was getting 
generated id for the two object nodes and because of that only i was not 
getting the node which i was looking for.

I removed one for loop for OBJECT node and finally got the node with maximum 
children of type ATTRIBUTE.

Thanks for taking out time to reply me. Highly appreciated.

Regards,
Dipesh

Date: Thu, 28 Aug 2003 20:21:30 +0200
From: Markus Abt <abt@xxxxxxxx>
Subject: AW:  how to get node with maximum child nodes ??

Hi Dipesh,

you have 2 <CLASS NAME="Client_Agent> elements in your XML.
For each, you find the maximum ATTRIBUTE element count in OBJECT elements.
So you get 2 values.

If you want to get the overall maximum, do:

<xsl:for-each select="//CLASS[normalize-space(@NAME)='Client_Agent']/OBJECT">
<xsl:sort select="count(ATTRIBUTE)" order="descending"/>
<xsl:if test="position()=1">
<xsl:value-of select="generate-id(.)"/>
</xsl:if>
</xsl:for-each>


Regards,
Markus


 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.