Doctype and headers, howto publish MathML

On 19 janvier 2008 by dom

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 »
    « »>
  • <!DOCTYPE html PUBLIC « -//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN »
    « »>

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:


2 Responses to “Doctype and headers, howto publish MathML”

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *