Doctype and headers, howto publish MathML
It took me too much time… and it would not be sorted without Neil Soiffer, from Design Sciences. I found out what doctypes and headers are working with any browser… The problem was to display documents correctly with IE. Indeed I had no problems to make documents working with any Gecko-based browser (Firefox, Netscape, Camino, Galeon, Epiphany, etc…) and even with the last beta Opera (which supports MathML, see page…). The world (at least mine) would be so much easier if Microsoft decided suddenly to comply with standards… But maybe the question is: what interest for them? It would be useful for the rest of the world but who cares?
So the main principle is to work with XML documents, as MathML is an XML language. Then we have to use xHTML and avoid HTML (there is actually a way to do it with HTML but let’s move on with the most recent standards).
The 2 doctypes which are working are (depending if we also want to use SVG or not):
- <!DOCTYPE html PUBLIC « -//W3C//DTD XHTML 1.1 plus MathML 2.0//EN »
« http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd »> - <!DOCTYPE html 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-flat.dtd »>
The difficulty I had was about the MIME content-type sent out by my server. Actually I’m using the PHP function header to set the
content-type. Usually one sets the charset like in the following:
header(« Content-type: application/xhtml+xml; charset=utf-8 »);
Well it works well everywhere but not with IE (6 as well as 7). To make it work with IE it is necessary to drop the charset:
header(« Content-type: application/xhtml+xml »);
When using static xHTML, the solution is usually to use « .xhtml » extension (or « .xht« ).
Sample pages:
References:
Neither of the mathml samples above work in IE for me. I am in IE 7. It works great in Firefox. Is this something that works in IE 6 and not 7?
Well to display MathML content within IE you need to install a plugin. Ms does not support MathML.
See this post http://chezdom.net/blog/?p=35