This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Passing an XML document fragment ot a stylesheet


> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]