[xml-dev] Re: How to get XPath in a XSLT shylesheet

From
Stephen Green <>
To
Date
2007-01-09T15:10:37Z
ID
<>
Thread
[xml-dev] Re: How to get XPath in a XSLT shylesheet
I use something like:

 for an attribute

<xsl:for-each select="ancestor-or-self::*">
<xsl:if test="local-name()=name()">/default:</xsl:if>
<xsl:if test="not(local-name()=name())">/</xsl:if>
<xsl:value-of select="name()"/>[<xsl:number/>]</xsl:for-each>/@<xsl:value-of select="name()"/></xsl:variable>
		
and for an element

<xsl:for-each select="ancestor-or-self::*">
<xsl:if test="local-name()=name()">/default:</xsl:if>
<xsl:if test="not(local-name()=name())">/</xsl:if>
<xsl:value-of select="name()"/>[<xsl:number/>]</xsl:for-each>

All the best

Stephen Green


>>> "Dimitre Novatchev" <> 09/01/07 14:26:49 >>>
This snippet is 5 years old:

     http://www.topxml.com/code/default.asp?p=3&id=v20010323001030 

Cheers,
Dimitre Novatchev



"Long JingJun" <> wrote in message 
news:...
Hi there,

Is there a way to get the full XPath of current node as a String in an XSLT 
stylesheet?

Thanks,

Long


__________________________________________________
 Ï¿ì×¢²áÑÅ»¢³* óÈÝÁ¿Ãâ·ÑÓÊÏä?
http://cn.mail.yahoo.com 

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/ 
Or unsubscribe:  
subscribe:  
List archive: http://lists.xml.org/archives/xml-dev/ 
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php 





_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/ 
Or unsubscribe:  
subscribe:  
List archive: http://lists.xml.org/archives/xml-dev/ 
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php