Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to learn how to use fop. My end goal is to be able to produce a pdf (table output) using results from a sql query. From what I've read, an xml doc must be converted to xsl. Then a stylesheet applied. Then run fop. Can someone offer advice on generating a pdf with tabular layout using the results of a mysql query? Or any advise on using fop? Some questions I have are: 1) What format needs to be used when generating the initial xml doc? 2) What are the stylesheets and how can they be generated?

Replies are listed 'Best First'.
Re: Help getting started with fop
by holli (Abbot) on Dec 20, 2007 at 21:25 UTC
    You don't have to use XSLT (iiek!) at all to use FOP. I have good experience with generating the FO code directly via a templating system. It just makes no sense to output XML, just to let some XSLT transform it afterwards (unless you have another use for the xml of course).

    1) What format needs to be used when generating the initial xml doc?
    None. It's the point of XSLT that you can (theoretically) transform every xml into every other xml.

    2) What are the stylesheets and how can they be generated?
    (XSLT) stylesheets are transformation rules, that are used to transform xml from one format to another. You generate them using an editor or a transformation tool. Afaik, there is no such tool for free. Those I know of are really, really expensive. XSLT is also very ugly and VERY talkative. If you dont really have to use it: avoid it.


    holli, /regexed monk/
      Thanks for the info. Can you recommend an existing perl module for such a task? I have been reading about XML::ApacheFOP.
Re: Help getting started with fop
by jasonk (Parson) on Dec 20, 2007 at 21:05 UTC

    My advice, try the fop mailing lists, or their FAQ, or the fop website, or somewhere where the question is at least remotely on-topic.


    We're not surrounded, we're in a target-rich environment!