]> An XHTML + MathML + SVG Profile

An XHTML + MathML + SVG Profile

Personal Note 21 April 2002

This version:
http://www.w3.org/People/mimasa/test/schemas/NOTE-XHTMLplusMathMLplusSVG
$Id: NOTE-XHTMLplusMathMLplusSVG.xhtml,v 1.22 2002/04/21 11:48:42 mimasa Exp $
Latest version:
http://www.w3.org/MarkUp/Group/XHTMLplusMathMLplusSVG
Author:
石川 雅康 (Ishikawa Masayasu), W3C

Abstract

An XHTML+MathML+SVG profile is an experimental profile that combines XHTML 1.1 [XHTML11], MathML 2.0 [MathML2] and SVG 1.1 [SVG11] together. This profile enables mixing XHTML, MathML and SVG in the same document using XML Namespaces [XMLNS] mechanism, while allowing validation of such a mixed-namespace document. An experimental XHTML 1.1 + MathML 2.0 + SVG 1.1 DTD driver is provided. This document itself is conforming to this experimental DTD.

Status of This Document

This document is a Personal Note for your information only. This Note just describes the author's personal experiments, and doesn't represent the consensus of any of W3C Working Groups nor the W3C Membership. This document does not define the normative profile of XHTML + MathML + SVG. This is just "a" possible profile.

The primary purpose of this profile is to investigate the modularity of being-developed SVG 1.1 DTD modules, and figure out remaining problems. The DTD driver found in this document is informative only, and will contain errors (there are still known problems in SVG DTD modules). This is an early draft document and may or may not be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use this Note as reference material or to cite this as other than "personal experiments".

While the author welcomes comments on this document, author does not guarantee a reply or any further action. Comments on this document should be sent to the author.

Table of Contents


1.  Introduction

An XHTML+MathML+SVG profile integrates XHTML 1.1 [XHTML11], MathML 2.0 [MathML2] and SVG 1.1 [SVG11] together, using the XHTML Modularization Framework [XHTMLMOD]. This profile enables mixing XHTML, MathML and SVG in a same document using XML Namespaces [XMLNS] mechanism, while allowing validation of such a mixed-namespace document. An experimental XHTML 1.1 + MathML 2.0 + SVG 1.1 DTD driver is provided in section 2.1. The possibility of combining those modules written in XML Schema [XMLSchema] might be explored when XML Schemas for XHTML [XHTMLMODSchema] and others become available and mature.

This DTD driver can primarily be used for an XHTML document that contains MathML and SVG fragments, but it can also be used for an SVG document that contains XHTML and MathML fragments. An SVG fragment inside an XHTML document can contain another XHTML or MathML fragments, and that XHTML fragment can again contain another MathML or SVG fragments. There's no restriction on nesting levels.

Inside XHTML, MathML and SVG fragments are allowed basically anywhere inside the document body. Inside SVG, XHTML and MathML may be embedded through the 'foreignObject' element. A sample document shows features in XHTML 1.1 (ruby) and simple MathML and SVG examples, and a mixture of them using 'foreignObject' in the same document.

This DTD driver can also be used as a basis for defining other profiles that combine some or all of XHTML, MathML and SVG. How to define new profiles using this DTD driver is explained in section 4.

2.  XHTML 1.1 + MathML 2.0 + SVG 1.1 Document Type Definition

2.1.  XHTML 1.1 + MathML 2.0 + SVG 1.1 DTD Driver

This section contains the driver for an XHTML 1.1 + MathML 2.0 + SVG 1.1 profile implementation as an XML DTD. It relies upon XHTML module implementations defined in [XHTMLMOD] and in Ruby Annotation [Ruby], the XHTML 1.1 DTD implementation defined in [XHTML11], MathML DTD module implementations defined in [MathML2], and (being-developed) SVG DTD module implementations to be defined in [SVG11].

<!-- ....................................................................... -->
<!-- XHTML 1.1 plus MathML 2.0 plus SVG 1.1 DTD  ........................... -->
<!-- URI: http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd
-->

