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

View: New views
1 Messages — Rating Filter:   Alert me  

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

by Paul Veuve :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

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
vep@...

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

LightInTheBox - Buy quality products at wholesale price!