Discussion:
Apache FOP Newbie needs Help Converting XML to PDF
italocardwell
2011-03-09 12:43:06 UTC
Permalink
Ill be upfront I know nothing about XML. I am a SQL developer and I have a
project where I need to convert XML files to a PDF. The XML are going to be
the same format every time with different data in them. I am wanting to use
apache fop 1.0 at the command line to convert these. I am getting an error
every time that I attempt to do this. I will attach the files and the
error. Would someone please help me out. Thanks.
http://old.nabble.com/file/p31105999/a91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
a91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
http://old.nabble.com/file/p31105999/ccr.xsl ccr.xsl
http://old.nabble.com/file/p31105999/date.format-date.template.xsl
date.format-date.template.xsl
http://old.nabble.com/file/p31105999/str.padding.template.xsl
str.padding.template.xsl

The error that I get states that fo needs to be in xml-fo format.
--
View this message in context: http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-PDF-tp31105999p31105999.html
Sent from the FOP - Users mailing list archive at Nabble.com.
Peter Hancock
2011-03-09 14:01:45 UTC
Permalink
Hi,

Can you tell us exactly which files you are using when you invoke fop, please.
Your command should look something like
fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf
judging by the files you have attached.
I am guessing you missed out the -xml/-xsl flags, leading FOP to
believe you were supplying an FO file.

When an XML and XSL files are supplied, FOP will perform an XSLT
transform using the Xalan XSLT Xalan library (I am guessing you will
need to know more about this stage in your project), generating the FO
document stream that is then processed to generate the output in the
desired format:

XML + XSL -> [XSLT transformer] -> FO -> [XSL:FO processor] -> PDF

This initial stage just saves on from having to do the transform first.

I hope this info helps,

Peter
Ill be upfront I know nothing about XML.  I am a SQL developer and I have a
project where I need to convert XML files to a PDF.  The XML are going to be
the same format every time with different data in them.  I am wanting to use
apache fop 1.0 at the command line to convert these.  I am getting an error
every time that I attempt to do this.  I will attach the files and the
error.  Would someone please help me out.  Thanks.
http://old.nabble.com/file/p31105999/a91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
a91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
http://old.nabble.com/file/p31105999/ccr.xsl ccr.xsl
http://old.nabble.com/file/p31105999/date.format-date.template.xsl
date.format-date.template.xsl
http://old.nabble.com/file/p31105999/str.padding.template.xsl
str.padding.template.xsl
The error that I get states that fo needs to be in xml-fo format.
--
View this message in context: http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-PDF-tp31105999p31105999.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
italocardwell
2011-03-09 14:09:59 UTC
Permalink
I was using
fop -xm la91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
-xsl ccr.xsl -pdf test.pdf
Post by Peter Hancock
Hi,
Can you tell us exactly which files you are using when you invoke fop, please.
Your command should look something like
fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf
judging by the files you have attached.
I am guessing you missed out the -xml/-xsl flags, leading FOP to
believe you were supplying an FO file.
When an XML and XSL files are supplied, FOP will perform an XSLT
transform using the Xalan XSLT Xalan library (I am guessing you will
need to know more about this stage in your project), generating the FO
document stream that is then processed to generate the output in the
XML + XSL -> [XSLT transformer] -> FO -> [XSL:FO processor] -> PDF
This initial stage just saves on from having to do the transform first.
I hope this info helps,
Peter
Ill be upfront I know nothing about XML.  I am a SQL developer and I have a
project where I need to convert XML files to a PDF.  The XML are going to be
the same format every time with different data in them.  I am wanting to use
apache fop 1.0 at the command line to convert these.  I am getting an error
every time that I attempt to do this.  I will attach the files and the
error.  Would someone please help me out.  Thanks.
http://old.nabble.com/file/p31105999/a91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
a91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
http://old.nabble.com/file/p31105999/ccr.xsl ccr.xsl
http://old.nabble.com/file/p31105999/date.format-date.template.xsl
date.format-date.template.xsl
http://old.nabble.com/file/p31105999/str.padding.template.xsl
str.padding.template.xsl
The error that I get states that fo needs to be in xml-fo format.
--
http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-PDF-tp31105999p31105999.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
---------------------------------------------------------------------
--
View this message in context: http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-PDF-tp31105999p31106656.html
Sent from the FOP - Users mailing list archive at Nabble.com.
Eric Douglas
2011-03-09 14:11:54 UTC
Permalink
-xm? Try -xml?
Then take the dashes out of your file name, or try putting it in quotes.

