HOWTO implement cross-browser-compatible MathML

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., 'ℏ' to 'ℏ').
  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 UTC