D. Integrating MathML with document types other than DocBook 5, DITA Topic and XHTML 5


Normal users are not supposed to do this. The intended audience for this appendix is consultants and local gurus.

What follows is a description of what has been done to integrate MathML with DocBook 5. Integrating MathML with other document types should be very similar.

  1. File mathml_addon_install_dir/docbook5/mathml_support.incl contains these additional configuration elements in XMLmind XML Editor - Configuration and Deployment:

    <configuration xmlns="http://www.xmlmind.com/xmleditor/schema/configuration"
      <validate namespace="http://www.w3.org/1998/Math/MathML">1
        <relaxng location="../common_rng/mathml2.rng" />
      <include location="../common/mathml.incl" />2
      Extend the DocBook menu and toolbar here
      <elementTemplate name="mathml">3
        <equation xmlns="http://docbook.org/ns/docbook">
          <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"


    Dynamically merge the RELAX NG schema of MathML presentation markup (mathml2.rng) with the stock RELAX NG schema of DocBook 5 (docbook.rng). See below.


    Include the MathML configuration.


    Among other extensions, specify one or more templates for elements embedding MathML elements.

    [Note]How the MathML schema is dynamically merged with the DocBook 5 schema
    1. The RELAX NG schema of DocBook 5 is declared in the stock DocBook 5 configuration XXE_install_dir/addon/config/docbook5/docbook5.xxe.

      <relaxng location="rng/V5.0/docbook.rng" />
    2. The validate configuration element allows to merge one or more auxiliary DTDs or schemas to the main DTD or schema.

      <validate namespace="http://www.w3.org/1998/Math/MathML">
        <relaxng location="../common_rng/mathml2.rng" />

    You'll find:

    • the W3C XML Schema for MathML (both presentation and content markup) in mathml_addon_install_dir/standalone/xsd/mathml2.xsd,

    • the RELAX NG schema for MathML (presentation markup only) in mathml_addon_install_dir/common_rng/mathml2.rng,

    • the RELAX NG schema Compact Syntax for MathML (presentation markup only) in mathml_addon_install_dir/common/pane/mathml2.rnc.

      Both mathml2.rng and mathml2.rnc have been translated from the MathML DTD using trang[10].

    However nothing forces you to merge schemas of the same kind. More information in XMLmind XML Editor - Configuration and Deployment.

  2. The above file is referenced in the stock DocBook 5 configuration (XXE_install_dir/addon/config/docbook5/docbook5.xxe) as follows:

    <!-- Do not report an error if the "MathML support" add-on 
         has not been installed. -->
    <include location="---1mathml-config:docbook5/mathml_support.incl2" />


    The "---" prefix before an URL instructs XXE to silently skip the inclusion when the URL cannot be successfully resolved.


    URL mathml-config:docbook5/mathml_support.incl resolves to mathml_addon_install_dir/docbook5/mathml_support.incl because XML catalog mathml_addon_install_dir/mathml_catalog.xml contains the following rule:

    <rewriteURI uriStartString="mathml-config:" rewritePrefix="." />
  3. File mathml_addon_install_dir/docbook5/mathml_support.imp contains the following additional CSS rules:

    @import url(../common/mathml.css);1
    @namespace db5 "http://docbook.org/ns/docbook";
    db5|inlineequation > mml|math,
    db5|informalequation > mml|math,
    db5|equation > mml|math {
        content: "";


    Import the CSS stylesheet for MathML elements.


    Suppress the generated content normally used to style the imagedata, inlineequation, etc, DocBook 5 elements.

  4. The above file is referenced in the stock DocBook 5 CSS stylesheet (XXE_install_dir/addon/config/docbook5/css/docbook5.css) as follows:

    /* Do not report an error if the "MathML support" add-on 
       has not been installed. */
    @import url(---mathml-config:docbook5/mathml_support.imp);

[10] Multi-format schema converter based on RELAX NG.