W3C home > Mailing lists > Public > www-math@w3.org > October 2002

HOWTO implement cross-browser-compatible MathML

From: Eugene Pivovarov <qgruyxzhqfzt@spammotel.com>
Date: Tue, 15 Oct 2002 19:39:46 -0400 (EDT)
Message-ID: <001801c274a4$1baa4f40$9b462a80@rice.edu>
To: <www-math@w3.org>




I have managed to figure out how to adapt the MathML output of
Mathematica or Scientific WorkPlace so that it will be
compatible both with MSIE + plug-ins and with Mozilla. (I have
not found much helpful information on this on the web so far, so
take a look.)

Two possilbe solutions are:

1.
  a. Convert all symbolic entities to the corresponding unicode
     (e.g., '&hslash;' to '&#x210F;').
  b. Delete 'mml:' in all MathML commands and adjust the <html>
     tag accordingly.
  c. Correct <math> tags if they do not specify xmlns.
  d. Add the reference to mathml.xsl or pmathml.xsl if missing.
  e. Rename the file to *.xml, make it XML compliant (add <?xml>,
     convert all tags to the lower case, etc.) and clean it up
     (remove unnecessary <style>, <object> and <?import> tags, etc.)

Example: (file 1.xml)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl"
  href="http://www.w3.org/Math/XSL/pmathml.xsl"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> </head>
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mi>&#x2202;</mi>
</math>
</body></html>

2.
  a. Combine xhtml-lat1.ent, xhtml-symbol.ent, xhtml-special.ent and
     mmlalias.ent into a local DTD, say, math.dtd.
  b. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML
       2.0//EN" "math.dtd">
  c. Add the reference to mathml.xsl if it is missing.
  d. Same as 1e.

Example: (file 2.xml)
<?xml version="1.0"?>
<?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//EN"
  "math.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:mml="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<head> </head>
<body>
<mml:math display="block">
  <mml:mi>&part;</mml:mi>
</mml:math>
</body></html>


Reasons why it is SO inconvenient:
1. No simple way to resolve entities such as '&alpha;' because
 a. http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd is not
    properly parsed by MSIE (it does not understand IGNORE tag).
 b. Mozilla never loads external entities from the web, so you
    can not create a custom <!DOCTYPE> either.
2. Wolfram, MacKichan and others did not figure out how
   to make MathML output cross-browser-compatible, therefore,
   they customized it to a particular implementation, which is
   often not even XML.

Eugene Pivovarov
(eugenep-at-cmt-dot-rice-dot-edu)
Received on Wednesday, 16 October 2002 03:27:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 20 February 2010 06:12:51 GMT