Hello Ian Harrigan,
This is a BUG. You can overcome it using the follows:
elment[number(string($index))]
The reason:
"The bug is in XPath 1.0 (and somewhat in XPath 2.0 when you don't have a
typed engine). Variables aren't typed even though in some cases some types
are expected. In most cases the engine coerces but coercion doesn't always
work so you often have to use conversion function like number() to be safe."
--by Matthieu Riou.
For more details, see the discussion before:
http://mail-archives.apache.org/mod_mbox/ode-user/200901.mbox/%[email protected]%3e
Regards,
Wenfeng
=======On 2009-06-22 at 06:58:11 Ian Harrigan wrote: =======
>Hi All,
>
>Im wondering if someone might be able to let me know how i can extract a
>numbered node based on a loop of some kind. Essentially im wanting to so
>something like:
>
>request.payload/ns:items/ns:item[$counter]/@someValue
>
>The $counter variable will get incremented in the loop, however, i get an
>XPath compilation error, im assuming this is possible but maybe im just
>attempting to perform it in the wrong way
>
>Any help/pointers would be great...
>
>Thanks
>Ian Harrigan
= = = = = = = = = = = = = = = = = = = =
ZHAO Wenfeng (赵文峰)
Ph.D. Candidate
http://www.bupt.edu.cn