Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to add namespaces via XSLT? Please help!

1058877Dec 6 2013 — edited Dec 6 2013

Hi experts,

My input XML is :

<?xml version="1.0" encoding="UTF-8"?>

<getResponse xmlns="https://test.com">

<ReturnMessage>

<recordCount/>

<returnCode/>

<returnMessage/>

</ReturnMessage>

</getResponse>

Here if you see that none of the nodes have any namespace prefix nor the child nodes.

What I want is, prefix and namespaces for all nodes. Also the prefix and namespace for root and immediate child node is same ns0 while for other nodes it is ns1.

ns0 and ns1 namespaces are different.

 

How can I get this in XSLT?

Is there any simple way? Please help!

Desired output XML:

<?xml version="1.0" encoding="UTF-8"?>
<ns0:getResponse xmlns:ns0="https://test.com">
<ns0:ReturnMessage>
<ns1:recordCount xmlns:ns1="https://test.com/schema/"/>
<ns1:returnCode xmlns:ns1="https://test.com/schema/"/>
<ns1:returnMessage xmlns:ns1="https://test.com/schema/"/>
</ns0:ReturnMessage>
</ns0:getResponse>

Thanks
Gopal


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 3 2014
Added on Dec 6 2013
1 comment
1,593 views