October 3, 2006

MathML in HTML5

Roger Sidje (the moving force behind Mozilla’s MathML support) is experimenting with MathML in HTML. There’s an interesting discussion in the Mozilla newsgroup. The idea is to relax the requirement that MathML be embedded in XHTML1, with an eye, ultimately, to using MathML as the mathematical markup for HTML5.

I think this, if done right, is a wonderful idea. But I have a few comments

1. Today, XHTML is a huge barrier. I know of lots of people who would be all too happy to use MathML (generated by tools like itex2MML), but are stymied by the exigencies of XHTML. CMS’s that support XHTML are nearly nonexistent. Few people are crazy enough to either write their own, or to hack an existing one into producing XHTML. And, even if they did have an XHTML-capable CMS, many users don’t have access to their server configuration to do the required content-negotiation, to sent application/xhtml+xml to capable browsers. So MathML-in-HTML would lower the barrier tremendously.
2. MathPlayer 2.0 already allows IE/6 to consume MathML in tag soup. If I understand correctly, Mozilla’s implementation will be better similar to MathPlayer’s (except that the latter actually processes the MathML as XML), in that the MathML nodes will be part of the DOM. That’s very important if, like me, you’d like to apply CSS styling or Javascript to MathML content.
3. On the other hand, I think we want to avoid having two incompatible markup languages, both named MathML. Rather than creating some incompatible markup language, confusingly called MathML, I think the Mozilla people should create a profile of MathML 2.0 (along the lines of XHTML’s Appendix C) which is safe to be consumed by the HTML5 parser.
4. Roger Sidje and Ian Hickson disagree about whether to support the 2000+ MathML named entities. I side with Hickson. Sending named entites over the web is unsafe in an XML context. Hence the existence of tools to convert them to NCR’s or utf-8, before sending them over the wire. Allowing MathML named entities in HTML5 will break interop with existing HTML documents, and cause problems if the same MathML content is served as XML. Not worth the trouble.

If there are stumbling blocks to creating a suitable profile of MathML 2.0, now is the time to find out. Then you can pass on suggested changes to the MathML 3.0 Working group.

1 Real XHTML, served as application/xhtml+xml.

Posted by distler at October 3, 2006 9:52 AM

TrackBack URL for this Entry:   http://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/959

Re: MathML in HTML5

Would this also include SVG?

Posted by: Sam Ruby on October 3, 2006 11:00 AM | Permalink | Reply to this

SVG in HTML5

I doubt it.

We’re talking about including new element names in HTML5. Vaguely feasible for Presentational MathML. Infeasible, I would guess, for SVG.

In any case, the current feasibility study is MathML-only.

Posted by: Jacques Distler on October 3, 2006 4:12 PM | Permalink | PGP Sig | Reply to this

Re: MathML in HTML5

Just a correction and a comment:

- Internet Explorer has always exposed MathML nodes in its DOM. These nodes are available to scripting even without MathPlayer installed.
MathPlayer simply establishes itself as the renderer for XML islands using the MathML namespace.

- The XML standards world has definitely made character entities a “bad thing”. I think the main reason is that, as in SGML from which they were borrowed, entities were allowed to be defined outside the document instance and passed in somehow to the XML parser. Since such a document would not be self-contained, this would be a big problem. Unfortunately, MathML people and many others just wanted a more readable name for Unicode characters and had no interest in defining them outside the document other than to agree globally. I guess we lose.

Paul Topping
Design Science.

Posted by: Paul Topping on October 3, 2006 3:26 PM | Permalink | Reply to this

Re: MathML in HTML5

﻿Internet Explorer has always exposed MathML nodes in its DOM. These nodes are available to scripting even without MathPlayer installed.

Ah! Thanks for the correction, which I have made above.

﻿Unfortunately, MathML people and many others just wanted a more readable name for Unicode characters and had no interest in defining them outside the document other than to agree globally. I guess we lose.

My approach is to output named entities with itex2MML (much more legible, I’ll admit, when one is trying to debug something) and then convert named entities to NCR’s with MathML::Entities.

Posted by: Jacques Distler on October 3, 2006 4:21 PM | Permalink | PGP Sig | Reply to this

Re: MathML in HTML5

Hi Jacques,

Judging from your blog you are more a computer system administrator than a physicist. What has happened?

Best,
Tim

Posted by: Tim on October 3, 2006 3:41 PM | Permalink | Reply to this

Posting topics

I post about whatever I feel like posting about, when I feel like posting about it. Sometimes (as in the past few weeks), I haven’t felt like posting much.

So I didn’t.

Sometimes, there’s a particular topic that obsesses me, and I’ll post a lot about that.

I’m sorry if my (current?) choice of posting topics doesn’t appeal. The best I can suggest is

2. Post about stuff that you think is interesting, and
3. Maybe that will inspire me to post something about those topics, too.

Or, if that’s too much trouble: find an old post of mine, that you did like, and post some insightful and thought-provoking comments on it. Maybe that will inspire me to follow up with more postings along similar lines.

Posted by: Jacques Distler on October 3, 2006 4:38 PM | Permalink | PGP Sig | Reply to this

Re: MathML in HTML5

“Few people are crazy enough to either write their own, or to hack an existing one into producing XHTML.”

It’s hardly a feat to output XHTML sent as HTML following the compatibility guidelines so I disagree that people are crazy for attempting to make a CMS do it.

Emphasis should be placed on the content negotiation. Finding a decent fallback for UA’s that don’t support XHTML sent as XHTML is the problem.

In any case, many people already dislike HTML5 and I don’t think hacking it to work around IE’s lack of XHTML support is the right solution. A better one would be to get people to use a compliant browser.

Posted by: Damon Haidary on October 5, 2006 9:43 AM | Permalink | Reply to this

Real XHTML

﻿It’s hardly a feat to output XHTML sent as HTML following the compatibility guidelines so I disagree that people are crazy for attempting to make a CMS do it.

You must be new here.

“XHTML” sent as text/html is tag-soup, and irrelevant to the discussion at hand. As I thought I had made clear, I am talking about real XHTML, which is well-formed, conforms to XML parsing rules (e.g., no inferred elements, no hiding Javascript in XML comments, compatible with XML white-space normalization of attribute values, etc, etc). Real XHTML is the only kind of XHTML in which you can embed MathML and have it rendered in Mozilla.

That is what this post is about. It is not about the ability of CMS’s to churn out some other kind of “XHTML”.

﻿I don’t think hacking it to work around IE’s lack of XHTML support is the right solution.

I couldn’t care less about IE’s lack of XHTML support. Its support for XML islands is sufficient for MathPlayer 2.0 to function. Which, arguably, puts it ahead of Mozilla. If one were authoring for IE+Mathplayer, it wouldn’t matter that there aren’t any XHTML-capable CMS’s out there.

Posted by: Jacques Distler on October 5, 2006 10:05 AM | Permalink | PGP Sig | Reply to this

Post a New Comment