[xsl] Sort by depth of leaf-nodes

Subject: [xsl] Sort by depth of leaf-nodes
From: Delaney Robin <Robin.Delaney@xxxxxxx>
Date: Fri, 6 Dec 2002 14:45:44 +0100
Hello,

I've got the following XSL which gives me, the element-names of the leaf
nodes of the descendants of the first child of element Concat
(I think thats how it goes in English !). 

	<xsl:template match="Concat">
			<xsl:for-each select="(*[1]//*[not(*)])">	 
				<xsl:value-of select="name()"/>	
			</xsl:for-each> 	
 	</xsl:template>

I need to get the names for the "deepest" node  under Concat (ie. the
element with the most leaf nodes) which is not necessarily the first (as
above). I believe its a combination of taking the [1] out from the above
xpath expression and building in xsl:sort combined with count but my feeble
attempts come to nothing. Any help appreciated !

Rough XML snip:

<Concat>
<A>
   <B>1</B>
</A>
<A>
   <B>1</B>
   <C>2</C>
</A>
</Concat>

output needed:  BC 

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


Current Thread