assert (dynEnv != null);
// parse query
XQueryParser parser = new XQueryParser(reader);
StaticContext sc = dynEnv.getStaticContext();
parser.setStaticContext(sc);
Module mod = parser.parse();
// static analysis
mod.staticAnalysis(sc);
// evaluate
XQExpression body = mod.getExpression();
Sequence res = body.eval(ValueSequence.EMPTY_SEQUENCE, dynEnv);
return res;
}