Skip to content

Instantly share code, notes, and snippets.

@sachin-handiekar
Created September 21, 2011 17:28
Show Gist options
  • Save sachin-handiekar/1232727 to your computer and use it in GitHub Desktop.
Save sachin-handiekar/1232727 to your computer and use it in GitHub Desktop.
Remove namespace from XML using XSLT
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@* | node()" />
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:template>
<xsl:template match="text() | comment() | processing-instruction()">
<xsl:copy />
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment