Get current nodes xpath
问题 I need to get the xpath of current node for which i have written an xsl function <func:function name="fn:getXpath"> <xsl:variable name="xpath"> <xsl:for-each select="ancestor-or-self::*"> <xsl:value-of select="concat($xpath, name())" /> <xsl:if test="not(position()=last())"> <xsl:value-of select="concat('/', $xpath)" /> </xsl:if> </xsl:for-each> </xsl:variable> <func:result select="$xpath" /> </func:function> But when I run this, I'm getting the following error file:///D:/test.xsl; Line #165;