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







Reply via email to