[xquery-talk] distance between elements and hierarchical order

David Carlisle davidc at nag.co.uk
Fri Dec 9 13:07:02 PST 2005

> I build a sequences with their QName 

why sequences of names rather than the elements themselves?
especially if you then compare with eq as that means you can't tell one
element from another. It only works in the example you gave as all your
element names were distinct. If your doc had nested elements with teh
same name, and you wanted to compare
doc("test.xml")/A/A[2]/A/A[3] and doc("test.xml")/A/A[5]/A[2]/A[1] then
your sequences will each be a sequence of "A" with no indication of
which element it is naming, and every item in the sequnce will compare
true with eq against every other item, so  
where $x-name eq $y-names[$x-pos]
isn't going to test anything as it will always be true().

The code I posted should work for this example as it doesn't require the
element names to be distinct.


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:

More information about the talk mailing list