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!
Input-:
<input>1,2,3</input>
Required Output-:
<ABC> <AB> <result>1</result> </AB> <AB> <result>2</result> </AB> <AB> <result>3</result> </AB> </ABC>
Hi, You should use recursion for that. In fact, a few years ago I already wrote a blog on how to do just this: https://blog.darwin-it.nl/2018/10/recursion-in-xslt.html Hope this helps. Kind regards, Martien
Hi [Martien van den Akker](/ords/forums/user/Martien van den Akker) ,
Thanks for your response. Required output -:
and the output that you mentioned in blog is
<?xml version = '1.0' encoding = 'UTF-8'?> <tns:ApprovalRoute xmlns:tns="http://www.example.org/Approvals/Target" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/Approvals/Target file:/D:/Projects/2018-ODC/XSL-Demo/XSL-Demo/SOA/Schemas/Approvals-Target.xsd"> <tns:Approver>Approver1</tns:Approver> <tns:Approver>Approver2</tns:Approver> <tns:Approver>Approver3</tns:Approver> <tns:Approver>Approver4</tns:Approver> <tns:Approver>Approver5</tns:Approver> </tns:ApprovalRoute>
<?
xml
version
= '1.0'
encoding
= 'UTF-8'?>
<
tns:ApprovalRoute
xmlns:tns="
http://www.example.org/Approvals/Target
"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="
file:/D:/Projects/2018-ODC/XSL-Demo/XSL-Demo/SOA/Schemas/Approvals-Target.xsd">
tns:Approver
>Approver1</
>
>Approver2</
>Approver3</
>Approver4</
>Approver5</
</
Actually I need to create multiple nested nodes to assign values. please provide your input.
Thanks & Regards, Nilesh Jha
Hi Nilesh, Of course you should adapt my xslt to your situation. I'm not going to do that for you. As a guideline, I marked the parts you should change: You should change the namespaces (tns and ns0 and maybe add others). Replace occurences of tns:ApprovalRoute with ABC. And tns:Approver with AB. You could of course nest these with multiple elements. But this is based on the information you provide me. Other information to be added to the structure can be provided with additional parameters. You can even use the values of $firstItem or $restDelimitedStr in the otherwise branch, to lookup information from the source message. Kind regards, Martien