[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: "Ritu Kama" <rkama@xxxxxxxxxxx>
Date: Mon, 11 Aug 2003 15:08:38 -0500
new streamsource
You can use SAXTransformerFactory to chain a series of Transformations by
piping the SAX events from one transformer to next one

example

TransformerFactory tFactory = TransformerFactory.newInstance();

TransformerFactory tFactory = TransformerFactory.newInstance();

if (tFactory.getFeature(SAXSource.FEATURE) &&
tFactory.getFeature(SAXResult.FEATURE))
{
   // Cast the TransformerFactory to SAXTransformerFactory.
   SAXTransformerFactory saxTFactory = ((SAXTransformerFactory) tFactory);
   // Create a TransformerHandler for each stylesheet.
   TransformerHandler tHandler1 = saxTFactory.newTransformerHandler(new
StreamSource("foo1.xsl"));
   TransformerHandler tHandler2 = saxTFactory.newTransformerHandler(new
StreamSource("foo2.xsl"));
   TransformerHandler tHandler3 = saxTFactory.newTransformerHandler(new
StreamSource("foo3.xsl"));

   // Create an XMLReader.
   XMLReader reader = XMLReaderFactory.createXMLReader();
   reader.setContentHandler(tHandler1);
   reader.setProperty("http://xml.org/sax/properties/lexical-handler",
tHandler1);

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

      // transformer3 outputs SAX events to the serializer.
   Serializer serializer =
SerializerFactory.getSerializer(OutputProperties.getDefaultMethodProperties(
"xml"));
      serializer.setOutputStream(System.out);
      tHandler3.setResult(new SAXResult(serializer.asContentHandler()));

     // Parse the XML input document. The input ContentHandler and output
ContentHandler
      // work in separate threads to optimize performance.
      reader.parse("foo.xml");
}
----- Original Message -----
From: <John.Coffie@xxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, August 11, 2003 1:57 PM
Subject:  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
unauthorized
> 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:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.