QueryProcessor qp = new QueryProcessor(configuration, staticQueryContext);
XQueryExpression xQueryExpression = qp.compileQuery(query);
//if SAXON worked with JDOM directly we could replace the next with:
///DocumentInfo saxonDocInfo = qp.buildDocument(new DocumentWrapper(_parentDecomposition.getInternalDataDocument(), null));
DocumentInfo saxonDocInfo = qp.buildDocument(new StreamSource(
new StringReader(outputter.outputString(document))));
DynamicQueryContext dynamicQueryContext = new DynamicQueryContext();
dynamicQueryContext.setContextNode(saxonDocInfo);
resultObj = xQueryExpression.evaluateSingle(dynamicQueryContext);
NodeInfo nodeInfo = (NodeInfo) resultObj;
//my code to parse SAXON resulting XML tree and produce a string