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.


sum1
test suite image
infinity  
  ----    
   \      
    )   x 
   /     i
  ----    
 i = 0    

msubsup1
test suite image

 1    
/  x  
| e dx
/     
 0    

mtable2
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 

mfrac4
test suite image
       _ 
1 +  \|5 
---------
    2    

Wednesday, 16 December 2009

MathML3 article at IBM developerWorks

IBM developerWorks have just published an article that I wrote on on MathML3, http://www.ibm.com/developerworks/xml/library/x-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 http://www.w3.org/TR/2009/CR-MathML3-20091215/ and http://www.w3.org/TR/2009/CR-mathml-for-css-20091215/.

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 http://lists.dsdl.org/dsdl-discuss/2009-12/0002.html. dsdl-discuss is a closed list for members of SC 34/WG 1, however comments are welcome on the public list dsdl-comment 'at' dsdl.org archived at http://lists.dsdl.org/dsdl-comment/.