[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] How do you count nesting level


Subject: Re: [xsl] How do you count nesting level
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 8 Oct 2001 11:43:44 +0100

> <xsl:param name="Depth" select="count(ancestor::*[section])" />

that counts (if you do not pass any other value as the parameter)
the number of ancestors that have a section child. In your example this
will be 0 for titles 1 to 4 and 1 for title 5.

You said you wanted 

> Title 1 and 2 are at level 1. Title 3 and 4 are at level 1. Title 5 is at 
> level 2.

which looks like count(ancestor::section)

David


_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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



Current Thread