[xquery-talk] Wrong sort and distainct-values result in nested
queryes - parameters passing problems
Paul Veuve
vep at cdisa.ch
Wed Jun 28 17:54:08 PDT 2006
Hello,
I have a problem with nested queryes, sort don't work in a function.
Something is wrong in the function call or parameters passing
Query 1 display a successful sort by @REF without procedure
Query 2 display a faulty sort in the procedure local:Order()
What is what is wrong in the sort procedure or procedure call ?
I receive the same result with xmlspy or stylus studio. Something is wrong
in the code
Thanks for your help.
Flat.xml CONTENT -----------------------
----------------------------------------
<x>
<y QTY="1" REF="_T111"/>
<y QTY="2" REF="_T1121"/>
<y QTY="6" REF="_T13"/>
<y QTY="6" REF="_T113"/>
<y QTY="3" REF="_T13"/>
</x>
This Query 1 display a successful sort by @REF without procedure
for $Flat in doc("/db/Flat.xml")/x/y
for $Ordered in $Flat
order by $Ordered/@REF
return $Ordered
QUERY 1 RESULT ----------------------- OK
-----------------------------------------
<y QTY="1" REF="_T111"/>
<y QTY="2" REF="_T1121"/>
<y QTY="6" REF="_T113"/>
<y QTY="6" REF="_T13"/>
<y QTY="3" REF="_T13"/>
Query 2 display a faulty sort in the procedure local:Order()
------------------------------------------------------------
declare function local:Order($CompIn as node()*) as node()*
{
for $x in $CompIn
order by $x/@REF
return $x
};
for $Flat in doc("/db/Flat.xml")/x/y
let $Ordered := local:Order($Flat)
return $Ordered
QUERY 2 RESULT ----------------------- SHOULD BY SORTED BY BREF BUT IS NOT
--------------------------------------------------------------------------
<y QTY="1" REF="_T111"/>
<y QTY="2" REF="_T1121"/>
<y QTY="6" REF="_T13"/>
<y QTY="6" REF="_T113"/>
<y QTY="3" REF="_T13"/>
Paul Veuve
<mailto:vep at cdisa.ch> 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
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.5/376 - Release Date: 26.06.2006
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xquery.com/pipermail/talk/attachments/20060628/1bce6347/attachment-0001.htm
More information about the talk
mailing list