This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: ### Outputting the "full path". Is this possible ?? ###
David Carlisle wrote:
>
> but what if an element contains a sequence of elements, such as
>
...
> <xsl:for-each select="(ancestor-or-self::*)"
> >/*[<xsl:value-of select="1+count(preceding-sibling::*)"/>]</xsl:for-each>
>
And a version for attributes -
<!-- paths from elements -->
<xsl:template name="elementPath">
<xsl:for-each select="(ancestor-or-self::*)"
>/*[<xsl:value-of
select="1+count(preceding-sibling::*)"/>]</xsl:for-each>
</xsl:template>
<!-- paths from attributes -->
<xsl:template name="attributePath">
<xsl:for-each select="parent::*">
<xsl:call-template name="elementPath" />
</xsl:for-each>
<xsl:text>/@</xsl:text>
<xsl:value-of select="name(.)"/>
</xsl:template>
Francis.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list