RE: Passing an XML document fragment ot a stylesheet

Subject: RE: Passing an XML document fragment ot a stylesheet
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Wed, 15 Mar 2000 13:22:39 -0000
> I'm looking for advices on the best method to pass an XML 
> document fragment to a stylesheet...
> 
My first choice would have been to use document(), but I can see why you're
not keen on that.
> 
> I can see different ways to do this:
> 
> 1) Pass a node-set parameter to the stylesheet
> 
> Is it possible? If so, how do I create one using Saxon?

Try something along the following lines:

String s = "<frag>a bit of XML</frag>"
Builder b = new Builder();
DocumentInfo doc = b.build(new InputSource(new StringReader(s)));
NodeSetValue nsv = new NodeSetValue(doc);
ParameterSet params = new ParameterSet();
params.put("fragment", nsv);

You could also drive Builder directly using the SAX DocumentHandler
interface, rather than parsing raw XML, but I doubt there's a big
difference.

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread