Thanks for your humble response.  There is a add on question - can you pass in Elements from a JDOM document in a similar way?  Quite a lot of what I do is based upon passing an Element rather than Documents?  Also linked to this is do you have to explicitly define the Namespace context or does the API recognise the context from the document passed in?
Further to this is the issue of anonymous namespaces.  In XSLT you can not have anonymous namespaces and also the same applies to JAXEN Xpath- with s9 do I need to allocate a namespace prefix to any anonymous namespaces.

From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: 04 July 2008 12:21
To: 'Mailing list for the SAXON XSLT and XQuery processor'
Subject: Re: [saxon] S9 API and JDOM

Slightly embarrassing this one: it was supposed to work using DocumentBuilder.wrap(Object), but that's not working in the JDOM case in Saxon 9.1. Also, there's no convenient way to unwrap the XdmNode that's return (which is a wrapper around a NodeInfo which is a wrapper around a JDOM Element) to get the JDOM element. So I had to do it rather clumsily as follows (you can plug this into the S9APIExamples.java program):
      * Demonstrate use of an XPath expression against a JDOM source document. For this
      * sample, saxon9-jdom.jar must be on the classpath
     private static class XPathJDOM implements S9APIExamples.Test {
         public String name() {
             return "XPathJDOM";
         public boolean isSchemaAware() {
             return false;
         public void run() throws SaxonApiException {
             // Build the JDOM document
             org.jdom.input.SAXBuilder jdomBuilder = new SAXBuilder();
             File file = new File("data/books.xml");
             org.jdom.Document doc;
             try {
                 doc = jdomBuilder.build(file);
             } catch (JDOMException e) {
                 throw new SaxonApiException(e);
             } catch (IOException e) {
                 throw new SaxonApiException(e);
             Processor proc = new Processor(false);
             DocumentBuilder db = proc.newDocumentBuilder();
             //XdmNode xdmDoc = db.wrap(doc);
             DocumentInfo saxonDoc = new net.sf.saxon.jdom.DocumentWrapper(
                     doc, file.toURI().toString(), proc.getUnderlyingConfiguration());
             XdmNode xdmDoc = db.wrap(saxonDoc);
             XPathCompiler xpath = proc.newXPathCompiler();
             XPathExecutable xx = xpath.compile("//ITEM");
             XPathSelector selector = xx.load();
             for(XdmItem item : selector) {
                 NodeInfo saxonNode = ((XdmNode)item).getUnderlyingNode();
                 org.jdom.Element element = (org.jdom.Element)((VirtualNode)saxonNode).getUnderlyingNode();
I'll treat this as a bug.
Michael Kay

From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of martin.me.roberts@bt.com
Sent: 04 July 2008 11:42
To: saxon-help@lists.sourceforge.net
Subject: [saxon] S9 API and JDOM

  Do you have any examples of using the S9 API Xpath part against a JDOM document?