//JDOM code for produce string for reading by SAXON
XMLOutputter outputter = new XMLOutputter();
//SAXON XQuery code
Configuration configuration = new Configuration();
StaticQueryContext staticQueryContext = new StaticQueryContext();
QueryProcessor qp = new QueryProcessor(configuration, staticQueryContext);
XQueryExpression xQueryExpression = qp.compileQuery(query);
//if SAXON worked with JDOM directly (like it claims to) 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(element))));
DynamicQueryContext dynamicQueryContext = new DynamicQueryContext();
dynamicQueryContext.setContextNode(saxonDocInfo);
List nodeList = xQueryExpression.evaluate(dynamicQueryContext);
//my code to parse SAXON resulting XML tree and produce a string