[xquery-talk] comparing consequtive elements

Chris Ness cness at soundmotion.co.uk
Fri Jun 2 13:53:21 PDT 2006


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
>>    
>>
>
>
>
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xquery.com/pipermail/talk/attachments/20060602/69b4fad9/attachment.htm


More information about the talk mailing list