Hi,

I was testing code that returned a sorted sequence of nodes, but my test cases 
were failing irratically. It took me some time to figure out the exact cause, 
but it looks like the order of sorted node sets is not maintained properly. I 
think that it should be maintained, and am failing to see a logical reason for 
this behaviour. Contrarely, the order of sorted sequences of atomic values is 
mainted properly.

Anyone observed this behaviour before? Anyone who would like to comment on this 
behaviour? Is there a logical explanation? The declare ordering doesn't seem to 
influence this behaviour. Should it?

Here the code to reproduce the problem. Run it multiple times in CQ to see what 
happens..

        xquery version "1.0";

        declare default function namespace 
"http://www.w3.org/2005/xpath-functions";;

        declare ordering ordered;
        declare default order empty least;
        declare construction preserve;

        let $test := (
          <object object-id="a"/>,
          <object object-id="b"/>,
          <object object-id="c"/>
        )

        return (
          '>>Predictable order<<',

          $test/self::object/@object-id/string(.),

          '>>Unpredictable order<<',

          for $id in $test/self::object/@object-id
          return
                string($id)
        )

Kind regards,
Geert


Drs. G.P.H. Josten
Consultant


http://www.daidalos.nl/
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
http://www.daidalos.nl/
KvK 27164984
De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.



_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to