You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Amine AMAR <a....@caciopee.com> on 2002/06/13 15:52:45 UTC

using an InputStream with XSLTInputHandler

Hi All,

I need to use XSLTInputHandler with an runtime generated xml document. I 
would like to just stream-line it to XSLTInputHandler and not use the file 
system.
is there a way to do so? or a workarround?

Thank's

Amine 



Re: using an InputStream with XSLTInputHandler

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Amine AMAR wrote:
> Hi All,
> 
> I need to use XSLTInputHandler with an runtime generated xml document. I 
> would like to just stream-line it to XSLTInputHandler and not use the file 
> system.
> is there a way to do so? or a workarround?

This has just been answered yesterday.

    Driver driver =new Driver();
    driver.setOutputStream(response.getOutputStream());
    driver.setRenderer(Driver.RENDER_PDF);
    Transformer transformer=TransformerFactory.newInstance()
      .newTransformer(new StreamSource("foo.xsl"));
    transformer.transform(xmlsource,
      new SAXResult(driver.getContentHandler()));

xmlsource can be a DOMSource or a SAXSource as well as an
arbitrary StreamSource.
You don't have to call run() or render() on the driver object.

J.Pietschmann