Hello,
I need to just replace the XML namespace using XSLT. My input XML looks like as follows. I just want to replace "oldNameSpace" with "newNameSpace" and rest of XML want as it is..
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:impl="oldNameSpace" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soapenv:Body>
<impl:requestData
xmlns:impl="oldNameSpace">
<xmlString ChangeDate="2008-12-18T14:47:11.773+01:00"
IdentificationNumber="WDDKJ5GBXAF000229"
OrderNumber="08 295 70821"
ProductionNumber="1700158">
<ServiceTool ExecutionTime="2008-12-18T14:47:11.773+01:00"
UserID="kris" Version="1.1.1" />
</xmlString>
</impl:requestData>
</soapenv:Body>
</soapenv:Envelope>
I tried with following XSL
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:source="oldNameSpace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" >
<xsl:output method="xml" encoding="iso-8859-1" indent="yes" />
<xsl:template match="source:*" >
<xsl:element name="{name(.)}" namespace="newNameSPace">
<xsl:copy >
<xsl:copy-of select="@*" />
</xsl:copy>
<xsl:apply-templates />
</xsl:element>
</xsl:template>
<!-- Just copy any other elements, attributes, etc. -->
<xsl:template match="@*|node()">
<xsl:copy >
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
but it is not giving the desired results...it is giving the following results.
<?xml version="1.0" encoding="iso-8859-1"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:impl="oldNameSpace" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soapenv:Body>
<impl:requestData xmlns:impl="newNameSPace">
<impl:requestData xmlns:impl="oldNameSpace"/>
<xmlString xmlns:impl="oldNameSpace" ChangeDate="2008-12-18T14:47:11.773+01:00" IdentificationNumber="WDDKJ5GBXAF000229" OrderNumber="08 295 70821" ProductionNumber="1700158">
<ServiceTool ExecutionTime="2008-12-18T14:47:11.773+01:00" UserID="kris" Version="1.1.1"/>
</xmlString>
</impl:requestData>
</soapenv:Body>
</soapenv:Envelope>
Anyone can help in this ....
Thanks a lot.
---Krishna