OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: Re: DOCBOOK-APPS: Including MathML equations


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>&InvisibleTimes;</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


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC