Skip to Main Content

Database Software

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 do i split and assign values in nested nodes using Assign/XSLT in BPEL SOA?

User_JU665Dec 8 2020

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>

Comments

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

User_JU665

Hi [Martien van den Akker](/ords/forums/user/Martien van den Akker) ,

Thanks for your response.
Required output -:

<ABC>
  <AB>
    <result>1</result>
  </AB>
  <AB>
   <result>2</result>
  </AB>
<AB>
   <result>3</result>
  </AB>
</ABC>

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>

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:
image.pngYou 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

1 - 3

Post Details

Added on Dec 8 2020
3 comments
125 views