[Home] [By Thread] [By Date] [Recent Entries]

Subject: RE: deepest node
From: "Josh Canfield" <Josh.Canfield@xxxxxxxxxxxx>
Date: Wed, 11 Feb 2004 14:32:01 -0800
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@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Bennett
Sent: Wednesday, February 11, 2004 1:16 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  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


Current Thread
  • deepest node
    • Bennett - Wed, 11 Feb 2004 16:23:57 -0500 (EST)
      • <Possible follow-ups>
      • Josh Canfield - Wed, 11 Feb 2004 17:32:28 -0500 (EST) <=
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member