<!-- XHTML 1.1 plus MathML 2.0 plus SVG 1.1 DTD

     This is a prototype extension of XHTML 1.1 incorporating MathML 2.0
     and SVG 1.1.

     Copyright 2002 World Wide Web Consortium
        (Massachusetts Institute of Technology, Institut National de
         Recherche en Informatique et en Automatique, Keio University).
         All Rights Reserved.

     Permission to use, copy, modify and distribute this DTD and its
     accompanying documentation for any purpose and without fee is hereby
     granted in perpetuity, provided that the above copyright notice and 
     this paragraph appear in all copies.  The copyright holders make no
     representation about the suitability of the DTD for any purpose.

     It is provided "as is" without expressed or implied warranty.

        Editors:    Murray M. Altheim <altheim@eng.sun.com> (XHTML modules)
                    David Carlisle <davidc@nag.co.uk> (MathML modules)
                    Jun Fujisawa <fujisawa.jun@canon.co.jp> (SVG modules)
                    Masayasu Ishikawa <mimasa@w3.org> (DTD driver)
        Revision:   $Id: xhtml-math-svg.dtd,v 1.17 2002/04/21 11:34:56 mimasa Exp $

-->
<!-- This is the driver file for an XHTML 1.1 plus MathML 2.0 plus SVG 1.1 DTD.
-->

<!-- Switch to include/ignore each vocabulary.
-->
<!ENTITY % XHTML.module "INCLUDE" >
<!ENTITY % MATHML.module "INCLUDE" >
<!ENTITY % SVG.module "INCLUDE" >

<![%XHTML.module;[
<!ENTITY % XHTML.version
         "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" >
]]>

<!-- Use the following entities to identify the namespaces:
-->
<!ENTITY % XHTML.xmlns "http://www.w3.org/1999/xhtml" >
<!ENTITY % MATHML.xmlns "http://www.w3.org/1998/Math/MathML" >
<!ENTITY % MATHML.pref.xmlns "http://www.w3.org/2002/Math/preference" >
<!ENTITY % SVG.xmlns "http://www.w3.org/2000/svg" >
<!ENTITY % XLINK.xmlns "http://www.w3.org/1999/xlink" >

<!-- Declare base URIs for the relevant DTD modules.
-->
<!ENTITY % XHTML.sysid.base "http://www.w3.org/TR/xhtml-modularization/DTD/" >
<!ENTITY % MATHML.sysid.base "http://www.w3.org/TR/MathML2/dtd/" >
<!ENTITY % SVG.sysid.base "http://www.w3.org/Graphics/SVG/1.1/DTD/" >

<!-- Declare system identifiers for the relevant DTD modules.
-->
<!ENTITY % MATHML.qname.sysid "%MATHML.sysid.base;mathml2-qname-1.mod" >
<!ENTITY % XHTML.dtd.sysid "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" >
<!ENTITY % MATHML.dtd.sysid "%MATHML.sysid.base;mathml2.dtd" >
<!ENTITY % SVG.dtd.sysid "%SVG.sysid.base;svg11.dtd" >

<!-- See the XHTML / MathML / SVG Qualified Names modules for information
     on the use of namespace prefixes in the DTD.  Default values are
     as follows:

       <!ENTITY % NS.prefixed "IGNORE" >
       <!ENTITY % XHTML.prefixed "%NS.prefixed;" >
       <!ENTITY % XHTML.prefix  "" >
       <!ENTITY % MATHML.prefixed "%NS.prefixed;" >
       <!ENTITY % MATHML.prefix   "m" >
       <!ENTITY % MATHML.pref.prefixed "IGNORE" >
       <!ENTITY % MATHML.pref.prefix "pref" >
       <!ENTITY % SVG.prefixed "%NS.prefixed;" >
       <!ENTITY % SVG.prefix "" >
       <!ENTITY % XLINK.prefix "xlink" >

     In this DTD driver, XHTML and MathML are not prefixed, and SVG is
     prefixed by default.  It can be changed by redeclaring the above
     parameter entities.
