[xquery-talk] comparing consequtive elements

Philippe Michiels philippe.michiels at gmail.com
Fri Jun 2 15:11:38 PDT 2006


I'm sorry. I missed that. David's answer is correct in that case.

-Ph

On Fri, 2006-06-02 at 12:53 +0100, Chris Ness wrote:
> no Philippe I need to find the 3/1 transition thats crosses the
> section divide
> 
>         <a attribute="3"/>
>     <section/>
>     <section n="4">
>         <a attribute="1"/>
> 
> chris
> 
> 
> Philippe Michiels wrote: 
> > 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
> > >     
> > 
> > 
> > 
> >   
> 
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk
-- 
Philippe Michiels (PhD Student)
Advanced Database Research and Modeling
University of Antwerp
t: +32 3 265 38 80
w: http://www.adrem.ua.ac.be/~michiels



More information about the talk mailing list