[oXygen-user] Configuring OT's FOP To Render MathML

Eliot Kimber ekimber at rsicms.com
Wed Jan 8 11:03:47 CST 2014


OK, final answer. It appears that all my problems were caused by the
serialization of <math> without the namespace declaration.

With that corrected, then simply putting the JEuclid jars in the fop/lib
dir is sufficient to get the equation rendering, as it should be. I tested
both a clean 1.8.M2 install and my previously-tested 1.6.3 install (I also
inspected the FOP-related Ant scripts in the PDF2 transform and there’s no
difference between them that would affect this).

So the lesson is make sure your FO files are really correct before
spending hours trying to track down a non-existent class path
configuration problem . . . .

Cheers,

Eliot
-- 
Eliot Kimber
Senior Solutions Architect
"Bringing Strategy, Content, and Technology Together"
Main: 512.554.9368
www.reallysi.com
www.rsuitecms.com




On 1/8/14, 10:20 AM, "Eliot Kimber" <ekimber at rsicms.com> wrote:

>I’ve gotten a little farther.
>
>I discovered that the FO generation process produces different results
>from run inside Oxygen than when run outside Oxygen using the libraries in
>the fop/lib dir. In particular, this bit of XSLT:
>
><math xmlns="http://www.w3.org/1998/Math/MathML"
>        >
>
>
>results in 
>
><math xmlns="http://www.w3.org/1998/Math/MathML"
>>
>
>In the FO instance produced from within Oxygen, but:
>
>
><math>
>
>When run outside Oxygen.
>
>That was causing FOP to fail to render the math even when the JEuclid
>libraries were in place. Correcting the XSLT to use a prefix on the <math>
>element solved that problem, but the question remains of why the XSLT
>serialization behavior is different between Oxygen and not-Oxygen (it
>implies that Oxygen is using a newer or fixed version of some library).
>
>I modified my local startCmd.sh as follows:
>
>#— Start of FOP stuff
># Classpath entries for FOP:
>NEW_CLASSPATH="$DITA_DIR/plugins/org.dita.pdf2/fop/build/fop.jar:$NEW_CLAS
>S
>PATH"
>
>DIRLIBS=$DITA_DIR/plugins/org.dita.pdf2/fop/lib/*.jar
>for i in ${DIRLIBS}
>do
>    # if the directory is empty, then it will return the input string
>    # this is stupid, so case for it
>    if [ "$i" != "${DIRLIBS}" ] ; then
>  NEW_CLASSPATH="$i"${pathSepChar}$NEW_CLASSPATH
>    fi
>done
>#— End of FOP stuff
>
>
>
>And with that class path, I can do this:
>
>ant -Dtranstype=pdf
>-Dargs.input=/Users/ekimber/workspace_40/temp/MathML-Test/MathML-Test.dita
>m
>ap "-Dretain.topic.fo=yes" "-Dclean.temp=no"
>
>
>And get an FOP-generated PDF with rendered equations.
>
>Cheers,
>
>E.
>
>-- 
>Eliot Kimber
>Senior Solutions Architect
>"Bringing Strategy, Content, and Technology Together"
>Main: 512.554.9368
>www.reallysi.com
>www.rsuitecms.com
>
>
>
>
>On 1/7/14, 5:04 AM, "Oxygen XML Editor Support" <support at oxygenxml.com>
>wrote:
>
>>Hi Eliot,
>>
>>The jar files that you added in the pdf2/fop/lib dir are not
>>automatically loaded by the ANT process started from command line. I
>>think that is true also for the PDF generation step (the FO -> PDF
>>transformation) performed by FOP, regardless how the transformation was
>>started. The JEuclid jar files have to be added to the classpath and
>>that is what the -lib parameters do in the Oxygen command that runs the
>>DITA transformation in the Oxygen application.
>>
>>FOP delegates MathML processing to JEuclid (which is a FOP plugin) if it
>>finds it in the classpath. If FOP does not find a FOP plugin for the
>>MathML content you get the error about unrecognized MathML markup.
>>JEuclid can handle inline MathML markup in the FO document exactly as
>>you have it (inside <fo:instream-foreign-object> elements) so you should
>>just add the two JEuclid jar files explicitly to the ANT classpath, for
>>example as -lib parameters to the Java command that starts the ANT
>>process.
>>
>>
>>Best regards,
>>Sorin
>>
>>http://www.oxygenxml.com
>>
>>
>>Eliot Kimber wrote:
>>> Using Oxygen 15.1 with the 1.6.3 OT with FOP 1.1 manually installed
>>>into
>>> the pdf2 plugin, and given DITA docs with MathML and a plugin that
>>>outputs
>>> the MathML as markup within fo:instream-foreign-object elements, if I
>>>run
>>> the OT PDF transform from within Oxygen, then FOP renders the MathML
>>> nicely.
>>> 
>>> If I run the same transform from the command line from within a
>>> startCmd.sh-created environment, e.g.:
>>> 
>>> bash-3.2$ ant -lib "/Applications/oxygen/lib/xml-apis.jar" -lib
>>> "/Applications/oxygen/lib/xercesImpl.jar" -lib
>>> "/Applications/oxygen/frameworks/dita/DITA-OT" -lib
>>> "/Applications/oxygen/lib/commons-io-1.3.1.jar" -lib
>>> "/Applications/oxygen/lib/commons-logging-1.1.1.jar" -lib
>>> "/Applications/oxygen/lib/log4j.jar" -lib
>>> "/Applications/oxygen/frameworks/dita/DITA-OT/lib/dost-patches.jar"
>>>-lib
>>> "/Applications/oxygen/frameworks/dita/DITA-OT/lib" -lib
>>> "/Applications/oxygen/frameworks/dita/DITA-OT/lib/dost.jar" -lib
>>> 
>>>"/Applications/oxygen/frameworks/dita/DITA-OT/lib/commons-codec-1.4.jar"
>>> -lib "/Applications/oxygen/lib/jing.jar" -lib
>>> "/Applications/oxygen/lib/saxon9ee.jar" -lib
>>> "/Applications/oxygen/lib/saxon.jar" -lib
>>> "/Applications/oxygen/lib/xmlgraphics-commons-1.5.jar" -lib
>>> "/Applications/oxygen/lib/fop.jar" -lib
>>> "/Applications/oxygen/lib/batik-all-1.7.jar" -lib
>>> "/Applications/oxygen/lib/xml-apis-ext.jar" -lib
>>> "/Applications/oxygen/lib/avalon-framework-4.2.0.jar" -lib
>>> "/Applications/oxygen/lib/jeuclid-core.jar" -lib
>>> "/Applications/oxygen/lib/jeuclid-fop.jar" -lib
>>> "/Applications/oxygen/lib/jh.jar" -lib
>>> "/Applications/oxygen/frameworks/dita/DITA-OT/lib/jsearch.jar" -lib
>>> "/Applications/oxygen/lib/lucene-analyzers-common-4.0.0.jar" -lib
>>> "/Applications/oxygen/lib/lucene-core-4.0.0.jar" -lib
>>> 
>>>"/Applications/oxygen/frameworks/dita/DITA-OT/plugins/com.oxygenxml.webh
>>>e
>>>lp
>>> /lib/xhtml-indexer.jar" -f
>>> "/Applications/oxygen/frameworks/dita/DITA-OT/build.xml"
>>> "-Dtranstype=pdf2"
>>> "-Dbasedir=/Users/ekimber/workspace_40/omics-plugin/temp/MathML-Test"
>>> 
>>>"-Doutput.dir=/Users/ekimber/workspace_40/omics-plugin/temp/MathML-Test/
>>>o
>>>ut
>>> /pdf" "-Dwebhelp.trial.license=no"
>>> 
>>>"-Ddita.temp.dir=/Users/ekimber/workspace_40/omics-plugin/temp/MathML-Te
>>>s
>>>t/
>>> temp/pdf" "-Dpdf.formatter=fop"
>>> "-Ddita.dir=/Applications/oxygen/frameworks/dita/DITA-OT"
>>> "-Dretain.topic.fo=yes" "-Dclean.temp=no" "-Dxep.failOnError=true"
>>> 
>>>"-Dargs.input=/Users/ekimber/workspace_40/omics-plugin/temp/MathML-Test/
>>>M
>>>at
>>> hML-Test.ditamap" "-DbaseJVMArgLine=-Xmx384m"
>>> 
>>> The process runs and I don’t get any FOP messages about the math, but
>>>the
>>> equations are not rendered.
>>> 
>>> 
>>> I noticed that Oxygen includes the jeuclid-core and jeuclid-fop jars
>>>and I
>>> tried copying those into the pdf2/fop/lib dir.
>>> 
>>> If I run the normal Toolkit process without the Oxygen-defined -lib
>>> options (meaning it’s using the class path defined by the startCmd.sh)
>>> then FOP complains about the MathML markup as being unrecognized, even
>>> with the JEuclid libraries present (which suggests that the Toolkit’s
>>>Ant
>>> process is not automatically loading the libraries).
>>> 
>>> Likewise, if I run the fop shell agains the FO file I get the same
>>>MathML
>>> complaints.
>>> 
>>> I verified that both the Oxygen-supplied FOP jar and the one in my OT
>>>are
>>> 1.1, e.g.:
>>> 
>>> contrext01:fop ekimber$ java -jar /Applications/oxygen/lib/fop.jar -v
>>> FOP Version 1.1
>>> 
>>> 
>>> contrext01:fop ekimber$ java -jar build/fop.jar -v
>>> FOP Version 1.1
>>> 
>>> 
>>> So I’m at a bit of a loss as to how Oxygen is getting the result I want
>>> and what I need to do to get that same result outside of Oxygen.
>>> 
>>> What am I missing?
>>> 
>>> Thanks,
>>> 
>>> Eliot
>>> 
>>> —————
>>> Eliot Kimber, Owner
>>> Contrext, LLC
>>> http://contrext.com
>>> 
>>> 
>>> _______________________________________________
>>> oXygen-user mailing list
>>> oXygen-user at oxygenxml.com
>>> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>



More information about the oXygen-user mailing list