[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How do you count nesting level

Subject: RE: How do you count nesting level
From: "Ball, Mike" <Mike.Ball@xxxxxxxxxxxxxxxx>
Date: Mon, 8 Oct 2001 12:01:38 +0100
nesting level
You were close:

Try.

select="count(ancestor::section)"

Mike Ball

 
Application Services Consultant
Software AG UK
> -----Original Message-----
> From: J S Publications [mailto:admin@xxxxxxxxxx]
> Sent: 08 October 2001 11:19
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  How do you count nesting level
> 
> 
> Hi
> 
> I want to be able to work out how deep a given <title> is in 
> a document. In 
> the schema, <title> is always a direct descendant of a 
> <section>. Given the 
> following:
> 
> <collection>
> 	<section>
> 		<title>1</title>
> 		<title>2</title>
> 	</section>
> 	<section />
> 	<section>
> 		<title>3</title>
> 		<title>4</title>
> 		<section>
> 			<title>5</title>
> 		</section>
> 	</section>
> </collection>
> 
> Title 1 and 2 are at level 1. Title 3 and 4 are at level 1. 
> Title 5 is at 
> level 2.
> 
> I have tried:
> 
> <xsl:template match="title" mode="DoIt">
> 	<xsl:param name="Depth" select="count(ancestor::*[section])" />
> 	<xsl:value-of select="$Depth" />
> 	<xsl:apply-templates mode="DoIt" />
> </xsl:template>
> 
> But it doesn't seem to be working. What am I missing?
> 
> Chris
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

-- 
The content of this e-mail is confidential, may contain privileged material
and is intended solely for the recipient(s) named above. If you receive this
in error, please notify Software AG immediately and delete this e-mail.

Software AG (UK) Limited
Registered in England & Wales 1310740
Registered Office: Hudson House, Hudson Way,
Pride Park, Derby DE24 8HS

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.