Hi, J. Pietschmann and Adam Shelley were kind enough to point me in the correct direction for solving my original problem. Thanks go to them for their time. I'm documenting the solution here so it'll be available in the email-list archive.
...here's the original problem statement... I'm getting the following exception: WARNING: Unknown formatting object http://www.w3.org/1999/XSL/Transform^stylesheet org.apache.fop.apps.FOPException when running the following code snippet to set up an embedded FOP: Driver fopDriver = new Driver(new InputSource(XSL_FO_FILE_PATH), new FileOutputStream(OBI_PDF_PO_FILE_PATH)); fopDriver.setRenderer(Driver.RENDER_PDF); fopDriver.run(); While researching the problem, I found in one of the FOP FAQ's that receiving something like this error means that I need to check that the xsl namespace is set to http://www.w3.org/1999/XSL/Transform. I've double-checked this and it appears to be set correctly (see below). <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> Anyone have any clues? Here are the versions I'm using for the various jars: xalan 2.0.0 xerces 1.2.3 fop 0.18 DEV Running fop at the command line works fine with these. Running it embedded on the other hand... ...And here's what was done to fix the problem: 1) After reading the documentation that Adam and J. recommended, I modified the code I was using to embed FOP. Now I'm doing this: Driver driver = new Driver(); driver.setRenderer(Driver.RENDER_PDF); InputHandler inputHandler = new XSLTInputHandler(new File(OBI_XML_PO_FILE_PATH), new File(XSL_FO_FILE_PATH)); XMLReader parser = inputHandler.getParser(); driver.setOutputStream(new FileOutputStream(OBI_PDF_PO_FILE_PATH)); driver.render(parser, inputHandler.getInputSource()); 2) This generated the exact same error when using FOP-0.18.1. However, once I switched to FOP-0.20.4, the following FOPException was generated: 'master-reference' for 'fo:page-sequence' matches no 'simple-page-master' or 'page-sequence-master' 3) Upon reading the FOP-0.20.4 Release Notes, this was resolved by changing the 'master-name' property in my XSL document to 'master-reference'. With these mods, everything works quite well now. Thanks, Matt -----Original Message----- From: J.Pietschmann [mailto:[EMAIL PROTECTED] Sent: Friday, April 25, 2003 5:51 PM To: [EMAIL PROTECTED] Subject: Re: Unknown formatting object Willis, Matthew wrote: > I'm getting the following exception: > WARNING: Unknown formatting object > http://www.w3.org/1999/XSL/Transform^stylesheet ... > when running the following code snippet to set up an embedded FOP: > > Driver fopDriver = new Driver(new InputSource(XSL_FO_FILE_PATH), new > FileOutputStream(OBI_PDF_PO_FILE_PATH)); You are feeding the style sheet as input to the formatter. This can't work, the formatter will only take FO documents, which is something different. If you want to transform some input XML with the style sheet and have the formatter work on the result of the transformation, see http://xml.apache.org/fop/embedding.html#servlet-transform > Here are the versions I'm using for the various jars: > fop 0.18 DEV That's darn old, you should upgrade. The code example above probably won't work with this old FOP release. J.Pietschmann --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
