Firstly, passing a general-purpose DOM as input to Saxon is not very efficient; Saxon has to strip the DOM and build its own tree structure. If possible, build the tree as Saxon DocumentInfo objects (using either tree model). You can do this by using the JAXP parser interfaces with Saxon as your chosen DocumentBuilderFactory, or you can do it (more simply) by using a JAXP identity transformation. The Saxon DocumentInfo object implements the JAXP Source interface, so you can supply it directly as input to the transform method, or return it from a URIResolver, and you can also supply it directly as a parameter to the stylesheet.
It is possible to supply a third-party Document object as the source of a transformation, but not as a parameter.
The message "The value is not a node-set" implies that you have supplied a parameter value which Saxon accepted, but treated as some data-type other than node-set (possibly "external object", which is a catch-all). If you supplied a DOM Document object that was not a Saxon DocumentInfo, you should get the message "Result is a non-Saxon DOM Node". What is the actual class of your value "ads"?
Mike Kay
 -----Original Message-----
From: []On Behalf Of Martin Dransfield
Sent: 17 January 2002 11:42
Subject: [saxon] DOM parameters via JAXP


I have a stylesheet which takes two filename parameters, which it then
converts to node sets via document().

I've written a JAXP framework that generates the contents of these
files as DOM Document objects. I would like to pass these objects
directly to the stylesheet to save the expense of me serializing the
objects to file and SAXON reading the files to build node sets.

I tried to do this naively with this sort of code:

xformer.setParameter("dataset", ads);

where xformer is my transformer and ads is a Document. When I call
xformer.transform(), I get a warning, "The value is not a node-set".
Which is true.

Is there any way to pass a Document to SAXON when called in this way?
Or do I have to convert the Documents myself before passing them as parameter.
I'm using SAXON 6.5, If possible I'd like maintain XSLT processor
independence, but getting this working is more important.

Thanks in advance,

Martin Dransfield


1 cent a minute calls anywhere in the U.S.!

_______________________________________________ saxon-help mailing list