You need to use the FOP plugin from JEuclid (JEuclid.sf.net).  This will 
convert the MathML to FOP.
 
I will usually have all my MathML in separate files and then xinclude  them.
 
    <equation align="center"><title>Here is a  nice centered 
equation</title>
<xi:include xmlns:xi="_http://www.w3.org/2001/XInclude_ 
(http://www.w3.org/2001/XInclude) "  href="met-Math-template.xml"  />
</equation>

The MathML support can be a little "touchy" but once its working, its  
pretty solid.
 
Regards
Dean Nelson
 
 
In a message dated 7/11/2012 6:57:23 A.M. Pacific Daylight Time,  
[email protected] writes:

Is  there any single way to use the same method for generating PDFs? 
(instead of  HTML)

I modified the method described earlier to generate PDF files  with MathML 
equations, but I didn't succeed.

Attempt  one:
    *   I just changed the import href link from HTML to FO
Content of the transformation XSL file:  (PDF_MathML.xsl)
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet  version="1.0" 
xmlns:xsl="_http://www.w3.org/1999/XSL/Transform_ 
(http://www.w3.org/1999/XSL/Transform) ">

<xsl:import  href="./docbook-xsl-1.77.1/fo/docbook.xsl"/>  

<xsl:output method="html" encoding="utf-8"  indent="yes" />

<xsl:template  match="inlineequation | equation | informalequation">  

<xsl:variable name="id"  select="@id"/>

<xsl:variable name="mathml" select="concat('math/',$id, '.math')"/>  

<xsl:apply-templates  select="document($mathml,.)/*"/>
</xsl:template>

</xsl:stylesheet>

I used  Apache-FOP on Windows:
fop.bat -c conf/fop.xconf -xml  DSP_korrekted_2_abrak.xml -xsl 
PDF_MathML.xsl -param body.font.family  Times-Roman -param title.font.family 
Times-Roman 
-pdf manual.pdf

It  gave me some errors related to missing fo: namespace. (or maybe root? I 
cant  remember well)

Attempt two:
    *   I modified the fo/math.xsl file, and included the following  lines:

<xsl:template match="inlineequation | equation |  informalequation">
<xsl:variable name="id"  select="@id"/>
<xsl:variable name="mathml"  select="concat('math/',$id, '.math')"/>
<xsl:apply-templates  select="document($mathml,.)/*"/>
</xsl:template>

It  gave me a bunch of MathML-related warnings:
    *   WARNING: Unknown formatting object 
"{_http://www.w3.org/1998/Math/MathML_ (http://www.w3.org/1998/Math/MathML) }  
etc. etc. 
And then a bunch of MathML files not found:
    *   WARNING: Page xxiv: Unresolved ID reference "Eq_1096" found.
Ideas appreciated

2012/6/28 Zoltán János Jánosi <[email protected]_ 
(mailto:[email protected]) >

Here is the result of "dynamically include MathML files  with the help of 
XSLT when generating HTML files":

Test  setup:
    *   DocBook v4.4 files with equation, inlineequation and 
informalequation  tags, where every equatin has an id
    *   MathML files has the same name as the equations id's  
    *   DocBook XSLT files v1.77.1 
(_http://sourceforge.net/projects/docbook/files/docbook-xsl/1.77.1/docbook-xsl-1.77.1.zip/download_
 
(http://sourceforge.net/projects/docbook/files/docbook-xsl/1.77.1/docbook-xsl-1.77.1.zip/down
load) )

Content of the transformation XSL file: 
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet  version="1.0" 
xmlns:xsl="_http://www.w3.org/1999/XSL/Transform_ 
(http://www.w3.org/1999/XSL/Transform) ">

<xsl:import  href="./docbook-xsl-1.77.1/html/docbook.xsl"/>  

<xsl:output method="html" encoding="utf-8"  indent="yes" />

<xsl:template  match="inlineequation | equation | informalequation">  

<xsl:variable name="id"  select="@id"/>

<xsl:variable name="mathml" select="concat('math/',$id, '.math')"/>  

<xsl:apply-templates  select="document($mathml,.)/*"/>
</xsl:template>

</xsl:stylesheet>  
I used Saxon 6.5.5 
(_http://sourceforge.net/projects/saxon/files/saxon6/6.5.5/saxon6-5-5.zip/download_
 
(http://sourceforge.net/projects/saxon/files/saxon6/6.5.5/saxon6-5-5.zip/download)
 )  as an XSLT 1.0 processor. (XSLT 2.0 
processors gave errors with DocBook  v1.77.1) 
The following command was used: 
java -jar saxon.jar -o output.html DSP_DocBook_v44_v0.45.xml  
HTML5_MathML.xsl 
The resulting html file contains the MathML equations and in FireFox they  
look great. 
This solution is not perfect (lacks differrences of equation types), but  
it works and is a good starting point for further  development.




Reply via email to