Esteban Gonzalez wrote:
I´ve been trying to do some xml --> pdf transformation using FOP.
When I run FOP manually everything is wonderful,  but i don´t seem to really
understand how to embeed it in a running app.
The problem is with the input Source ..
I have both the xml file and the xsl file as org.w3c.dom.Document and I
don´t seem to be able to use them as input for the transformation.
I´ll post a code snippet to make myself clear
                Driver driver = new Driver();
                driver.setRenderer( Driver.RENDER_PDF );
                driver.setInputSource( new DocumentInputSource( xsl ) );

This won't work. THe driver expects a FO document at this point, no XSLT.

(, the problem is.. I seem to be
setting an XSL file as an input... so where do I set the XML Document as an

You need an XSLT transformer. Something like this:

 Driver driver =new Driver();
 Transformer transformer=TransformerFactory.newInstance()
         .newTransformer(new DOMSource(xsl));
 transformer.transform(new DOMSource(xml),
      new SAXResult(driver.getContentHandler()));

Check the package javax.xml.transform and subpackages.


I´ve been digging thru the fop api and found out this class XSLTransform
wich seems to take an XLM doc, and a XSL file as inputs and outputs a
org.w3c.dom.Document, but again.. I can´t input the XSL as a document...

there are any workarounds to this problems?...
or maybe some ideas?

Thanks for all your help!

Best Regards,
Esteban González

Esteban González

Departamento de Sistemas
ASSIST-CARD International

Reply via email to