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(_at_)comet(_dot_)de>
Subject: AW: [xsl] 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