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

Paul Veuve vep at cdisa.ch
Wed Jun 28 21:27:58 PDT 2006


Thank's for your help.


Paul Veuve
vep at cdisa.ch

CDI CONSEILS ET DEVELOPPEMENTS
INDUSTRIELS SA
Chemin de la Justice 15
CH-2000 NEUCHATEL

http://www.cdisa.ch

Phone  (+41 32) 733 31 31 or (+41 78) 600 31 31

Fax (+41 32) 733 31 32


-----Message d'origine-----
De : David Carlisle [mailto:davidc at nag.co.uk] 
Envoyé : mercredi, 28. juin 2006 17:10
À : vep at cdisa.ch
Cc : talk at xquery.com
Objet : Re: [xquery-talk] Wrong sort and distainct-values result in
nestedqueryes - parameters passing problems


 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
________________________________________________________________________

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.5/377 - Release Date: 27.06.2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.5/377 - Release Date: 27.06.2006
 




More information about the talk mailing list