1

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.

ARX
  • 1,040
  • 2
  • 14
  • 20

1 Answers1

1

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.

Norm
  • 866
  • 1
  • 7
  • 16
  • 1
    @Norman: Before using Calabash, I was manually using fop.bat, which was taking care of all settings. For Calabash, I did add fop.jar to the classpath, but didn't know I had to do the same for **all of FOP's library jars (all jars in the FOP lib directory)**. I assumed (wrongfully) that FOP's main class would handle that automatically. That created my confusion. Now it works normally. Thanks for the guidance. It led me in the right direction. – ARX Feb 08 '15 at 17:13