Skip to content

Instantly share code, notes, and snippets.

@mwfrost
Created February 9, 2011 22:01
Show Gist options
  • Select an option

  • Save mwfrost/819400 to your computer and use it in GitHub Desktop.

Select an option

Save mwfrost/819400 to your computer and use it in GitHub Desktop.
Minimal parser, only returns name()
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<xsl:template match="*|@*">
<xsl:value-of select="
string-join(
distinct-values(
(//*|//@*)
/string-join(
(ancestor::node()/name(),
if (self::attribute())
then concat('@',name())
else name()),
'/')),
'&#xA;')
"/>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment