In my orchestration I have a xml variable like this:
I use a setValue/decisionPoint combination to iterate through it, first of all I get the routes count with an xPath and start a counter like this:
/process_data/@routesCount = count(/process_data/xmlVar/routes/route)
/process_data/@routesCounter = /process_data/@routesCounter +1
Then I go on to iterate inside that routes/route node using the same method, I want to get the number of 'foo' elements inside route so I have the setValue:
/process_data/@fooCount = count(/process_data/xmlVar/routes/route[/process_data/@routesCounter]/elements/foo)
but I'm getting the total foo count of the entire document (10) instead of 3
I have done recording/playback several times, the @routesCount and @routesCounter index work fine, but I always get 10 for the @fooCount.
When I execute the XPath query:
in Oxygen I get 3 for a result
Somehow LC is not taking the @routesCounter index into consideration when querying the XML
Have you tried to do this double-iteration stuff?
Thanks for your help
As the matter of fact, I have checked out some similar process I have working, and noticed I was missing a number() function.
The indices must be cast to number before being able to iterate, so:
/process_data/@fooCount = count(/process_data/xmlVar/routes/route[number(/process_data/@routesCounter)]/elements/fo o)
Anyway, the intermediate XML var tip was useful too.