How to remove namespace attribute from XML root element using XSLT?
Programming February 25th, 2008There 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="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" version="1.0" encoding="UTF-8" />
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Related posts:
June 24th, 2008 at 8:58 am
HI,
this is working butit also removes attributes in the XML. How can be fixed?
Thx
salvo
February 6th, 2009 at 12:45 pm
Devang has left out the following template which looks after the attributes.
February 6th, 2009 at 12:46 pm
Doh the website ate the template I provided
2nd try
April 22nd, 2009 at 2:15 pm
I wondered if you could set up some system where when your publish a new article, i get emailed to alert me?