-->
<!ENTITY % XHTML.prefixed "IGNORE" >
<!ENTITY % MATHML.prefixed "IGNORE" >
<!ENTITY % MATHML.prefix "m" >
<!ENTITY % MATHML.pref.prefixed "IGNORE" >
<!ENTITY % MATHML.pref.prefix "pref" >
<!ENTITY % SVG.prefixed "INCLUDE" >
<!ENTITY % SVG.prefix "svg" >
<!ENTITY % XLINK.prefix "xlink" >

<!-- a URI reference, see [URI] -->
<!ENTITY % URI.datatype "CDATA" >

<!-- Declare a parameter entity %XLINK.xmlns.attrib; containing
     the XML Namespace declarations for XLink.
-->
<!ENTITY % XLINK.xmlns.attrib
     "xmlns:%XLINK.prefix; %URI.datatype; #FIXED '%XLINK.xmlns;'"
>

<!-- Allow universal MathML stylesheet-related declarations.
     When it is used, it must always be prefixed.
-->
<![%MATHML.module;[
<![%MATHML.pref.prefixed;[
<!ENTITY % MATHML.pref.renderer.extra "">
<!ENTITY % MATHML.pref.renderer
     "css | mathplayer-dl | mathplayer | techexplorer-plugin | techexplorer">
<!ENTITY % MATHML.pref.xmlns.attrib
    "xmlns:%MATHML.pref.prefix; %URI.datatype; #FIXED '%MATHML.pref.xmlns;'
     %MATHML.pref.prefix;:renderer
     ( %MATHML.pref.renderer; %MATHML.pref.renderer.extra; ) #IMPLIED"
>
]]>
]]>
<!ENTITY % MATHML.pref.xmlns.attrib "" >

<!-- The parameter entities %SVG.xmlns.extra.attrib; and
     %XHTML.xmlns.extra.attrib; may be redeclared to contain
     any foreign namespace declaration attributes for namespaces
     embedded in XHTML+MathML+SVG. The default is an empty string.
-->
<!ENTITY % SVG.xmlns.extra.attrib "" >
<!ENTITY % XHTML.xmlns.extra.attrib "" >


<!-- Declare parameter entities to define XML Namespace declarations
     for SVG, XHTML and MathML.
-->
<![%SVG.module;[
<![%SVG.prefixed;[
<!ENTITY % SVG.xmlns.decl.attrib
    "xmlns:%SVG.prefix; %URI.datatype; #FIXED '%SVG.xmlns;'"
>
]]>
<!ENTITY % SVG.xmlns.decl.attrib
    "xmlns %URI.datatype; #FIXED '%SVG.xmlns;'"
>
]]>
<!ENTITY % SVG.xmlns.decl.attrib "" >

<![%XHTML.module;[
<![%XHTML.prefixed;[
<!ENTITY % XHTML.xmlns.decl.attrib
    "xmlns:%XHTML.prefix; %URI.datatype; #FIXED '%XHTML.xmlns;'"
>
]]>
<!ENTITY % XHTML.xmlns.decl.attrib
    "xmlns %URI.datatype; #FIXED '%XHTML.xmlns;'"
>
]]>
<!ENTITY % XHTML.xmlns.decl.attrib "" >

<![%MATHML.module;[
<![%MATHML.prefixed;[
<!ENTITY % MATHML.xmlns.decl.attrib
    "xmlns:%MATHML.prefix; %URI.datatype; #FIXED '%MATHML.xmlns;'"
>
]]>
<!ENTITY % MATHML.xmlns.decl.attrib
    "xmlns %URI.datatype; #FIXED '%MATHML.xmlns;'"
>
]]>
<!ENTITY % MATHML.xmlns.decl.attrib "" >

