Created
July 23, 2013 13:37
-
-
Save alicraigmile/6062392 to your computer and use it in GitHub Desktop.
XSL to get all XPaths in a document
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:template match="/"> | |
<xsl:apply-templates /> | |
</xsl:template> | |
<xsl:template match="//*[not(*)]"> | |
<xsl:for-each select="ancestor-or-self::*"> | |
<xsl:text>/</xsl:text> | |
<xsl:value-of select="local-name()"/> | |
</xsl:for-each> | |
<xsl:text>|</xsl:text> | |
</xsl:template> | |
<xsl:template match="text()" /> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment