[xquery-talk] how can I compare each node with it's prior node

Andrew Welch andrew.j.welch at gmail.com
Fri May 6 00:15:21 PDT 2011


On 6 May 2011 07:40, Kunal Chauhan <mail4ck at gmail.com> wrote:
> Hi,
>
> I have a document like
>
> <comp-abc>
>
> <dept1>
>          <item>abc</item>
>          <price>124</price>
>          <item>xyz</item>
>           <price>56</price>
> </dept1>
>
> <dept2>
>           <item>abc</item>
>           <price>124</price>
>           <item>xyz</item>
>            <price>56</price>
> </dept2>
>
> </comp-abc>
>
> Now I want to chekc whether all price nodes are followed by item only.
> How can I check this ?


price/following-sibling::*[1][self:item]

(your xml suggests item should be followed by price, but your
description asks for the other way around...)


-- 
Andrew Welch
http://andrewjwelch.com



More information about the talk mailing list