[xquery-talk] comparing consequtive elements
Philippe Michiels
philippe.michiels at gmail.com
Fri Jun 2 14:40:51 PDT 2006
Assuming that you meant sec 3 to contain:
<a attribute="3"/>
<a attribute="1"/>
Here's the expression ($x containing the fragment below)
for $s in $x/section
where
$s/a[@attribute="3" and following-sibling::a[1]/@attribute="1"]
return data($s/@n)
Regards,
Ph
> <eg>
> <section n="1">
> <a attribute="1"/>
> <a attribute="2"/>
> <section/>
> <section n="2">
> <a attribute="3"/>
> <a attribute="1"/>
> <section/>
> <section n="3">
> <a attribute="3"/>
> <a attribute="3"/>
> <section/>
> <section n="4">
> <a attribute="1"/>
> <a attribute="1"/>
> <section/>
> </eg>
>
> say I'm looking for
>
> <a attribute="3"/>
> <a attribute="1"/>
>
> I need to look accross the <section> divisions too and return the
> section number the transition starts in. so that snippet will produce 2
> and 3.
>
> any replies will be completely analysed! great thanks and no further
> questions!
>
> need a good book for XQuery/Xpath. any recommendations?
>
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk
More information about the talk
mailing list