}
public Expression compile(Executable exec) throws XPathException {
SortKeyDefinition[] sortKeys = makeSortKeys();
if (select != null) {
return new SortExpression(select, sortKeys);
} else {
Expression body = compileSequenceConstructor(exec, iterateAxis(Axis.CHILD), true);
if (body == null) {
body = Literal.makeEmptySequence();
}
try {
return new SortExpression(makeExpressionVisitor().simplify(body), sortKeys);
} catch (XPathException e) {
compileError(e);
return null;
}
}