Re: [xsl] Using a StreamResult as a StreamSource

Subject: Re: [xsl] Using a StreamResult as a StreamSource
From: "Ritu Kama" <rkama@xxxxxxxxxxx>
Date: Mon, 11 Aug 2003 15:08:38 -0500
You can use SAXTransformerFactory to chain a series of Transformations by
piping the SAX events from one transformer to next one


TransformerFactory tFactory = TransformerFactory.newInstance();

TransformerFactory tFactory = TransformerFactory.newInstance();

if (tFactory.getFeature(SAXSource.FEATURE) &&
   // Cast the TransformerFactory to SAXTransformerFactory.
   SAXTransformerFactory saxTFactory = ((SAXTransformerFactory) tFactory);
   // Create a TransformerHandler for each stylesheet.
   TransformerHandler tHandler1 = saxTFactory.newTransformerHandler(new
   TransformerHandler tHandler2 = saxTFactory.newTransformerHandler(new
   TransformerHandler tHandler3 = saxTFactory.newTransformerHandler(new

   // Create an XMLReader.
   XMLReader reader = XMLReaderFactory.createXMLReader();

   tHandler1.setResult(new SAXResult(tHandler2));
   tHandler2.setResult(new SAXResult(tHandler3));

      // transformer3 outputs SAX events to the serializer.
   Serializer serializer =
      tHandler3.setResult(new SAXResult(serializer.asContentHandler()));

     // Parse the XML input document. The input ContentHandler and output
      // work in separate threads to optimize performance.
----- Original Message -----
From: <John.Coffie@xxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, August 11, 2003 1:57 PM
Subject: [xsl] 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.
> CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is
> for the sole use of the intended recipient(s) and may contain confidential
> and privileged information or otherwise protected by law.  Any
> review, use, disclosure or distribution is prohibited.  If you are not the
> intended recipient, please contact the sender by reply e-mail and destroy
> all copies of the original message.
>  XSL-List info and archive:

 XSL-List info and archive:

Current Thread