ode-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ZHAO Wenfeng" <zhaowenf...@gmail.com>
Subject Re: Question about looping assignments
Date Mon, 22 Jun 2009 00:59:13 GMT
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/%3cfbdc6a970901220853w579ee7a4m19200cef2c22741e@mail.gmail.com%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

Mime
View raw message