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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format