Subject: Re: [xsl] How do you count nesting level From: Manu KY <manu_kry@xxxxxxxxx> Date: Mon, 08 Oct 2001 20:11:35 +0530 |
Hi, you could also do it , after modifying your method like this:
<xsl:template match="title"> <xsl:param name="Depth" select="count(ancestor::*[self::section])" /> <xsl:value-of select="$Depth" /> </xsl:template>
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
_________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How do you count nesting , David Carlisle | Thread | RE: [xsl] How do you count nesting , Ball, Mike |
Re: [xsl] Comparision of parsers, Daniel Veillard | Date | RE: [xsl] Comparision of parsers, Chris Bayes |
Month |