I've been using the Apache FOP http://xmlgraphics.apache.org/fop/ to transform XSL:FO into PDF's. FOP works well enough for some DocBook processing, but it can't handle really complex stuff gracefully.

Can we also use this XSL:FO technology for producing PDF form letters as part of a Customer Relationship Management solution? Is FOP suitable?

XSL:FO Products

A very complete list is available at XMLSoftware.com http://www.xmlsoftware.com/xslfo.html.

The core list of tools include the following:

A nice comparison between the market-leaders XEP and XSL Formatter is available at XSLT.com http://www.xslt.com/html/xsl-list/2002-04/msg00227.html.

Beyond these tools, Altova has a product http://www.altova.com/dev_portal_xslfo.html%22%20target=%22NewWindow to help design the XSL that controls document production.

Finally, a partial solution is iText http://www.lowagie.com/iText, which is a set of Java libraries that create PDF's.

Personally, I would prefer to use something like ReportLab Toolkit http://www.reportlab.org/, but the customer will likely balk at anything non-Java. Indeed, between Python, Cheetah and ReportLab, I think I'd be done with a solution, rather than still studying the problem.

Additional Thoughts. The real question, however, is why XSL:FO? There are lots of products that produce PDF files. We have to look at the real purpose behind the task. For converting DocBook files, the stylesheets and XSL:FO components fit into a very nice processing pipeline that is driven by Xalan.

However, in the case of Customer Relationship Management, we are using an application to do "mail-merge" processing, combining a template letter with details extracted from the database. We can imagine two families of architectures for this:

Minimal Markup. In this case, either no markup or a home-brewed minimal markup language are used. This has the advantage of minimizing knowledge of XSL:FO.

  1. Custom software, using iText or similar, that has the letter template encoded in the application. This is simple, but quite inflexible.
  2. Custom software, using iText or similar, that has the letter template in some home-brewed markup language. It reads the template and the data, merges the data in and produces PDF output. In this case, much of the formatting information is either implied or encoded in the home-brewed markup language.

Existing Markup. In this case, existing markup languages are leveraged.

  1. Template processing. Use an existing template engine (Velocity, Cheetah or similar) that uses a letter template in a meta-markup language. This produces XSL:FO output that can then be processed by any of the XSL:FO tools.
  2. XSL processing. Use Xalan to transform the source details into individual letters using an XSL template for the letter. This produces XSL:FO output that can then be processed by any of the XSL:FO tools.

Adobe has products that handle all of this, but they can be expensive. The Minimal Markup solutions involve some programming, but it is the kind of inflexible programming that makes every minor change to the template a huge cost and expense. The Existing Markup solutions involve considerable learning, but also mean that letter changes are handled by someone who knows the template language and the XSL:FO markup language.

The knowledge of XSL:FO can be minimized with clever use of the Cheetah or Velocity templates.