this.outputProperties = properties;
this.collection = col;
if(val.isEmpty())
{return;}
if(Type.subTypeOf(val.getItemType(), Type.NODE) && sortExpr != null) {
SortedNodeSet sorted = new SortedNodeSet(brokerPool, user, sortExpr, collection.getAccessContext());
try {
sorted.addAll(val);
} catch (final XPathException e) {
throw new XMLDBException(ErrorCodes.INVALID_RESOURCE,
e.getMessage(), e);
}
val = sorted;