This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: Including MathML equations
- From: Bob Stayton <bobs at caldera dot com>
- To: "kangoo at tiscali dot fr" <kangoo at tiscali dot fr>,"docbook-apps at lists dot oasis-open dot org" <docbook-apps at lists dot oasis-open dot org>
- Date: Wed, 24 Jul 2002 14:39:37 -0700
- Subject: Re: DOCBOOK-APPS: Including MathML equations
- References: <GZQYMY$F79C65554A538383413A98F07A324C51@tiscali.fr>
On Wed, Jul 24, 2002 at 11:35:22AM +0200, kangoo@tiscali.fr wrote:
> Hi,
>
> I have problems including MathML equations my doc. Here
> is the problem.
>
> I have a source XML file. I use an XSL file to transform
> it into a DocBook document. I also have anoter file with
> an equation (to have a separate file is a requirement!)
> which I wish to include in my DocBook document through
> the XSLT transformation. I wish to include a DOCTYPE to
> the MathML ref in the MathML document which seems to be
> necessary because of certain symboles : &sum, etc. and I
> wish to use a specific namespace : 'm' instead of 'mml'.
> Could anyone help me please.
I think I understand what you are trying to do.
You can't use system entities if you want your math
file to include a doctype for editing purposes.
But you can use xinclude.
You could have your first XSL transform your source
file to produce the following output in your generated Docbook
document at the point where you want the math to appear:
<xi:include href="math.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
The math.xml file can look something like this:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE m:math PUBLIC "-//W3C//DTD MathML 2.0//EN"
"http://www.w3.org/TR/MathML2/dtd/mathml2.dtd" [
<!ENTITY % MATHML.prefixed "INCLUDE">
<!ENTITY % MATHML.prefix "m">
]>
<m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
<m:mrow>
<m:mrow>
<m:msup>
<m:mi>x</m:mi>
<m:mn>2</m:mn>
</m:msup>
<m:mo>+</m:mo>
<m:mrow>
<m:mn>4</m:mn>
<m:mo>⁢</m:mo>
<m:mi>x</m:mi>
</m:mrow>
<m:mo>+</m:mo>
<m:mn>4</m:mn>
</m:mrow>
<m:mo>=</m:mo>
<m:mn>0</m:mn>
<m:mo>=</m:mo>
<m:mn>0</m:mn>
</m:mrow>
</m:math>
Then process the file using xsltproc with the --xinclude
option:
xsltproc --xinclude ../docbook-xsl-1.52.2/xhtml/docbook.xsl generated.xml
Or use fo/docbook.xsl for print output.
The DocBook stylesheets will pass the math through.
The resulting xhtml file will include:
<m:math xmlns:m="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<m:mrow>
<m:mrow>
<m:msup>
<m:mi>x</m:mi>
<m:mn>2</m:mn>
</m:msup>
<m:mo>+</m:mo>
<m:mrow>
...
What happens to it then depends on your browser or FO processor.
--
Bob Stayton 400 Encinal Street
Publications Architect Santa Cruz, CA 95060
Technical Publications voice: (831) 427-7796
Caldera International, Inc. fax: (831) 429-1887
email: bobs@caldera.com