On 10/25/11 5:09 AM, Jeffrey Walton wrote:
On Tue, Oct 25, 2011 at 4:34 AM,<[email protected]>  wrote:
Hi Jeffrey,

p, li { white-space: pre-wrap; }
On Tuesday 25 October 2011 Jeffrey Walton wrote:
[...]
If you were curious the -xml input is used in conjunction with an XSLT
(thus the -xsl parameter) to transform said XML file to FO. There is
no "default" PDF stylesheet, this mechanism is merely a helper since a
lot of users create FO using a transform.
OK. xalan also complains about a style sheet. These style sheets seem
important.
They are not important, they are essential! :-)
OK. Dumb user question: if they are so important, why does the tool
have no default style sheet to use? I would expect it to set margins
at 1.00 inch (or 2 centimeters), etc.

1. Validate your DocBook XML file first
Do NOT skip this step! Use xmllint and run it like this:
$ xmllint --xinclude --postvalid --noout book.xml
If you encounter any problems, fix it. DO NOT processed further if you
encounter any errors. The other steps rely on a valid DocBook source.

2. Transform your DocBook XML file into FO
The FO file is an intermediate file which is read by your FO formatter.
I've already wrote about how to run xsltproc. See lines above.
OK, thanks. I was not aware this was a multi-step process.

3. Format the FO file
Now you take your FO file and feed it into the FO formatter:
$ fop book.fo book.pdf
OK. See below :(

$ xmllint --xinclude --postvalid --noout book.xml
# No complaints

$ xsltproc --xinclude
http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
book.xml>  book.fo
# No complaints

Jeffrey,

You are using the wrong stylesheets. You have converted your book.xml to an HTML document. If you renamed book.fo to book.html and then opened it in firefox, you see it formatted properly. However, you need a FO document. Try:

$ xsltproc --xinclude

http://docbook.sourceforge.net/release/xsl/current/fo/fo.xsl
book.xml > book.fo

Instead.

It would probably be better to download the stylesheets to your hard drive, since it will take less time to process. Let me know if you still have problems.

Paul

$ fop -fo book.fo -pdf book.pdf
# All hell breaks loose

Thanks for the help. It is greatly appreciated.

Jeff

Oct 25, 2011 5:07:37 AM org.apache.fop.cli.Main startFOP
SEVERE: Exception
org.apache.fop.apps.FOPException:
org.apache.fop.fo.ValidationException: Error: First element must be
the fo:root formatting object. Found (Namespace URI: "", Local Name:
"html") instead. Please make sure you're producing a valid XSL-FO
document.
javax.xml.transform.TransformerException:
org.apache.fop.fo.ValidationException: Error: First element must be
the fo:root formatting object. Found (Namespace URI: "", Local Name:
"html") instead. Please make sure you're producing a valid XSL-FO
document.
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:217)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:125)
        at org.apache.fop.cli.Main.startFOP(Main.java:166)
        at org.apache.fop.cli.Main.main(Main.java:197)
Caused by: javax.xml.transform.TransformerException:
org.apache.fop.fo.ValidationException: Error: First element must be
the fo:root formatting object. Found (Namespace URI: "", Local Name:
"html") instead. Please make sure you're producing a valid XSL-FO
document.
        at 
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:502)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:214)
        ... 3 more
Caused by: org.apache.fop.fo.ValidationException: Error: First element
must be the fo:root formatting object. Found (Namespace URI: "", Local
Name: "html") instead. Please make sure you're producing a valid
XSL-FO document.
        at 
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:262)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:163)
        at 
org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1073)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown 
Source)
        at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
        at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown 
Source)
        at 
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
        ... 4 more

---------

javax.xml.transform.TransformerException:
org.apache.fop.fo.ValidationException: Error: First element must be
the fo:root formatting object. Found (Namespace URI: "", Local Name:
"html") instead. Please make sure you're producing a valid XSL-FO
document.
        at 
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:502)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:214)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:125)
        at org.apache.fop.cli.Main.startFOP(Main.java:166)
        at org.apache.fop.cli.Main.main(Main.java:197)
Caused by: org.apache.fop.fo.ValidationException: Error: First element
must be the fo:root formatting object. Found (Namespace URI: "", Local
Name: "html") instead. Please make sure you're producing a valid
XSL-FO document.
        at 
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:262)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:163)
        at 
org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1073)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown 
Source)
        at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
        at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown 
Source)
        at 
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
        ... 4 more
---------
org.apache.fop.fo.ValidationException: Error: First element must be
the fo:root formatting object. Found (Namespace URI: "", Local Name:
"html") instead. Please make sure you're producing a valid XSL-FO
document.
        at 
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:262)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:163)
        at 
org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1073)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown 
Source)
        at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
        at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown 
Source)
        at 
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:214)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:125)
        at org.apache.fop.cli.Main.startFOP(Main.java:166)
        at org.apache.fop.cli.Main.main(Main.java:197)
$

---------------------------------------------------------------------
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]

Reply via email to