Re: Calabash, pass in the stylesheet path on command line?

On Wednesday 04 February 2009 12:48, Norman Walsh wrote:
> Off the top of my head:
[. . . ]

Thank you! 

I made a few adjustments and it works. Very nice. 

So as to get it into this mailing list's archive for others who might 
want a simple solution for producing PDF using Calabash + FOP, the 
following worked for me, shell script and exact command line included 
(Could someone please post an XProc pipeline XML for Calabash using 
XEP?): 

<p:declare-step name="main" xmlns:p="http://www.w3.org/ns/xproc">
   <p:input port="source"/>
   <p:output port="result"/>
   <p:input port="parameters" kind="parameter"/>
   <p:option name="stylesheet" required="true"/>
   <p:load name="userstyle">
	 <p:with-option name="href" select="$stylesheet"/>
   </p:load>
   <p:xslt>
	 <p:input port="source">
	   <p:pipe step="main" port="source"/>
	 </p:input>
	 <p:input port="stylesheet">
	   <p:pipe step="userstyle" port="result"/>
	 </p:input>
   </p:xslt>
</p:declare-step>


<!--
    Call Calabash and feed to it on the command line, the name/path of 
    the input XML file, the name/path of the output FO file, the
   name/path of a file containing the above Xproc XML intsructions, and
   the name/path of the XSL customization layer to use.

    Something like:

        ./runcalabash.sh -isource=xmlFile.xml -oresult=foFile.fo \
        simple_pipe.xpl.xml stylesheet=cust_layer.xsl

    or

        ./runcalabash.sh -isource=xmlFile.xml -oresult=foFile.fo \
        simple_pipe.xpl.xml \
     stylesheet=file:///C:/DocBook/XML/docbook-xsl-1.74-0/fo/docbook.xsl

    The runcalabash.sh script could be as follows:

    #!/bin/bash
    #
    # This bit of intelligence is from one of Dave Pawson's websites.
    #
    if [ $# -lt 1  ]
      then
        echo usage "$0 params"
        echo Where params are the calabash parameters
      exit 2

    fi

#
# The classpath is all set for if/when Calabash uses FOP.
#

java -cp "C:\xml-commons-resolver-1.1\resolver.jar; \
C:\xml-commons-resolver-1.1; \
C:\calabash-0.9.3\lib\calabash.jar; \
C:\Saxon91\saxon9.jar; \
C:\Saxon91\saxon9-s9api.jar; \
C:\fop-0.95\build\fop.jar; \
C:\fop-0.95\lib\avalon-framework-4.2.0.jar; \
C:\fop-0.95\lib\batik-all-1.7.jar; \
C:\fop-0.95\lib\commons-io-1.3.1.jar; \
C:\fop-0.95\lib\commons-logging-1.0.4.jar; \
C:\fop-0.95\lib\fop-hyph.jar; \
C:\fop-0.95\lib\jai_core.jar; \
C:\fop-0.95\lib\jai_codec.jar; \
C:\fop-0.95\lib\serializer-2.7.0.jar; \
C:\fop-0.95\lib\xalan-2.7.0.jar; \
C:\fop-0.95\lib\xercesImpl-2.7.1.jar; \
C:\fop-0.95\lib\xml-apis-1.3.04.jar; \
C:\fop-0.95\lib\xml-apis-ext-1.3.04.jar; \
C:\fop-0.95\lib\xmlgraphics-commons-1.3.1.jar; \
C:\RenderX\XEP\lib\xep.jar" \
com.xmlcalabash.drivers.Main -d \ 
-E org.apache.xml.resolver.tools.CatalogResolver \ 
-U org.apache.xml.resolver.tools.CatalogResolver $*

java -Xmx384m -Xss512k \
-cp "C:\fop-0.95\build\fop.jar; \
C:\fop-0.95\lib\avalon-framework-4.2.0.jar; \
C:\fop-0.95\lib\batik-all-1.7.jar; \
C:\fop-0.95\lib\commons-io-1.3.1.jar; \
C:\fop-0.95\lib\commons-logging-1.0.4.jar; \
C:\fop-0.95\lib\fop-hyph.jar; \
C:\fop-0.95\lib\jai_core.jar; \
C:\fop-0.95\lib\jai_codec.jar; \
C:\fop-0.95\lib\serializer-2.7.0.jar; \
C:\fop-0.95\lib\xalan-2.7.0.jar; \
C:\fop-0.95\lib\xercesImpl-2.7.1.jar; \
C:\fop-0.95\lib\xml-apis-1.3.04.jar; \
C:\fop-0.95\lib\xml-apis-ext-1.3.04.jar; \
C:\fop-0.95\lib\xmlgraphics-commons-1.3.1.jar" \ 
org.apache.fop.cli.Main \
-v -c "C:\fop-0.95\conf\fop.xconf.xml" \ 
-fo foFile.fo -pdf pdfFile.pdf

Received on Thursday, 5 February 2009 07:00:05 UTC