Using position function for accessing particular node when using While Activity in SOA 11.1.1.5
        Posted  
        
            by AJ
        on Oracle Blogs
        
        See other posts from Oracle Blogs
        
            or by AJ
        
        
        
        Published on Thu, 5 Apr 2012 12:04:35 -0500
        Indexed on 
            2012/04/05
            23:36 UTC
        
        
        Read the original article
        Hit count: 367
        
/Oracle
Hi
If you are using while activity in SOA Suite 11.1.1.5 and within loop you have a requirement to access repeating node of XML. You might need to use below XPATH expression for accessing the node.
Here is the XML that I am using for this example
<?xml version='1.0' encoding='UTF-8'?>
David 
DemoJob 
1 
2012-04-15 
40000 
0 
10 
Steve 
TestJob 
1 
2012-04-15 
40000 
0 
10 
Here you can notice that Emp node is repeating i.e. EmpCollection node will contain multiple employees.
Now in loop one of assign activity you need to access a particular node for e.g. For first time loop runs you want to access first node and second time second node and so on.
You need to make use of postion() function like
bpws:getVariableData('Receive1_Read_InputVariable','body','/ns4:EmpCollection/ns4:Emp[position()=$loopCounter]/ns4:job')
Please Note: Here loopCounter is a variable that we have created of type xsd:int and prior to loop we have initialized a value of 1.
Loop will run depending on the number of Emp nodes present at runtime. For that in while Activity you can use below XPATH expression
ora:countNodes('Receive1_Read_InputVariable','body','/ns4:EmpCollection/ns4:Emp')>=bpws:getVariableData('loopCounter')
Do let me know in case of any issues or concern.
Cheers 
AJ
© Oracle Blogs or respective owner