#398 text{()} may return ""

v8.5
closed
nobody
5
2012-10-08
2005-08-19
Michael Kay
No

In XQuery, the text node constructor text{()} applied
to an empty sequence should return an empty sequence.
In some circumstances [specifically, when it is
evaluated in "push" mode]
, it returns an empty string.

Source fix: change the method processLeavingTail at
line 160 of net.sf.saxon.instruct.ValueOf to read:

public TailCall processLeavingTail(XPathContext
context) throws XPathException {
SequenceReceiver out = context.getReceiver();
Item item = select.evaluateItem(context);
if (item != null) {
out.characters(item.getStringValueCS(),
locationId, options);
}
return null;
}

Michael Kay

Discussion