You haven't explained what the "new DocumentSource()" does - is DocumentSource a subclass of DOMSource?
Saxon doesn't accept a DOM Node (from a non-Saxon DOM implementation) as a parameter. In 7.1 you can achieve this, but you must first wrap it in a DOMSource object. In 6.x it's not supported at all. One way around this is to supply an invented URI instead, and then access the document using the document() function, intercepting the invented URI with your own URIResolver.
But really, constructing a DOM simply in order to provide input to Saxon is very inefficient. Saxon's handling of DOM input is inefficient because DOM doesn't support things like sorting nodes into document order. So generating a DOM just so that you can pass it to Saxon is bad news. Generating a SAX stream, or a Saxon TinyTree, would be far better, even serializing to raw XML might be better.
Michael Kay
-----Original Message-----
From: [] On Behalf Of David Hooker
Sent: 12 June 2002 01:17
Subject: [saxon] Passing parameters to a transform

I'm using dom4j and Saxon.  I need to pass node set parameters to the transform, and I'm having a hard time figuring out the API to do this.  Here's what I have: writer = new DOMWriter();
    org.w3c.dom.Document domDoc = writer.write(myDomForJDocument);
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer(new DocumentSource(myTransformDocument));
    transformer.setParameter("paramName", domDoc);
The transform doesn't seem to see the parameter document.  Does anyone have any examples/hints/suggestions for me?  Any other example code of passing parameters to a transform would be helpful.  Any insight into how Saxon handles parameters would be nice.