I cut this from http://www.dpawson.co.uk/xsl/sect4/svg.html#d11254e206, which I
found by searching google using "xsl deepest node"
Hope this helps,
Josh
<!-- calculates the depth of the deepest ancestor
(so we have an idea of how many levels deep the tree
will be): a 'max' trick -->
<xsl:variable name="deepest">
<!-- returns the depth (in ancestors) of the deepest node(s) -->
<xsl:for-each select="//node()[not(node())]">
<xsl:sort select="count(ancestor-or-self::*)"
order="descending" data-type="number"/>
<xsl:if test="position()=1">
<xsl:value-of select="count(ancestor-or-self::*)"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of
Bennett
Sent: Wednesday, February 11, 2004 1:16 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] deepest node
Hello,
How do I find the deepest node in a document?
TIA
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list