W3C home > Mailing lists > Public > www-ql@w3.org > April to June 2006

Wrong sort and distainct-values result in nested queryes - parameters passing problems

From: Paul Veuve <vep@cdisa.ch>
Date: Wed, 28 Jun 2006 16:48:29 +0200
To: <www-ql@w3.org>
Message-ID: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAApjCnyF7N0xG6TgBglxc1jcKAAAAQAAAAFDPWfEkLskCpzeJXt8AmEAEAAAAA@cdisa.ch>
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@cdisa.ch> vep@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
Received on Wednesday, 28 June 2006 14:48:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 22 July 2006 00:10:21 GMT