Project

Profile

Help

orphan elements and inode dentity

Added by Anonymous over 19 years ago

Legacy ID: #2972239 Legacy Poster: marcvc (marcvc)

Michael, an issue with orphan elements. I believe this is new in Saxon 8.2. Consider the following query: let $A := <A/> let $B := <B/> let $seq1 := ($A, $B) let $seq2 := ($A, $B) return $seq1 union $seq2 It returns as expected 2 elements Consider now the following. let $A := <A/> let $B := <B/> let $seq1 := ($A, $B) let $seq2 := ($A, $B) return ($seq1 , $seq2, $seq1 union $seq2) It returns 8 elements, where I would only expect 6. Thanks, Marc


Replies (1)

RE: orphan elements and inode dentity - Added by Anonymous over 19 years ago

Legacy ID: #2974679 Legacy Poster: Michael Kay (mhkay)

It's hard to know how to describe this bug in a way that anyone would recognize the symptoms, so I won't raise a bug entry for it. The fix is to change the process() method of SingletonNode.java to read: public void process(XPathContext context) throws XPathException { if (node != null) { context.getReceiver().append(node, 0, NodeInfo.ALL_NAMESPACES); } } This method was incorrectly making a copy of the node, meaning that two nodes with different identity were created. It would be correct to make a copy of the node when a variable such as $A appears in a sequence that's constructing the content of an element, but not here. The job of deciding whether to make a copy belongs to the Receiver of the node, not to the expression that delivers the node. (I haven't yet regression tested the patch, but it fixes this problem and looks sound.) Michael Kay

    (1-1/1)

    Please register to reply