You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by "Ismaeil, Sameh Z" <sa...@eds.com> on 2002/04/30 16:36:31 UTC
Building a FO document with FOP
Hello All,
We are trying to build FO documents through Java code, these documents will
be rendered with FOP. I would like to know whether it is recommended to
build them using the FOP classes that represent FO elements (FONode/FObj and
its decendants), or whether it is better to build them as XML docuemnts and
use FOP for rendering only.
Thanks in advance
Re: Building a FO document with FOP
Posted by David Penton <dj...@arrowsash.com>.
I'm chiming in late; you've probably already made your decision.
I have been doing lots of work generating fo through fop, and also XEP,
with data extracted from a database. I always use xsl stylesheets, but
I do the entire process internally in java, except for the FOP run
itself. There are several points in my processing flow which could be
handled by writing data to intermediate files external to my java app,
but I don't do it that way. My flow is this: I use jdbc, which feeds a
java class that acts like an xml parser, and implements SAX2. I create
a JAXP SAXSource using this fake "parser" class, and using the JAXP API,
I transform the incoming data in my java app using a reusable model of
the transform (javax.xml.transform.Templates). The result is serialized
to disk as xsl-fo.
Additionally, there ways other than JAXP; i.e. one can create compiled
xslt stylesheets in java.
Because it is possible to do everything "inside java" using this
approach, even it also uses xslt, my experience is that it is not easy
to make a good case for generating xsl-fo directly. That is necessarily
true, but the thing that should usually drive the choice is not, for
example, whether you already have xml data as input to the whole
process. It is, I believe, more of a question of whether xslt is
appropriate from an algorithmic point of view. There are some things
that are brutally difficult and inefficient to do using xslt. If you
have the kind of problem that is not particularly amenable to functional
programming tree transformation solutions, maybe you need to create
xsl-fo some other way in java.
Otherwise, the rapidity of development using java + xslt (in a way that
is 'within java' anyway) is to good to pass up, at least for my database
applications, and despite the fact that my input data is not xml.
- Dave P. -
Ismaeil, Sameh Z wrote:
>Hello All,
>
>We are trying to build FO documents through Java code,
>
<snip...>
>
>
>Thanks in advance
>
>