RE: [xsl] deepest node

Subject: RE: [xsl] deepest node
From: "Josh Canfield" <Josh.Canfield@xxxxxxxxxxxx>
Date: Wed, 11 Feb 2004 14:32:01 -0800
I cut this from, which I found by searching google using "xsl deepest node"

Hope this helps,

<!-- 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::*)"/>

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Bennett
Sent: Wednesday, February 11, 2004 1:16 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] deepest node


How do I find the deepest node in a document?


 XSL-List info and archive:

 XSL-List info and archive:

Current Thread
  • [xsl] deepest node
    • Bennett - Wed, 11 Feb 2004 16:16:03 -0500
      • <Possible follow-ups>
      • Josh Canfield - Wed, 11 Feb 2004 14:32:01 -0800 <=