for (final SequenceIterator iter = callbackResult.iterate(); iter.hasNext(); ) {
final Item next = iter.nextItem();
if (Type.subTypeOf(next.getType(), Type.NODE)) {
nodeNr = builder.getDocument().getLastNode();
try {
next.copyTo(context.getBroker(), receiver);
result.add(builder.getDocument().getNode(++nodeNr));
lastNodeNr = nodeNr;
} catch (final SAXException e) {
throw new XPathException(this, "Internal error while copying nodes: " + e.getMessage(), e);
}