I am trying to remove namespaces for an element coming in my output after going through transformation using XSLT 1.0.
What I had:
I am having a input XML, in which one elements schema got changed. So as per the new schema, I renamed it. Now for that particular element, I am getting an extra namespace in the output XML.
Somehow, the XSL I am using is removing all the namespaces in xml like soap envelope, soap body etc, not only for the modified element.
Why only the changed element is giving namespace error. Any suggestions on this are welcome. How to remove the namespace coming after the element renamed.
="1.0"="UTF-8"
<soapenv:Envelope>
<xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<MyRequest>
<Details>
<ID>123</ID>
<Name>
<FirstName>John</FirstName>
</Name>
</Details>
</MyRequest>
</soapenv:Body>
</soapenv:Envelope>
XSL used
="1.0"="UTF-8"
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlsns:ns = "www.newschema"
exclude-element-prefix = "xsl ns">
<xsl:template match="Details" ns=www.Newschema>
<PartyDetails ns=www.Newschema>
<xsl:apply-templates select="node()"/>
</PartyDetails
</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:template match="comment() | processing-instruction()">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>
Output I want.
="1.0"="UTF-8"
<soapenv:Envelope(xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/")>
<soapenv:Body>
<MyRequest>
<PartyDetails>
<ID>123</ID>
<Name>
<FirstName>John</FirstName>
</Name>
</PartyDetails>
</MyRequest>
</soapenv:Body>
</soapenv:Envelope>