Created
February 8, 2011 15:09
-
-
Save mwfrost/816554 to your computer and use it in GitHub Desktop.
Use XPath 2.0 syntax to list all the nodes in an XML file
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
| <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
| <xsl:template match="text()"/> | |
| <xsl:template match="*|@*"> | |
| <xsl:value-of select=" | |
| string-join( | |
| distinct-values( | |
| (//*|//@*) | |
| /string-join( | |
| (ancestor::node()/name(), | |
| if (self::attribute()) | |
| then concat('@',name()) | |
| else name()), | |
| '/')), | |
| '
')"/> | |
| </xsl:template> | |
| </xsl:stylesheet> | |
| <!-- source: http://stackoverflow.com/questions/4051987/list-every-node-in-an-xml-file --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment