[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Using a StreamResult as a StreamSource

Subject: RE: Using a StreamResult as a StreamSource
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 12 Aug 2003 08:44:07 +0100
> 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

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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.