<!-- Declare "default" case for %NS.decl.attrib;
-->
<!ENTITY % NS.common.decl.attrib
    "%SVG.xmlns.decl.attrib;
     %XHTML.xmlns.decl.attrib;
     %MATHML.xmlns.decl.attrib;
     %XLINK.xmlns.attrib;
     %MATHML.pref.xmlns.attrib;
     %SVG.xmlns.extra.attrib;
     %XHTML.xmlns.extra.attrib;"
>

<!-- Redeclare a parameter entity %NS.decl.attrib; containing
     all XML Namespace declarations used in the DTD, its form
     dependent on whether prefixing is active.
-->
<![%SVG.prefixed;[
<![%XHTML.prefixed;[
<![%MATHML.prefixed;[
<!-- SVG, XHTML and MathML are all prefixed
-->
<!ENTITY % NS.decl.attrib
    "%NS.common.decl.attrib;"
>
]]>
<!-- SVG and XHTML are prefixed, MathML is not prefixed
-->
<!ENTITY % NS.decl.attrib
    "%NS.common.decl.attrib;"
>
]]>
<![%MATHML.prefixed;[
<!-- SVG and MathML are prefixed, XHTML is not prefixed
-->
<!ENTITY % NS.decl.attrib
    "%NS.common.decl.attrib;"
>
]]>
<!-- SVG is prefixed, XHTML and MathML are not prefixed
     MathML namespace must always be specified on the math element
-->
<!ENTITY % NS.decl.attrib
    "%SVG.xmlns.decl.attrib;
     %XHTML.xmlns.decl.attrib;
     %XLINK.xmlns.attrib;
     %MATHML.pref.xmlns.attrib;
     %SVG.xmlns.extra.attrib;
     %XHTML.xmlns.extra.attrib;"
>
]]>
<![%XHTML.prefixed;[
<![%MATHML.prefixed;[
<!-- SVG is not prefixed, XHTML and MathML are prefixed
-->
<!ENTITY % NS.decl.attrib
    "%NS.common.decl.attrib;"
>
]]>
<!-- SVG and MathML are not prefixed, which is not allowed
-->
<!ENTITY % NS.decl.attrib "" >
]]>
<!-- SVG, MathML and XHTML are all not prefixed, which is not allowed
-->
<!ENTITY % NS.decl.attrib "" >

<!-- Redeclare a parameter entities %SVG.xmlns.attrib; and 
     %XHTMLxmlns.attrib; containing all XML namespace declaration
     attributes used by XHTML+MathML+SVG, including a default xmlns
     attribute when prefixing is inactive.
-->
<![%SVG.module;[
<!ENTITY % SVG.xmlns.attrib
     "%NS.decl.attrib;"
>
]]>

<![%XHTML.module;[
<!ENTITY % XHTML.xmlns.attrib
     "%NS.decl.attrib;"
>
]]>

<!-- Redeclare a parameter entity %MATHML.xmlns.attrib; containing
     XLink namespace declaration attribute allowed on MathML elements.
     Unfortunately XLink prefix is hard-coded in the MathML 2.0 DTD,
     so it cannot be changed.
-->
<![%MATHML.module;[
<!ENTITY % MATHML.xmlns.extra.attrib 
     "xmlns:xlink %URI.datatype; #FIXED '%XLINK.xmlns;'
      %MATHML.pref.xmlns.attrib;"
>
]]>

<!-- Framework Redeclaration placeholders  ....................... -->

<![%XHTML.module;[
<!ENTITY % XHTML.redecl.module "INCLUDE" >
<![%XHTML.redecl.module;[
<!-- Pre-Framework Redeclaration placeholder  .................... -->
<!ENTITY % xhtml-prefw-redecl.mod "" >

<!-- Post-Framework Redeclaration placeholder  ................... -->
<!ENTITY % xhtml-postfw-redecl.mod "" >
]]>
]]>

<![%SVG.module;[
<!ENTITY % SVG.redecl.module "INCLUDE" >
<![%SVG.redecl.module;[
<!-- Pre-Framework Redeclaration placeholder ..................... -->
<!ENTITY % svg-prefw-redecl.mod "" >

<!-- Post-Framework Redeclaration placeholder .................... -->
<!ENTITY % svg-postfw-redecl.mod "" >
]]>
]]>

