Hi,

I guess my setup is wrong - perhaps someone can help? I downloaded and 
extracted fop-0.93 (fop-current-bin-jdk1.4.zip) to 
C:\PROGRA~1\APACHE~1\fop-0.93. I copied the jar files from the /lib directory 
into my CLASSPATH. Then I tried to run FOP from the command line. I tried first 
to make an FO file using Fop -xml xml.xml -xsl xsl.xsl -foout foo.fo. The FO 
file is created fine but then when I try and create the PDF from the FO file 
that FOP has created for me it fails! See below (Also at the foot of the 
message I have included the contents of my xml, xsl and FOP's FO file)

Thanks in advance for any help, Ian.

C:\PROGRA~1\APACHE~1\fop-0.93>Fop -xml xml.xml -xsl xsl.xsl -foout foo.fo
"C:\PROGRA~1\Java\jre1.5.0_10\bin\java"
C:\PROGRA~1\APACHE~1\fop-0.93>Fop foo.fo foo.pdf
"C:\PROGRA~1\Java\jre1.5.0_10\bin\java"
01-Mar-2007 17:43:30 org.apache.fop.cli.Main startFOP
SEVERE: Exception
javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException:
 Error: First element must be the fo:root formatting object. Found fo:block inst
ead. Please make sure you're producing a valid XSL-FO document.
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:168)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
        at org.apache.fop.cli.Main.startFOP(Main.java:160)
        at org.apache.fop.cli.Main.main(Main.java:191)

---------

javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException:
 Error: First element must be the fo:root formatting object. Found fo:block inst
ead. Please make sure you're producing a valid XSL-FO document.
        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Transf
ormerIdentityImpl.java:501)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:165)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
        at org.apache.fop.cli.Main.startFOP(Main.java:160)
        at org.apache.fop.cli.Main.main(Main.java:191)
Caused by: org.apache.fop.fo.ValidationException: Error: First element must be t
he fo:root formatting object. Found fo:block instead. Please make sure you're pr
oducing a valid XSL-FO document.
        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuil
der.java:292)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:185)
        at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(Tra
nsformerIdentityImpl.java:1072)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Sour
ce)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
own Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.s
canRootElementHook(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known 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.xalan.transformer.TransformerIdentityImpl.transform(Transf
ormerIdentityImpl.java:484)
        ... 4 more
---------
org.apache.fop.fo.ValidationException: Error: First element must be the fo:root
formatting object. Found fo:block instead. Please make sure you're producing a v
alid XSL-FO document.
        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuil
der.java:292)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:185)
        at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(Tra
nsformerIdentityImpl.java:1072)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Sour
ce)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
own Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.s
canRootElementHook(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known 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.xalan.transformer.TransformerIdentityImpl.transform(Transf
ormerIdentityImpl.java:484)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:165)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
        at org.apache.fop.cli.Main.startFOP(Main.java:160)
        at org.apache.fop.cli.Main.main(Main.java:191)


********* END SCREEN DUMP *********

********* INCLUDED FILES  *********
XML.XML
<?xml version="1.0" encoding="UTF-8"?>
<data>
<name>
Krusty the Clown
</name>
<description>
This memo explains why Krusty the Clown is our best customer.
We need to take good care of him from now onwards and make sure
that there are always enough bananas for his pet monkey. 
</description>
</data>
END XML.XML
XSL.XSL
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";>

<xsl:template match="data">
<fo:block>
<xsl:apply-templates select="name"/>
<xsl:apply-templates select="description"/>
</fo:block>
</xsl:template>

<xsl:template match="name"> 
<fo:block font-size="18pt" 
font-family="sans-serif" 
line-height="24pt"
space-after.optimum="15pt"
background-color="blue"
color="white"
text-align="center"
padding-top="3pt">
<xsl:value-of select="."/>
</fo:block> 
</xsl:template>

<xsl:template match="description">
<fo:block font-size="12pt" 
font-family="sans-serif" 
line-height="15pt"
space-after.optimum="3pt"
text-align="justify">
<xsl:value-of select="."/>
</fo:block>
</xsl:template>

</xsl:stylesheet>
END XSL.XSL
FOO.FO
<?xml version="1.0" encoding="UTF-8"?><fo:block 
xmlns:fo="http://www.w3.org/1999/XSL/Format";><fo:block padding-top="3pt" 
text-align="center" color="white" background-color="blue" 
space-after.optimum="15pt" line-height="24pt" font-family="sans-serif" 
font-size="18pt">
Krusty the Clown
</fo:block><fo:block text-align="justify" space-after.optimum="3pt" 
line-height="15pt" font-family="sans-serif" font-size="12pt">
This memo explains why Krusty the Clown is our best customer.
We need to take good care of him from now onwards and make sure
that there are always enough bananas for his pet monkey. 
</fo:block></fo:block>
END FO.FO
 

Reply via email to