Subject: Re: How to resolve the absolute location of a node
From: "Clark C. Evans" <clark.evans@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 18 Oct 1999 00:40:47 -0400 (EDT)
|
<xsl:template name="resolver" >
<xsl:for-each select="ancestor-or-self::*">
<xsl:variable name="id" select="generate-id(.)" />
<xsl:variable name="name" select="name()" />
<xsl:value-of select="concat('/',name())"/>
<xsl:for-each select="../*[name()=$name]" >
<xsl:if test="last()>1">
<xsl:if test="generate-id(.)=$id">
<xsl:text>[</xsl:text>
<xsl:value-of
select="format-number(position(),substring('000000',1,
string-length(string(last()))))"/>
<xsl:text>]</xsl:text>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
<xsl:if test="not(self::*)">
<xsl:value-of select="concat('/@',name())" />
</xsl:if>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|