Do the following: Instead of piping the result of the XSL transformation
through to FOP with the following line:

Result res = new SAXResult(driver.getContentHandler());

...simply serialize the resulting XSL-FO document to a file:

Result res = new StreamResult(new File("C:/Temp/debug.fo"));

Check if the FO file looks right and runs smoothly through FOP.

To debug the whole thing outside of your application you might want to
consider writing the early XML to a file. In this case your code would
look like in [1]. Note the identity transformer instead of an XSL
transformation. In this case you'd have a Result like this:

Result res = new StreamResult(new File("C:/Temp/debug.xml"));

Once you have the XML from your application, you can use xalan.bat, fop.bat
and your stylesheet to debug everything. Once your stylesheet is fixed
you can run the integrated code again that does the full functionality.
The key is to break down the whole process into it parts (creating XML
from your application, transforming using XSLT and formatting using FOP).

[1] 
http://cvs.apache.org/viewcvs.cgi/xml-fop/examples/embedding/java/embedding/ExampleObj2XML.java?rev=1.4


On 07.03.2005 15:27:21 Ben Gill wrote:
> Thanks Chris,
> 
> This helped me sort out the problem straight away....  The xalan.bat will
> help me a lot in debugging...
> 
> But this is not going to show me anything too useful as I am populating
> Object straight to PDF...
> 
> As the Object to PDF generation process, includes generating the XML and the
> FO syntax (at some point during the processing - I assume at least)... is
> there any way to get this information by switching on some sort of FOP
> debugging?  
> 
> That would be really useful.... (and will probably save me a lot of time!!)
> 
> Cheers
> 
> -----Original Message-----
> From: Chris Bowditch [mailto:[EMAIL PROTECTED]
> Sent: 07 March 2005 14:04
> To: [EMAIL PROTECTED]
> Subject: Re: Error:
> 
> 
> Ben Gill wrote:
> 
> > Hi,
> > 
> > I downloaded the latest 0.20.5 bin and copied the ExampleObj2PDF example
> and
> > am getting:
> > 
> > {ERROR} dao.BaseDAOTestCase  Error generating PDF document
> > [org.apache.fop.apps.
> > FOPException: root must be root element]
> > javax.xml.transform.TransformerException:
> org.apache.fop.apps.FOPException:
> > root
> >  must be root element
> 
> This is a problem with your XML/XSLT
> 
> <snip/>
> 
> > 
> > from XLST stylesheet:
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsl:stylesheet version="1.1" 
> >     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
> >     xmlns:fo="http://www.w3.org/1999/XSL/Format"; 
> >     exclude-result-prefixes="fo">
> >   <xsl:output method="xml" version="1.0" omit-xml-declaration="no"
> > indent="yes"/>
> >   <!-- ========================= -->
> >   <!-- root element: projectteam -->
> >   <!-- ========================= -->
> >   <xsl:template match="incident">
> 
> Note, that the element being matched differs from the comment. However, this
> 
> may not be the cause of the problem. Most likely cause is several
> occurrences 
> of element incident in your source XML, resulting in several root elements.
> 
> To determine where mistake is you should generate XSL-FO file by running 
> xalan.bat (in FOP distribution) from command line.
> 
> <snip/>
> 
> Chris
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> _____________________________________________________________________
> This message has been checked for all known viruses by the 
> MessageLabs Virus Control Centre.
> 
> This message has been checked for all known viruses by the MessageLabs Virus 
> Control Centre.
> 
>       
> *********************************************************************
> 
> Notice:  This email is confidential and may contain copyright material of 
> Ocado Limited (the "Company"). Opinions and views expressed in this message 
> may not necessarily reflect the opinions and views of the Company.
> If you are not the intended recipient, please notify us immediately and 
> delete all copies of this message. Please note that it is your responsibility 
> to scan this message for viruses.
> 
> Company reg. no. 3875000.
> Ocado Limited
> Titan Court
> 3 Bishops Square
> Hatfield Business Park
> Hatfield
> Herts
> AL10 9NE
> 
> 
> *********************************************************************
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to