[xquery-talk] comparing consequtive elements
David Carlisle
davidc at nag.co.uk
Fri Jun 2 13:58:09 PDT 2006
adj.xml (made well formed:-)
<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>
adj.xq
/eg/section[a[@attribute=3 and following::a[1]/@attribute=1]]/number(@n)
$ saxon8q -s adj.xml adj.xq
<?xml version="1.0" encoding="UTF-8"?>2 3
^^^ as requested
David
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
More information about the talk
mailing list