document() doesn't remove duplicates
The SaxonJS implementation of the document() function, if given a list of URIs that includes duplicates, doesn't eliminate duplicate document nodes from the result, nor does it sort the result into document order.
As a result, test document-0401 is failing in SaxonJS with the XJ compiler but succeeds with the XX compiler. The failure is because it doesn't eliminate duplicate nodes. The XX compiler produces a SEF file containing a docOrder instruction (actually two, one of them redundant) while the XJ compiler output has no such instruction.
With the XX compiler the test is succeeding by accident, because the result of
document(A)//body has duplicates eliminated even though the result of
document(A) doesn't. But we shouldn't be relying on the "/" operator to do the deduplication; it should be done even for a free-standing call on document().
Please register to edit this issue