Write Path
Description
Output the xpath as a string for an xml node. I use this for troubleshooting.
XSLT
View Raw
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template name="write-path"> <xsl:param name="path"/> <xsl:param name="output"/> <xsl:choose> <xsl:when test="$path/parent::node()"> <xsl:call-template name="write-path"> <xsl:with-param name="output"> <xsl:choose> <xsl:when test="$output"> <xsl:value-of select="concat(local-name($path), '/', $output)"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="local-name($path)"/> </xsl:otherwise> </xsl:choose> </xsl:with-param> <xsl:with-param name="path" select="$path/parent::node()"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat('/',$output)"/> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>