-----Original Message-----
From: italocardwell [mailto:***@gmail.com]
Sent: Wednesday, March 09, 2011 9:10 AM
To: fop-***@xmlgraphics.apache.org
Subject: Re: Apache FOP Newbie needs Help Converting XML to PDF


I was using
fop -xm la91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
-xsl ccr.xsl -pdf test.pdf
Post by Peter Hancock
Hi,
Can you tell us exactly which files you are using when you invoke fop, please.
Your command should look something like fop -xml foo.xml -xsl foo.xsl
-pdf foo.pdf judging by the files you have attached.
I am guessing you missed out the -xml/-xsl flags, leading FOP to
believe you were supplying an FO file.
When an XML and XSL files are supplied, FOP will perform an XSLT
transform using the Xalan XSLT Xalan library (I am guessing you will
need to know more about this stage in your project), generating the FO
document stream that is then processed to generate the output in the
XML + XSL -> [XSLT transformer] -> FO -> [XSL:FO processor] -> PDF
This initial stage just saves on from having to do the transform first.
I hope this info helps,
Peter
On Wed, Mar 9, 2011 at 12:43 PM, italocardwell
Ill be upfront I know nothing about XML.  I am a SQL developer and I
have a project where I need to convert XML files to a PDF.  The XML
are going to be the same format every time with different data in
them.  I am wanting to use apache fop 1.0 at the command line to
convert these.  I am getting an error every time that I attempt to do
this.  I will attach the files and the error.  Would someone please
help me out.  Thanks.
http://old.nabble.com/file/p31105999/a91ec9d3-e021-4e5e-933f-54992cdc
415c.20110308172937.xml
a91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
http://old.nabble.com/file/p31105999/ccr.xsl ccr.xsl
http://old.nabble.com/file/p31105999/date.format-date.template.xsl
date.format-date.template.xsl
http://old.nabble.com/file/p31105999/str.padding.template.xsl
str.padding.template.xsl
The error that I get states that fo needs to be in xml-fo format.
--
http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-
PDF-tp31105999p31105999.html Sent from the FOP - Users mailing list
archive at Nabble.com.
---------------------------------------------------------------------
---------------------------------------------------------------------
--
View this message in context: http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-PDF-tp31105999p31106656.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-***@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-***@xmlgraphics.apache.org
italocardwell
2011-03-09 14:25:34 UTC
Permalink
Sorry the -xm was a fat finger. I was using -xml and even if I change the
file name to test it still produces the same error. Complete error below.

SEVERE: Exception
javax.xml.transform.TransformerException:
org.apache.fop.fo.ValidationException:
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 do
cument.
Post by Eric Douglas
-xm? Try -xml?
Then take the dashes out of your file name, or try putting it in quotes.
-----Original Message-----
Sent: Wednesday, March 09, 2011 9:10 AM
Subject: Re: Apache FOP Newbie needs Help Converting XML to PDF
I was using
fop -xm la91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
-xsl ccr.xsl -pdf test.pdf
Post by Peter Hancock
Hi,
Can you tell us exactly which files you are using when you invoke fop, please.
Your command should look something like fop -xml foo.xml -xsl foo.xsl
-pdf foo.pdf judging by the files you have attached.
I am guessing you missed out the -xml/-xsl flags, leading FOP to
believe you were supplying an FO file.
When an XML and XSL files are supplied, FOP will perform an XSLT
transform using the Xalan XSLT Xalan library (I am guessing you will
need to know more about this stage in your project), generating the FO
document stream that is then processed to generate the output in the
XML + XSL -> [XSLT transformer] -> FO -> [XSL:FO processor] -> PDF
This initial stage just saves on from having to do the transform first.
I hope this info helps,
Peter
On Wed, Mar 9, 2011 at 12:43 PM, italocardwell
Ill be upfront I know nothing about XML.  I am a SQL developer and I
have a project where I need to convert XML files to a PDF.  The XML
are going to be the same format every time with different data in
them.  I am wanting to use apache fop 1.0 at the command line to
convert these.  I am getting an error every time that I attempt to do
this.  I will attach the files and the error.  Would someone please
help me out.  Thanks.
http://old.nabble.com/file/p31105999/a91ec9d3-e021-4e5e-933f-54992cdc
415c.20110308172937.xml
a91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
http://old.nabble.com/file/p31105999/ccr.xsl ccr.xsl
http://old.nabble.com/file/p31105999/date.format-date.template.xsl
date.format-date.template.xsl
http://old.nabble.com/file/p31105999/str.padding.template.xsl
str.padding.template.xsl
The error that I get states that fo needs to be in xml-fo format.
--
http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-
PDF-tp31105999p31105999.html Sent from the FOP - Users mailing list
archive at Nabble.com.
---------------------------------------------------------------------
---------------------------------------------------------------------
--
http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-PDF-tp31105999p31106656.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
---------------------------------------------------------------------
--
View this message in context: http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-PDF-tp31105999p31106816.html
Sent from the FOP - Users mailing list archive at Nabble.com.
Peter Hancock
2011-03-09 14:40:23 UTC
Permalink
It seems that date.format-date.template.xsl is unavailable.

