"Sebastian Will" <[EMAIL PROTECTED]> wrote: > Your help is much appreciated. I searched through the available archives > (most of them seem to be down), > but I cannot find some better way to implement a > "convert-xml-to-fo-with-xsl-and-render-that-without-writing-to-FS" > rendering.
That's odd. Since Version 0.20.x or something, FOP is delivered with a XSLTInputHandler class. Look it up in the documentation, or in the archive: http://marc.theaimsgroup.com/?l=fop-dev&w=2&r=1&s=XSLTInputHandler%28&q=b If you are sure your XSLT processor supports SAXResults (Xalan does), you can use a TraxInputHandler directly. Unfortunately, both XSLTInputHandler and TraxInputHandler take only files, both for the XML source and the XSLT. This is bad if you get character streams, SAX streams or DOM trees from elsewhere (e.g. from a DB or a web service). In this case you can use a SAX event stream to get the transformation result into FOP, roughly like this: // however you want to set up your transformation Transformer transformer=TransformerFactory.newInstance().newTransformer(xsltSource); // prepare FOP Driver driver=new Driver(); driver.setOutputStream(...); driver.setRenderer(RENDER_PDF); transformer.transform(xmlSource, new SAXResult(driver.getContentHandler())); The above is slightly simplified and untested. You don't have to call driver.render() or run(), as the rendering is driven by the SAX stream coming from the transformation. Note that the FOP output stream and the renderer has to be set before getContentHandler() is called. Regards J.Pietschmann
