RE: Using a StreamResult as a StreamSource
> How can I use a StreamResult for a StreamSource. I am > transforming an xml document twice. The result of the first > transform is used to generate the transformer object for the > second transform. What is the best way to accomplish this > task. Please include examples with your suggestions. We're talking JAXP here, for those who are mystified... The best way to pipeline the output of one transformation as the input of another is not using StreamResult/StreamSource, but using SAX. There are various mechanisms in JAXP to allow such pipelining. You can compile a transformation as a SAXFilter, in which case it can be inserted into a SAX pipeline along with other SAXFilters (which may or may not be XSLT transformations). You can also wrap a Transformer into a SAX ContentHandler, which you can then use as the SAXResult of another transformation. But if you must use StreamResult/StreamSource, then you can always create a StreamResult for the first transformation based on a StringWriter, and the use a StringReader over the same String as the basis for the StreamSource for the next transformation. Michael 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