<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->

<![%MATHML.module;[
<!ENTITY % xhtml-qname-extra.decl
      'PUBLIC "-//W3C//ENTITIES MathML 2.0 Qualified Names 1.0//EN"
              "%MATHML.qname.sysid;"'
>
<!ENTITY % xhtml-qname-extra.mod 
      %xhtml-qname-extra.decl;
>
]]>

<!-- Redeclare location of math and svg contents in XHTML.
-->

<![%MATHML.module;[
<![%MATHML.prefixed;[
<!ENTITY % MATHML.pfx  "%MATHML.prefix;:" >
]]>
<!ENTITY % MATHML.pfx  "" >
<!ENTITY % math.qname           "%MATHML.pfx;math" >
<!ENTITY % MATHML.math.class
     "| %math.qname;" 
>
]]>
<!ENTITY % MATHML.math.class "" >

<![%SVG.module;[
<![%SVG.prefixed;[
<!ENTITY % SVG.pfx "%SVG.prefix;:" >
]]>
<!ENTITY % SVG.pfx "" >
<!ENTITY % SVG.svg.qname "%SVG.pfx;svg" >
<!ENTITY % SVG.svg.class
     "| %SVG.svg.qname;" 
>
]]>
<!ENTITY % SVG.svg.class "" >

<![%XHTML.module;[
<!ENTITY % Misc.extra 
     "%MATHML.math.class; %SVG.svg.class;" 
>
]]>

<!-- Redeclare SVG's foreignObject content (allow anything).
-->
<![%SVG.module;[
<!ENTITY % SVG.foreignObject.content "ANY" >
]]>

<!-- Instantiate SVG 1.1 DTD  .................................... -->
<![%SVG.module;[
<!ENTITY % SVG.dtd.decl
     'PUBLIC "-//W3C//DTD SVG 1.1//EN"
            "%SVG.dtd.sysid;"'
>
<!ENTITY % SVG.dtd %SVG.dtd.decl; >
%SVG.dtd;
]]>

<!-- Instantiate XHTML 1.1 DTD  .................................. -->
<![%XHTML.module;[
<!ENTITY % XHTML.dtd.decl
     'PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
            "%XHTML.dtd.sysid;"'
>
<!ENTITY % XHTML.dtd %XHTML.dtd.decl; >
%XHTML.dtd;
]]>

<!-- instantiate MathML 2.0 DTD  ................................. -->
<![%MATHML.module;[
<!ENTITY % MATHML.dtd.decl
     'PUBLIC "-//W3C//DTD MathML 2.0//EN"
            "%MATHML.dtd.sysid;"'
>
<!ENTITY % MATHML.dtd %MATHML.dtd.decl; >
%MATHML.dtd;
]]>

<!-- end of xhtml-math-svg.dtd -->

3.  How to use XHTML 1.1 + MathML 2.0 + SVG 1.1 DTD

As shown in the above DTD driver, a couple of parameter entities are prepared to switch on/off namespace prefixes and to change namespace prefixes arbitrary. The default values are as follows:

<!ENTITY % XHTML.prefixed "IGNORE" >
<!ENTITY % XHTML.prefix  "" >
<!ENTITY % MATHML.prefixed "IGNORE" >
<!ENTITY % MATHML.prefix   "m" >
<!ENTITY % SVG.prefixed "INCLUDE" >
<!ENTITY % SVG.prefix "svg" >
<!ENTITY % XLINK.prefix "xlink" >
%XHTML.prefixed;, %MATHML.prefixed;, %SVG.prefixed;

These parameter entities switch on/off namespace prefixing. Setting the value to 'INCLUDE' makes namespace prefixing on, and 'IGNORE' switches off namespace prefixing. By default, XHTML and MathML are not prefixed, and SVG is prefixed with 'svg:'.

Also check the limitation on name collisions.