I suggest that you generate the fo first from the relavent xml and xsl
(this is out of scope of this mailing list - help can be found on
other mailing lists like http://www.mulberrytech.com/xsl/xsl-list/),
and then post the corresponding fo to this list if you are still
having problems processing it with FOP.

Thanks,

Peter
Sorry the -xm was a fat finger.  I was using -xml and even if I change the
file name to test it still produces the same error.  Complete error below.
SEVERE: Exception
"",
Local Name: "html") instead. Please make sure you're producing a valid
XSL-FO do
cument.
-xm?  Try -xml?
Then take the dashes out of your file name, or try putting it in quotes.
-----Original Message-----
Sent: Wednesday, March 09, 2011 9:10 AM
Subject: Re: Apache FOP Newbie needs Help Converting XML to PDF
I was using
fop -xm la91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
   -xsl ccr.xsl -pdf test.pdf
Post by Peter Hancock
Hi,
Can you tell us exactly which files you are using when you invoke fop, please.
Your command should look something like fop -xml foo.xml -xsl foo.xsl
-pdf foo.pdf  judging by the files you have attached.
I am guessing you missed out the -xml/-xsl flags, leading FOP to
believe you were supplying an FO file.
When an  XML and XSL files are supplied, FOP will perform an XSLT
transform using the Xalan XSLT Xalan library (I am guessing you will
need to know more about this stage in your project), generating the FO
document stream that is then processed to generate the output in the
XML + XSL -> [XSLT transformer] -> FO -> [XSL:FO processor] -> PDF
This initial stage just saves on from having to do the transform first.
I hope this info helps,
Peter
On Wed, Mar 9, 2011 at 12:43 PM, italocardwell
Ill be upfront I know nothing about XML.  I am a SQL developer and I
have a project where I need to convert XML files to a PDF.  The XML
are going to be the same format every time with different data in
them.  I am wanting to use apache fop 1.0 at the command line to
convert these.  I am getting an error every time that I attempt to do
this.  I will attach the files and the error.  Would someone please
help me out.  Thanks.
http://old.nabble.com/file/p31105999/a91ec9d3-e021-4e5e-933f-54992cdc
415c.20110308172937.xml
a91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
http://old.nabble.com/file/p31105999/ccr.xsl ccr.xsl
http://old.nabble.com/file/p31105999/date.format-date.template.xsl
date.format-date.template.xsl
http://old.nabble.com/file/p31105999/str.padding.template.xsl
str.padding.template.xsl
The error that I get states that fo needs to be in xml-fo format.
--
http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-
PDF-tp31105999p31105999.html Sent from the FOP - Users mailing list
archive at Nabble.com.
---------------------------------------------------------------------
---------------------------------------------------------------------
--
http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-PDF-tp31105999p31106656.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
---------------------------------------------------------------------
--
View this message in context: http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-PDF-tp31105999p31106816.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
Eric Douglas
2011-03-09 14:42:31 UTC
Permalink
That error means exactly what it says. The file you're passing with the -xsl parameter is incorrect. It's not xslfo.
Your xsl file is designed for viewing xml in a browser, not for transforming xml into a document.
HTML xsl (http://www.w3schools.com/xsl/default.asp)
Xslfo (http://www.w3schools.com/xslfo/xslfo_documents.asp)

That xslfo page shows how to create the fo which would be the xsl combined with xml, as it doesn't have the stylesheet tag.
The file FOP is looking for on the -xsl parameter is the combination of those, with the stylesheet tag and the fo:root tag.
The FO tutorials explain how you can mix the xsl and fo together (http://www.w3schools.com/xslfo/xslfo_xslt.asp).

-----Original Message-----
From: italocardwell [mailto:***@gmail.com]
Sent: Wednesday, March 09, 2011 9:26 AM
To: fop-***@xmlgraphics.apache.org
Subject: RE: Apache FOP Newbie needs Help Converting XML to PDF


Sorry the -xm was a fat finger. I was using -xml and even if I change the file name to test it still produces the same error. Complete error below.

SEVERE: Exception
javax.xml.transform.TransformerException:
org.apache.fop.fo.ValidationException:
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 do cument.
Post by Eric Douglas
-xm? Try -xml?
Then take the dashes out of your file name, or try putting it in quotes.
-----Original Message-----
Sent: Wednesday, March 09, 2011 9:10 AM
Subject: Re: Apache FOP Newbie needs Help Converting XML to PDF
I was using
fop -xm la91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
-xsl ccr.xsl -pdf test.pdf
Post by Peter Hancock
Hi,
Can you tell us exactly which files you are using when you invoke fop, please.
Your command should look something like fop -xml foo.xml -xsl foo.xsl
-pdf foo.pdf judging by the files you have attached.
I am guessing you missed out the -xml/-xsl flags, leading FOP to
believe you were supplying an FO file.
When an XML and XSL files are supplied, FOP will perform an XSLT
transform using the Xalan XSLT Xalan library (I am guessing you will
need to know more about this stage in your project), generating the
FO document stream that is then processed to generate the output in
XML + XSL -> [XSLT transformer] -> FO -> [XSL:FO processor] -> PDF
This initial stage just saves on from having to do the transform first.
I hope this info helps,
Peter
On Wed, Mar 9, 2011 at 12:43 PM, italocardwell
Ill be upfront I know nothing about XML.  I am a SQL developer and I
have a project where I need to convert XML files to a PDF.  The XML
are going to be the same format every time with different data in
them.  I am wanting to use apache fop 1.0 at the command line to
convert these.  I am getting an error every time that I attempt to
do this.  I will attach the files and the error.  Would someone
please help me out.  Thanks.
http://old.nabble.com/file/p31105999/a91ec9d3-e021-4e5e-933f-54992cd
c
415c.20110308172937.xml
a91ec9d3-e021-4e5e-933f-54992cdc415c.20110308172937.xml
http://old.nabble.com/file/p31105999/ccr.xsl ccr.xsl
http://old.nabble.com/file/p31105999/date.format-date.template.xsl
date.format-date.template.xsl
http://old.nabble.com/file/p31105999/str.padding.template.xsl
str.padding.template.xsl
The error that I get states that fo needs to be in xml-fo format.
--
http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to
- PDF-tp31105999p31105999.html Sent from the FOP - Users mailing
list archive at Nabble.com.
--------------------------------------------------------------------
---------------------------------------------------------------------
--
http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-P
DF-tp31105999p31106656.html Sent from the FOP - Users mailing list
archive at Nabble.com.
---------------------------------------------------------------------
---------------------------------------------------------------------
--
View this message in context: http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-PDF-tp31105999p31106816.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-***@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-***@xmlgraphics.apache.org
Oscar Schoof
2011-03-09 15:43:03 UTC
Permalink
Your ccr.xsl is not producing fo, but html. Maybe that's the problem.

Oscar
italocardwell
2011-03-09 16:41:49 UTC
Permalink
Thanks everyone for helping me out. I do appologize for being a moron with
this stuff. Is there any way to convert my xsl file to a xslfo file so that
it can be used? Or will it have to be completely re-created?
Post by Oscar Schoof
Your ccr.xsl is not producing fo, but html. Maybe that's the problem.
Oscar
--
View this message in context: http://old.nabble.com/Apache-FOP-Newbie-needs-Help-Converting-XML-to-PDF-tp31105999p31108052.html
Sent from the FOP - Users mailing list archive at Nabble.com.
Christopher R. Maden
2011-03-09 16:46:55 UTC
Permalink
Post by italocardwell
Thanks everyone for helping me out. I do appologize for being a
moron with this stuff. Is there any way to convert my xsl file to a
xslfo file so that it can be used? Or will it have to be completely
re-created?
XSLT is a transformation language that turns one kind of XML into
another. XHTML is one kind of XML; XSL-FO is a completely different
kind of XML.

Since you said you were a SQL guy, think of XSLT as like a report generator.

If you have a report that lists employees by ID with their SSNs and
salaries, and you instead need a report that lists employees by
department and last name with salaries and managers, you’re going to
need to write a new report.

~Chris
- --
Chris Maden, text nerd <URL: http://crism.maden.org/ >
“Those in power write the history, while those who suffer
write the songs.” — Frank Harte
GnuPG Fingerprint: C6E4 E2A9 C9F8 71AC 9724 CAA3 19F8 6677 0077 C319
Oscar Schoof
2011-03-09 17:29:42 UTC
Permalink
For what it's worth: there exists html to fo convertors. For example:
http://html2fo.sourceforge.net/

Oscar
Post by Christopher R. Maden
XSLT is a transformation language that turns one kind of XML into
another. XHTML is one kind of XML; XSL-FO is a completely different
kind of XML.
Loading...