Re: streaming multiple XML input
Luc Pionchon wrote: > is there anyway to give to a XSLTprocessor several XML entries, except by > "hardcoding" a file name with "document(xxx.xml)" > actually, i wanted to avoid using files, but using streams. > basicaly something like this (~): > > transf.setXSLT("xxx.xsl"); > transformer.convert(inputStream1, inputStream2, outputStream); An XSLT processor always has exactly one "main" source tree that it is processing, consisting of a root node, if nothing else. I tried a long time ago to make a case for there to be a default source tree consisting of nothing but the root node, so that XSLT processors would not have to have *any* input, necessarily, but this fell on deaf ears. I don't think you could make a case for multiple "main" source trees, since there is no facility in XSLT for distinguishing between them. So if you need to access multiple source documents, you must access them through the document() function, or through an extension function that returns a node-set. If you have the option of using a servlet that returns, via HTTP, a document in response to a URI like http://myhost/getstream?num=2, then that is probably the easiest thing to implement. You could avoid HTTP altogether by inventing your own URI scheme like "getstream", as in document('getstream:stream2'), and then having your application supply its own javax.xml.transform.URIResolver that will return a javax.xml.transform.Source appropriately. I don't know where to look for examples of this being done, though. - Mike ____________________________________________________________________________ mike j. brown, fourthought.com | xml/xslt: http://skew.org/xml/ denver/boulder, colorado, usa | personal: http://hyperreal.org/~mike/ 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