%XHTML.prefix;, %MATHML.prefix;, %SVG.prefix;, %XLINK.prefix;

These parameter entities set namespace prefixes for relevant vocabularies. These values take effect only if relevant prefixing is enabled. The same prefix may not be used for different vocabularies. Note that XLink attributes must always be prefixed, so the value of %XLINK.prefix; must not be an empty string.

There are also parameter entities that define system identifiers for relevant DTD modules as follows:

<!ENTITY % XHTML.sysid.base "http://www.w3.org/TR/xhtml-modularization/DTD/" >
<!ENTITY % MATHML.sysid.base "http://www.w3.org/TR/MathML2/dtd/" >
<!ENTITY % SVG.sysid.base "http://www.w3.org/Graphics/SVG/1.1/DTD/" >

<!ENTITY % MATHML.qname.sysid "%MATHML.sysid.base;mathml2-qname-1.mod" >
<!ENTITY % XHTML.dtd.sysid "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" >
<!ENTITY % MATHML.dtd.sysid "%MATHML.sysid.base;mathml2.dtd" >
<!ENTITY % SVG.dtd.sysid "%SVG.sysid.base;svg11.dtd" >

When necessary, these parameter entities may be overridden to point to local copies of those DTD modules, e.g. for off-line authoring. Authors should not override these parameter entities when delivering the content.

3.1.  XHTML as the Host Language

If you want to use XHTML as the host language, this DTD driver may be typically invoked as follows:

<!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
    "http://www.w3.org/People/mimasa/test/schemas/DTD/xhtml-math-svg.dtd">

If necessary, you may change the above parameter entities as appropriate in the internal DTD subset. A typical document might look something like this:

<!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
    "http://www.w3.org/People/mimasa/test/schemas/DTD/xhtml-math-svg.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>XHTML as the host language</title>
  </head>
  <body>
    ... XHTML content ....
    <math xmlns="http://www.w3.org/1998/Math/MathML">
      ... MathML content ...
    </math>
    ... XHTML content ....
    <svg:svg version="1.1"
      xmlns="http://www.w3.org/2000/svg"
      xmlns:xlink="http://www.w3.org/1999/xlink">
      ... SVG content ...
      <svg:foreignObject ...>
        <p>
          ... XHTML content ....
          <math xmlns="http://www.w3.org/1998/Math/MathML">
            ... MathML content ...
          </math>
          ... XHTML content ....
        </p>
      </svg:foreignObject>
    </svg:svg>
  </body>
</html>

If MathML is not prefixed, the MathML namespace must always be declared on the 'math' element to avoid confusion of namespace defaulting with XHTML.

3.2.  SVG as the Host Language

If you want to use SVG as the host language, this DTD driver may be typically invoked as follows:

<!DOCTYPE svg:svg PUBLIC
    "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
    "http://www.w3.org/People/mimasa/test/schemas/DTD/xhtml-math-svg.dtd">

In this case SVG elements are still prefixed and XHTML and MathML elements are not prefixed. In order to make SVG elements non-prefixed, a typical document might look something like this:

<!DOCTYPE svg PUBLIC
    "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
    "http://www.w3.org/People/mimasa/test/schemas/DTD/xhtml-math-svg.dtd"[
<!ENTITY % SVG.prefixed "IGNORE" >
<!ENTITY % XHTML.prefixed "INCLUDE" >
<!ENTITY % XHTML.prefix "xhtml" >
<!ENTITY % MATHML.prefixed "INCLUDE" >
<!ENTITY % MATHML.prefix "math" >
]>
<svg version="1.1"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink">
  <desc>SVG as the host language</desc>
  ... SVG content ....
  <switch>
    <foreignObject width="..." height="..." ...>
      <xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml">
        ... XHTML content ....
        <math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
          ... MathML content ...
        </math:math>
        ... XHTML content ....
      </xhtml:p>
    </foreignObject>
  </switch>
  ... SVG content ....
</svg>

Note that the namespace declarations may be collectively declared on the root element, like:

<!DOCTYPE svg PUBLIC
    "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
    "http://www.w3.org/People/mimasa/test/schemas/DTD/xhtml-math-svg.dtd"[
<!ENTITY % SVG.prefixed "IGNORE" >
<!ENTITY % XHTML.prefixed "INCLUDE" >
<!ENTITY % XHTML.prefix "xhtml" >
<!ENTITY % MATHML.prefixed "INCLUDE" >
<!ENTITY % MATHML.prefix "math" >
]>
<svg version="1.1"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     xmlns:xhtml="http://www.w3.org/1999/xhtml"
     xmlns:math="http://www.w3.org/1998/Math/MathML">
  <desc>SVG as the host language</desc>
  ... SVG content ....
  <switch>
    <foreignObject width="..." height="..." ...>
      <xhtml:p>
        ... XHTML content ....
        <math:math>
          ... MathML content ...
        </math:math>
        ... XHTML content ....
      </xhtml:p> 
   </foreignObject>
  </switch>
  ... SVG content ....
</svg>

3.3.  Using MathML with Universal MathML stylesheet

When using MathML, authors may wish to use the "Universal MathML stylesheet" [MathML-XSL] to make it possible to be viewed on a large number of browsers. This DTD driver allows authors to use this stylesheet easily. This DTD driver includes the following parameter entities:

<!ENTITY % MATHML.pref.prefixed "IGNORE" >
<!ENTITY % MATHML.pref.prefix "pref" >

Authors may include an XML stylesheet processing instruction for the universal MathML stylesheet as explained in [MathML-XSL], and when they want to specify preferences for the MathML renderer, they may set the %MATHML.pref.prefixed; parameter entity to "INCLUDE". This allows authors to declare the MathML preferences namespace and use the 'renderer' attribute like this:

<?xml-stylesheet type="text/xsl" href="http://www.w3.org/Math/XSL/mathml.xsl"?>
<!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
    "http://www.w3.org/People/mimasa/test/schemas/DTD/xhtml-math-svg.dtd"[
<!ENTITY % MATHML.pref.prefixed "INCLUDE" >
]>
<html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:pref="http://www.w3.org/2002/Math/preference"
         pref:renderer="css">
  <head> ... </head>
  <body> ... </body>
</html>

The namespace prefix for the MathML preferences namespace may be changed by redeclaring the %MATHML.pref.prefix; parameter entity in the internal DTD subset.

4.  How to define new profiles from XHTML 1.1 + MathML 2.0 + SVG 1.1 DTD

This DTD driver can also be used as a basis for defining other profiles that combine some or all of XHTML, MathML and SVG. This DTD driver has switches to include/ignore each vocabulary, all set to "INCLUDE" by default:

<!ENTITY % XHTML.module "INCLUDE" >
<!ENTITY % MATHML.module "INCLUDE" >
<!ENTITY % SVG.module "INCLUDE" >

For example, by redeclaring the %MATHML.module; parameter entity to "IGNORE", this DTD driver can be used as an XHTML 1.1 + SVG 1.1 DTD.

People might want to use other XHTML Family document type such as XHTML Basic [XHTMLBasic] instead of XHTML 1.1, or other SVG profiles like SVG Basic/Tiny [SVGMobile] instead of full SVG 1.1. Each DTD is parameterized as %XHTML.dtd;, %MATHML.dtd; and %SVG.dtd;, so by redeclaring the relevant parameter entity to refer to a different DTD, different profile may be easily defined. For example, XHTML Basic + SVG Tiny DTD can be simply written like this:

<!-- ....................................................................... -->
<!-- XHTML Basic plus SVG Tiny DTD  ........................................ -->
<!-- URI: http://www.w3.org/2002/04/xhtml-math-svg/xhtml-basic-svg-tiny.dtd
-->

<!ENTITY % XHTML.version
         "-//W3C//DTD XHTML Basic plus SVG Tiny//EN" >

<!ENTITY % MATHML.module "IGNORE" >

<!ENTITY % SVG.dtd
     PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN"
            "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd" >

