There are no standards in this area, so you can't necessarily expect to find a way of doing it that works with all XSLT processors.
With Saxon you can wrap the DOM4J document node in a net.sf.saxon.dom4j.DocumentWrapper, as you do below. However, you should not create a new Configuration for this purpose, you should use the Configuration that's used to run the transformation. If you're using JAXP interfaces you can find this as a property of the TransformerFactory (which you will have to cast to Saxon's TransformerFactoryImpl or SchemaAwareTransformerFactory).
Wrapping the DOM4J document as a DOM node and then wrapping that as a Saxon node will work, but is probably very inefficient.


Michael Kay

From: Swapnil []
Sent: 06 July 2009 22:09
Subject: [saxon] Standard way to pass Param

Hello All,
I am looking for a solution to get a standard way to pass DOM (Node, Document etc) as param to xsl param.
Problem : I have a Dom4j Document Object which I am using to convert to W3C Document object and pass it as a param fro xsl tranformation. Using xalan it works perfactly fine but when I switch to saxon 9 it doesnt work.
I tried as below and it worked. But I dont know if this is the strandard  way of handling.

                              Object applicationXML = getServletContext().getAttribute("applicationXML"); // Dom4j Document object

String tranformer = System.getProperty("javax.xml.transform.TransformerFactory");
if(tranformer != null && tranformer.equalsIgnoreCase("net.sf.saxon.TransformerFactoryImpl"))
       applicationXML = new net.sf.saxon.dom4j.DocumentWrapper((org.dom4j.Document)applicationXML,"", new net.sf.saxon.Configuration());
       applicationXML = DOM4JHelper.getW3CDom((org.dom4j.Document) applicationXML);
Any suggestions?