I need to change namespaces of SOAP document. Only the namespaces should be change and all other SOAP left what it is.
Here is my SOAP document:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tar="namespace1"
xmlns:tar1="namespace1">
<soapenv:Header/>
<soapenv:Body>
<tar:RegisterUser>
<tar1:Source>?</tar1:Source>
<tar1:Profile>
<tar1:EmailAddress>?</tar1:EmailAddress>
<tar1:NewEmailAddress>?</tar1:NewEmailAddress>
<tar1:GivenName>?</tar1:GivenName>
</tar1:Profile>
</tar:RegisterUser>
</soapenv:Body>
</soapenv:Envelope>
I want the namespace1
to be change for e.g. in namespace2.
Here is my transformation:
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:old="namespace1"
xmlns:new="namespace2">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="old:*">
<xsl:element name="{local-name()}" xmlns="namespace2" >
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
But when I run it it gives me this output:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tar="namespace1" xmlns:tar1="namespace1">
<soapenv:Header/>
<soapenv:Body>
<RegisterUser>
<Source>?</Source>
<Profile>
<EmailAddress>?</EmailAddress>
<NewEmailAddress>?</NewEmailAddress>
<GivenName>?</GivenName>
</Profile>
</RegisterUser>
</soapenv:Body>
</soapenv:Envelope>
I want only namespace to be change. Not prefixes removed from elements. Maybe someone know where is the problem?