This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How do you count nesting level
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] How do you count nesting level
- From: David Carlisle <davidc at nag dot co dot uk>
- Date: Mon, 8 Oct 2001 11:43:44 +0100
- References: <5.1.0.14.2.20011008111055.04440828@pop.compuserve.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
> <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