Subject: Re: XPATH : How to get the level of a node (depth) ?
From: "Juergen Hermann" <jhe@xxxxxxxxxxx>
Date: Mon, 14 Feb 2000 13:39:51
|
On Mon, 14 Feb 2000 12:10:04 +0100, Eric RUBINAT wrote:
> How can i get the depth of a node...?
Using Xalan, you'll get this
DOCUMENT: 0
HEADER: 1
LINE: 2 toto
LINE: 2 titi
BODY: 1
LINE: 2 the body text here
from this stylesheet
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()">
<xsl:value-of select="name(.)"/>: <xsl:value-of select="count(ancestor::*)"/>
<xsl:apply-templates select="node()"/>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|