<!ENTITY % XHTML.dtd
     PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" 
            "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd" >

<!ENTITY % Misc.class "| &#37;SVG.svg.qname;" >

<!ENTITY % XHTML-MATH-SVG.dtd
     PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" 
            "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd" >
%XHTML-MATH-SVG.dtd;

<!-- end of xhtml-basic-svg-tiny.dtd -->

5.  Known Limitations

Although this DTD driver has taken a great stride to provide as much flexibility as possible, there are some limitations, mostly due to the limitation of the DTD mechanism itself.

References

[MathML2]
"Mathematical Markup Language (MathML) Version 2.0", W3C Recommendation
D. Carlisle, P. Ion, R. Miner, N. Poppelier, eds., 21 February 2001
Available at: http://www.w3.org/TR/2001/REC-MathML2-20010221
The latest version is available at: http://www.w3.org/TR/MathML2
[MathML-XSL]
"Putting mathematics on the Web with MathML", W3C Math Working Group, 2002.
[Ruby]
"Ruby Annotation", W3C Recommendation
M. Sawicki, M. Suignard, M. Ishikawa, M. Dürst, T. Texin, eds., 31 May 2001.
Available at: http://www.w3.org/TR/2001/REC-ruby-20010531
The latest version is available at: http://www.w3.org/TR/ruby
[SVG11]
"Scalable Vector Graphics (SVG) 1.1 Specification", W3C Working Draft
D. Jackson, J. Ferraiolo, eds., 15 February 2002, work in progress.
Available at: http://www.w3.org/TR/2002/WD-SVG11-20020215/
The latest version is available at: http://www.w3.org/TR/SVG11/
[SVGMobile]
"Mobile SVG Profiles: SVG Tiny and SVG Basic", W3C Working Draft
T. Capin, ed., 15 February 2002, work in progress.
Available at: http://www.w3.org/TR/2002/WD-SVGMobile-20020215/
The latest version is available at: http://www.w3.org/TR/SVGMobile/
[XHTML11]
"XHTML™ 1.1 — Module-based XHTML", W3C Recommendation
M. Altheim, S. McCarron, eds., 31 May 2001.
Available at: http://www.w3.org/TR/2001/REC-xhtml11-20010531
The latest version is available at: http://www.w3.org/TR/xhtml11
[XHTMLBasic]
"XHTML™ Basic", W3C Recommendation, M. Baker, M. Ishikawa, S. Matsui, P. Stark, T. Wugofski, T. Yamakami, eds., 19 December 2000. Available at: http://www.w3.org/TR/2000/REC-xhtml-basic-20001219
The latest version is available at: http://www.w3.org/TR/xhtml-basic
[XHTMLMOD]
"Modularization of XHTML", W3C Recommendation
S. P. McCarron et al., 10 April 2001.
Available at: http://www.w3.org/TR/2001/REC-xhtml-modularization-20010410
The latest version is available at: http://www.w3.org/TR/xhtml-modularization
[XHTMLMODSchema]
"Modularization of XHTML™ in XML Schema", W3C Working Draft
D. Austin, S. P. McCarron, eds., 19 December 2001, work in progress.
Available at: http://www.w3.org/TR/2001/WD-xhtml-m12n-schema-20011219
The latest version is available at: http://www.w3.org/TR/xhtml-m12n-schema
[XMLSchema]
"XML Schema Part 1: Structures", W3C Recommendation
H. S. Thompson, D. Beech, M. Maloney, N. Mendelsohn, eds., 2 May 2001.
Available at: http://www.w3.org/TR/2001/REC-xmlschema-1-20010502
The latest version is available at: http://www.w3.org/TR/xmlschema-1
See also "XML Schema Part 2: Datatypes", available at: http://www.w3.org/TR/2001/REC-xmlschema-2-20010502
The latest version is available at: http://www.w3.org/TR/xmlschema-2

Acknowledgments

Special thanks to Jun Fujisawa, who wrote the SVG 1.1 DTD modules.