This discussion is archived
3 Replies Latest reply: Oct 15, 2013 4:41 AM by user12559818 RSS

Xpath in BPEL: How to find the "count" of multiple nodes

601082 Newbie
Currently Being Moderated
Hi Guys
I am having a problem(syntax error) in XPath Expression creation.

Using the Batch processing in BPEL I am trying to find out the number of occurences of an XML element (node).

I have done this successfully previously using:

count(bpws:getVariableData('Receive_Read_InputVariable','ProductDataeXchangePackage','/ns5:ProductDataeXchangePackage/ns5:Items/ns5:Item'))

But when i am using the following:

count(bpws:getVariableData('inputVariable','payload','/ns1:ProductDataeXchangePackage/ns1:Items/ns1:Item[bpws:getVariableData('CurrentItem')]/ns1:BillOfMaterial/ns1:BillOfMaterialItem'))

Here there are multiple occurences of the "Item" tag within which the BillOfMaterial/*BillOfMaterialItem* occurs.
'CurrentItem' is a integer type variable.

It is throwing an Error saying Expected ) --which obviously doesnt solves the problem.

The best part is when i am hard coding a numerical value like:

count(bpws:getVariableData('inputVariable','payload','/ns1:ProductDataeXchangePackage/ns1:Items/ns1:Item[2]/ns1:BillOfMaterial/ns1:BillOfMaterialItem'))

it is Working perfectly fine--showing the number of "BillOfMaterialItem" occurences under the 2nd (or nth for that matter, where n is the numerical) "Item" node.

Please help
--thanks
debashis

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points