Count the XML nodes in xpath expression
I’m gonna to extend my blog further and will show you how to retrieve total no of nodes.
1) Let’s open the RestPipeline and drag a Assign activity in the Response pipeline.
2) Open the Assign activity properties, give the variable name as totalCount, open the Assign activity Expression, move to the Namespace tab. Add the name space.
Note: URI: http://xmlns.oracle.com/pcbpel/adapter/db/top/DBReference, belongs to the DB adapter XSD. This must be added. You can get the same from DB adapter XSD or business service output.
3) Move to the Variables tab and add the expression: xs:int(count($serviceOutput/db:Employees))
a) serviceOutput: This is the variable that was used in the service callout activity to assign the business service output.
b) db:Employees: This is the node that we want to count.
4) Run the pipeline directly and see the output of totalCount variable