[xquery-talk] Wrong sort and distainct-values result in nested queryes - parameters passing problems

David Carlisle davidc at nag.co.uk
Wed Jun 28 17:09:40 PDT 2006


 you have

  for $Flat in doc("/db/Flat.xml")/x/y

so $Flat is (at each iteration) a single y element node.
      let $Ordered      := local:Order($Flat)
so local:order is just being passed a single y node so the sorting is a
no-op as it is a sequence of length 1.

so this just returns $Ordered which is always the same as $Flat
      return $Ordered

and the end result is that the original sequence is generated.


You want to sort the sequence as a whole, not each item in the sequence
so

local:Order(doc("/db/Flat.xml")/x/y)

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