How to remove namespace attribute from XML root element using XSLT?

There are occasions when we need to remove the namespace attribute from the XML root element before sending it to the receiving application. This can be done using XSL transform as shown below. If you are already doing an XSL transform just include the following code in that XSLT.

<xsl:stylesheet version="1.0" xmlns:xsl=""><xsl:output method="xml" version="1.0" encoding="UTF-8" />
	<xsl:template match="*">
		<xsl:element name="{local-name()}">
			<xsl:apply-templates select="@* | node()"/>


There are no comments yet...Kick things off by filling out the form below.

Leave a Comment