}
public XQPreparedExpression prepareExpression(InputStream xquery, XQStaticContext properties) throws XQException {
checkNotClosed();
try {
StaticQueryContext sqc = ((SaxonXQStaticContext)properties).getSaxonStaticQueryContext();
XQueryExpression exp = sqc.compileQuery(xquery, null);
DynamicQueryContext dqc = new DynamicQueryContext(config);
return new SaxonXQPreparedExpression(this, exp, dqc);
} catch (XPathException e) {
throw newXQException(e);
} catch (IOException e) {