From the dom4J docs:   DocumentSource DocumentSource implements a JAXP Source for a Document.
 
So Saxon 6.1 doesn't support parameters at all???
 
I already have dom4j Documents (their DOM object) all over the place, so it just makes sense to pass them in as parameters.  I'm afraid flattening to XML would be too slow... but I don't know that for sure.  We are using the document() function now, but it's clunky dealing with filenames across platforms.  I'll look into the URIResolver idea, and the DOMSource.
-----Original Message-----
From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: Wednesday, June 12, 2002 4:43 AM
To: 'David Hooker'; saxon-help@lists.sourceforge.net
Subject: RE: [saxon] Passing parameters to a transform

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: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of David Hooker
Sent: 12 June 2002 01:17
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Passing parameters to a transform

Hi-
 
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:
 
    org.dom4j.io.DOMWriter 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.
 
Thanks...
 
-David-