This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
One section of this query is as follows: for $i in $root//QObject/local:drawDiagram(.) stable order by string($i) return $i The fact that the order by is stable does no good here! The problem lies with the path expression $root//QObject/local:drawDiagram(.) Following the rules in [XQuery] 3.2, the nodes returned from the path expression are sorted into document order and deduplicated. However, all the nodes in this sequence are newly constructed, and thus have an implementation defined order. Whilst it is undesirable for an implementation to return the nodes in an arbitrary permutation, it is allowed by the spec. I cannot see how the spec could be easily changed to allow for this seemingly useful use-case, so I have marked this as a bug against XQTS. The simplest solution I can see is to replace the for expression with a for expression: for $object in $root//QObject for $i in local:drawDiagram($object) stable order by string($i) return $i
I agree with the analysis and the resolution. Also of potential interest is that the test creates a result SVG document that is not well-formed according to xml:id rules; it contains duplicate IDs. The solution appears to be already implemented in latest XQTS CVS state (both .xq and .xqx), except for the (almost) identical static test fn-doc-33-static-cbcl.xq. This patch fixes it, but the .xqx file will need to be re-generated: Index: ./Queries/XQuery/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-33-static-cbcl.xq =================================================================== RCS file: /sources/public/2006/xquery-test-suite/TestSuiteStagingArea/Queries/XQuery/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-33-static-cbcl.xq,v retrieving revision 1.1 diff -u -r1.1 fn-doc-33-static-cbcl.xq --- ./Queries/XQuery/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-33-static-cbcl.xq 13 Mar 2008 12:14:17 -0000 1.1 +++ ./Queries/XQuery/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-33-static-cbcl.xq 6 Jun 2010 11:41:06 -0000 @@ -38,7 +38,8 @@ fill="none" stroke="blue" stroke-width="2"/>, <s:rect x="400" y="100" width="400" height="200" fill="yellow" stroke="navy" stroke-width="10" />, - for $i in $root//QObject/local:drawDiagram(.) + for $object in $root//QObject + for $i local:drawDiagram($object) stable order by string($i) return $i }
I have made the change you propose, and am marking this bug FIXED. Since I was the person that originally posted the bug it is probably wise to let you close it.
Closing.