Search code examples
apache-fopxproc

Calabash 1.0.23 throws on xsl-formatter step: ERROR: Failed to instantiate FO provider


I'm trying to use XML Calabash 1.0.23 to run XSLT transformation and FO formatting in a single pipeline. Although the XSLT step works fine, I cannot get the xsl-formatter step to work with FOP.

Every time I run the pipeline, Calabash throws:

ERROR: pipeline.xpl:13:68:Failed to instantiate FO provider
ERROR: Underlying exception: org/apache/fop/apps/FopFactory

My call to Calabash from the command line is:

java com.xmlcalabash.drivers.Main -c cfg.xml myPipeline.xpl

And the cfg.xml configuration file being referred to in the above line is:

<cc:xproc-config xmlns:cc="http://xmlcalabash.com/ns/configuration">
  <cc:fo-processor class-name="com.xmlcalabash.util.FoFOP"/>
</cc:xproc-config>

For some reason, Calabash seems to ignore the config file setting, because regardless of the value of the class-name attribute on <cc:fo-processor>, it always throws the same error message. For example, if I use com.xmlcalabash.util.FoAH, the same happens; and if put a nonsensical value, the same occurs. It's always an exception on org/apache/fop/apps/FopFactory.

Just for the sake of completeness, this is my XPL:

<declare-step name="main" version="1.0" xmlns="http://www.w3.org/ns/xproc">
  <input port="parameters" kind="parameter" />
  <xslt name="transformation">
    <input port="source">
      <document href="myMarkup.xml" />
    </input>
    <input port="stylesheet">
      <document href="myStylesheet.xsl" />
    </input>
  </xslt>
  <xsl-formatter href="newDoc.pdf" >
    <input port="source">
      <pipe step="transformation" port="result" />
    </input>
  </xsl-formatter>
</declare-step>

Of course, if I manually pass the generated FO from the XSLT step to FOP 1.1, it converts it to PDF with no problems. The issue only arises when trying to do the conversion within the pipeline.

I could really use some help to solve this. I'm clueless at this point.


Solution

  • This may seem like a very pedantic reply, but do you have fop.jar (and fop-hyph.jar, which I think FOP requires) on your classpath? They're not bundled in the XML Calabash distribution, you have to get them from Apache.