IBM Support

How to remove the namespace and its prefixes in an XML file using XSLT?

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>

[{"Product":{"code":"SSGR73","label":"IBM Cast Iron Cloud Integration"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Not Applicable","Platform":[{"code":"PF033","label":"Windows"}],"Version":"6.1.0.3;6.1;5.0.1.7","Edition":"Virtual;Physical;Cloud","Line of Business":{"code":"LOB45","label":"Automation"}}]

Historical Number

00000158

Product Synonym

Cast Iron Solution
Cast Iron Operating System
Cast Iron Studio

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

Manage My Notification Subscriptions