Search code examples
xmlxsltxpathsoabpel

Oracle SOA-BPEL accessing nested XML elements for variable assignment


I have a use case related to XPath query issue regarding nested XML data access. Kindly check the below screenshot:

enter image description here

Additionally, below is the schema part of TargetEntityData enter image description here

Now scenario is that, I have to assign Value From DataAttribute to right hand side element Approver_DiscomID based on the corresponding Name attribute in left hand side i.e.

if Name=usr_discom then Approver_DiscomID=Value (from screenshot schema it would be like if Name='usr_discom' then Approver_DiscomID='Discom3')

if Name=usr_division then Approver_DivisionID=Value (from screenshot schema it would be like if Name='usr_division' then Approver_DivisionID='PVVNL0920939') and so on .

Any idea how to do manipulation in xpath.

Thanks Kumar


Solution

  • Solution found!

    Need below XPath Expression:

    bpws:getVariableData('requestDetails','RequestData','/ns18:RequestData/ns18:TargetEntityData/ns18:TargetEntity/ns18:DataAttribute[@Name="district"]/@Value')
    

    Here @Name refers to TargetEntityData => TargetEntity => DataAtribute => Name

    Now there is /@Value is appended to to it. So it will return the Value of attribute Name district & so on.