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 Jeff Pennal <je...@openroad.ca> on 2002/03/25 21:55:04 UTC

XSLTInputHandler question

Can someone explain to me how to do this with embedded FOP?

I want to create an XSLTInputSource, but I have dynamically generated 
the XML file in memory and I do not want to commit it to disk just to 
have a File object to point to.

What I would have expected is a constructor to the XSLTInputHandler that 
looks like this:
     public XSLTInputHandler(org.w3c.Document document, File xsltfile)

Is this possible?


-- 
Jeff Pennal                         p:604-694-0554(x107)
Senior Software Developer           f:604-694-0558
Openroad Communications             e:jeffp@openroad.ca
Vancouver, BC


Re: XSLTInputHandler question

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Jeff Pennal wrote:
> I want to create an XSLTInputSource, but I have dynamically generated 
> the XML file in memory and I do not want to commit it to disk just to 
> have a File object to point to.

You have to use DOM or, preferably, SAX to wire your
transformer to the FO processor.

Try something like this:
  // set up your transformation
  Transformer transformer
    =TransformerFactory.newInstance().newTransformer(xsltSource);
  // prepare FOP
  Driver driver=new Driver();
  driver.setOutputStream(...);
  driver.setRenderer(Driver.RENDER_PDF);
  // transform, this also drives the formatter
  transformer.transform(xmlSource,
    new SAXResult(driver.getContentHandler()));

HTH
J.Pietschmann