I am facing some issue in my xslt transformation. I want to remove extra namespace added in my result during xslt transformation.
here is the my source xml:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<Root xmlns="http://www.abc123.org/xyz/ase" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<CreationDateTime>2019-05-08T06:34:04.2235068-05:0011</CreationDateTime>
<BODID>51c336d1-8e6a-46211c-973f-a9ca6c8a33ce</BODID>
<ReferenceID>9078111e00-9b82-46b3-a419-be80521b2a94</ReferenceID>
<Success>false</Success>
</Header>
<Data>
<ErrorMessage>
<ID/>
<Type>Invalid Data</Type>
<Description>InvalidData</Description>
</ErrorMessage>
</Data>
</Root>
</soapenv:Body>
</soapenv:Envelope>
here is my xslt code:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" exclude-result-prefixes="soapenv">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="soapenv:*">
<xsl:apply-templates select="@* | node()" />
</xsl:template>
</xsl:stylesheet>
Expected Output:
<Root xmlns="http://www.abc123.org/xyz/ase"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<CreationDateTime>2019-05-08T06:34:04.2235068-05:0011</CreationDateTime>
<BODID>51c336d1-8e6a-46211c-973f-a9ca6c8a33ce</BODID>
<ReferenceID>9078111e00-9b82-46b3-a419-be80521b2a94</ReferenceID>
<Success>false</Success>
</Header>
<Data>
<ErrorMessage>
<ID/>
<Type>Invalid Data</Type>
<Description>InvalidData</Description>
</ErrorMessage>
</Data>
</Root>
Actual Output:
<Root xmlns="http://www.abc123.org/xyz/ase"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<Header>
<CreationDateTime>2019-05-08T06:34:04.2235068-05:0011</CreationDateTime>
<BODID>51c336d1-8e6a-46211c-973f-a9ca6c8a33ce</BODID>
<ReferenceID>9078111e00-9b82-46b3-a419-be80521b2a94</ReferenceID>
<Success>false</Success>
</Header>
<Data>
<ErrorMessage>
<ID/>
<Type>Invalid Data</Type>
<Description>InvalidData</Description>
</ErrorMessage>
</Data>
</Root>
Here, I am getting extra namespace "xmlns:soapenv" that I need to remove.
Kindly suggest correction.
Thanks