I have a simply XML:
<RequestResponse>
<RequestResult>
<FinalResponse>
<Message>Request inserted successfully.</Message>
<Response>true</Response>
</FinalResponse>
</RequestResult>
</RequestResponse>
I use a XSLT to include FinalResponse into a CDATA (String):
<RequestResponse>
<RequestResult>
<![CDATA[<FinalResponse>
<Message>Request inserted successfully.</Message>
<Response>true</Response>
</FinalResponse>]]>
</RequestResult>
</RequestResponse>
Then I use another XSLT more to convert the XML to SOAP with the namespace I want:
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<RequestResponse>
<RequestResult>
<![CDATA[
<FinalResponse>
<Message>Request inserted successfully.</Message>
<Response>true</Response>
</FinalResponse>
]]>
</RequestResult>
</RequestResponse>
</s:Body>
</s:Envelope>
I need to add this tag/namespace: xmlns="http://tempuri.org/" to the RequestResponse node, but only that node like this:
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<RequestResponse xmlns="http://tempuri.org/">
<RequestResult>
<![CDATA[
<FinalResponse>
<Message>Request inserted successfully.</Message>
<Response>true</Response>
</FinalResponse>
]]>
</RequestResult>
</RequestResponse>
</s:Body>
</s:Envelope>
How can I add that element only to that node?
RequestResultelement inherits the default namespace declared for its parentRequestResponseelement. You must place both elements in the same namespace, not only the parent.