|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XPATH : How to get the level of a node (depth) ?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








