Sunday, 20 December 2009

XSLT for Presentation MathML in a Browser

Back in 2002 at the MathML Conference I presented a stylesheet, pmathml.xsl, that detected the browser being used and inserted whatever was necessary to enable MathML on that platform. The stylesheet is distributed, along with the slides from the conference presentation, from the W3C Math/XSL area.

The stylesheet is showing its age, in particular a large part of its complexity is due to the fact that that it encodes two completely separate languages in one file, XSLT, and the ‘wd-xslt’ language used in IE5. IE 5 is not an important platform these days, and for some years MathPlayer has been able to act as a MIME Filter in Internet Explorer, and so automatically insert the needed object references into the document without using an XSL stylesheet. However the XSL stylesheet mechanism still has uses, and may be adapted to other browsers. An updated version of this stylesheet has been in use for the NAG Library documentation.

I have placed an updated version of pmathml.xsl on google code. This loses all the wd-xsl code so requires IE6 or later, but it detects Opera and Safari and in that case inserts some extra elements to make it more likely that the documents meets the conditions of the MathML profile for CSS, and links to some CSS to render the resulting elements. The CSS is a combination of some old CSS of mine and George Chavchanidze's CSS developed as part of the MathML profile for CSS.

Unfortunately xlink links no longer work in Firefox 3, and so this version uses some javascript to give link behaviour to any element with an xlink:href attribute. Since it is doing this it also enables links for unprefixed href attributes, in anticipation of MathML3's href attribute for linking.

I hope to extend this to enhance MathML3 support, rendering the new MathML3 features as far as possible in existing browsers. The current check in is mainly to form a baseline in google code before adding any new MathML3 features.

Friday, 18 December 2009

MathML as ASCII Art

Normally one wants to use a full typesetting system, and access to fonts with a rich variety of symbols to typeset mathematics. But sometimes you don't.

Plain text, restricted to ASCII, still has its uses. It is possible to lay out the 2-dimensional mathematical notations as a kind of ‘ASCII-art’. Historically in the days before GUI workbook-style interfaces most Computer Algebra systems would use this kind of layout, and they can usually still be persuaded to use this style even in current versions.

I've just made available a very old stylesheet, it was I think one of the first XSLT 2 stylesheets that I wrote, which renders MathML in this style. It still does not do all of MathML3 (or 2) presentation MathML, but I intend to extend it as time permits.

The stylesheet is available on google code and some examples running against the MathML test suite are shown below.

The google code project also has the htmlparse styesheet discussed previously in this blog, and a perhaps more serious XSLT stylesheet to render MathML via TeX, again that will be extended to cover most of MathML3, as part of the MathML CR implementation phase – something to do over the Christmas break. Documentation of exactly what's in the project will be added eventually, it's only been running a day.

test suite image
    )   x 
   /     i
 i = 0    

test suite image

/  x  
| e dx

test suite image

                                                     2          2                          
1                     x + y                         x  + 2yx + y                           
                       2          2                  3      2     2     3                  
x + y                 x  + 2yx + y                  x  + 3yx  + 3y x + y                   
 2          2          3      2     2     3          4      3     2 2     3     4          
x  + 2yx + y          x  + 3yx  + 3y x + y          x  + 4yx  + 6y x  + 4y x + y           
 3      2     2     3  4      3     2 2     3     4  5      4      2 3      3 2     4     5
x  + 3yx  + 3y x + y  x  + 4yx  + 6y x  + 4y x + y  x  + 5yx  + 10y x  + 10y x  + 5y x + y 

test suite image
1 +  \|5 

Wednesday, 16 December 2009

MathML3 article at IBM developerWorks

IBM developerWorks have just published an article that I wrote on on MathML3, I doubt that it has any information new to readers of this blog, but perhaps it may reach a new audience and spread the word about MathML3.

Tuesday, 15 December 2009

Candidate Recommendations

I'm pleased to be able to announce that the Candidate Recommendation drafts of MathML3 and the MathML for CSS profile are available at and

It is during this Candidate Recommendation phase that implementation work needs to begin in earnest as we need to show via the test suite that all the features are implemented by two implementations.

Friday, 11 December 2009

Thoughts on Revising DSRL

A while ago now, I posted an article on DSDL. In it I commented that part 8, DSRL, had a lot of problems. The new Project Editor, Francis Cave, has recently posted the first cut at a revised draft of DSRL, and also posted some thoughts from me suggesting some more extensive revisions that could be made.

The posting can be seen in the public archives of dsdl-discuss at dsdl-discuss is a closed list for members of SC 34/WG 1, however comments are welcome on the public list dsdl-comment 'at' archived at

Tuesday, 17 November 2009

XML Entity Definitions for Characters

I'm pleased to announce that the last call draft of XML Entity Definitions for Characters has been published:

Comments are welcome on, please put the text
in the subject line, preferably like this:
[Entities-last-call] - summary of comment

Tuesday, 6 October 2009

Friday, 25 September 2009

MathML3 Last Call

The Last Call draft of MathMl3 has just been published at

Please send comments to, starting your subject line with

The has been more refinement of the elementary math layout markup in chapter 3, a lot of work cleaning up and normalising chapter 4 on Content Markup, and a new Relax NG Schema, which is now almost all generated (via XSLT) from the text of the spec, as attributes and content models are now displayed in a tabular form more amenable to machine processing.

Also for the first time, we are publishig DTD and XSD versions of the schema, both of which are automatically converted from the Relax NG schema by a combination of XSLT (to simplify the schemas) and trang (to do the actual conversion) and (in the case of dtd) sed processing to massage the dtd into xhtml modularisation form, so that it supports namespaces as far as is possible with a dtd.

Thursday, 4 June 2009

New MathML Drafts

I'm pleased to announce another draft of both MathML 3 and the MathML profile for CSS.

"Mathematical Markup Language (MathML) Version 3.0"

"A MathML for CSS profile"

Comments to www-math please.