Question & Answer
Question
How to remove the namespace and its prefixes in an XML file using XSLT?
Answer
The following XSLT should be used to strip all the namespace and prefixes in the XML document.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/|comment()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<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:stylesheet>
Historical Number
00000158
Product Synonym
Cast Iron Solution
Cast Iron Operating System
Cast Iron Studio
Was this topic helpful?
Document Information
More support for:
IBM Cast Iron Cloud Integration
Software version:
6.1.0.3, 6.1, 5.0.1.7
Operating system(s):
Windows
Document number:
410643
Modified date:
15 June 2018
UID
swg21452975