|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Retrieving Full XPATH expression
This is one way of doing it:
<!--
Gets the full xpath of the current node.
For first index, [1] is not outputted
-->
<xsl:template match="*" mode="fullXPath" >
<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="generate-id(.)=$id and position() != 1">
<xsl:text>[</xsl:text>
<xsl:value-of
select="format-number(position(),'0')"/>
<xsl:text>]</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
<xsl:if test="not(self::*)">
<xsl:value-of select="concat('/@',name())" />
</xsl:if>
</xsl:template>From: "john smith" <john_smith73@xxxxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Retrieving Full XPATH expression Date: Fri, 10 Aug 2001 18:17:23 +0000 _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp 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








