Re: ### Outputting the "full path". Is this possible ?? ###

Subject: Re: ### Outputting the "full path". Is this possible ?? ###
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Fri, 26 May 2000 19:23:10 +0100

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


Current Thread