Addtitional technical information. For a first overview of the stylesheet see the Overview Page.
== The stylesheets were last updated on: Thu Jun 26 15:52:02 CEST 2003 ==
At the current time few browsers have "native" support for MathML, and none have native support for the Content part of MathML. However Mozilla and Amaya have good support for Presentation MathML, and for other browsers there are a range of extensions that will render MathML (in particular, WebEQ and MathPlayer from Design Science and Techexplorer from IBM).
The main disadvantage of using a third party extension to render MathML
within a web page is that it requires specific markup to specify the
rendering extension (so <applet>
for Java applets,
<embed>
for plugins and <object>
for
Microsoft Behavior extensions). The use of such markup ties the document to
one particular platform, whereas the ideal of publishing information on the
Web is that it should be accessible to all using a range of tools. We present
here a proposed mechanism for using the XSLT transformation language to avoid
these drawbacks and to allow XML files that conform to the XHTML and MathML Recommendations to be rendered
on a range of browsers, with no browser specific markup in the document. The
document just requires a single processing instruction linking to the stylesheet described
here. The stylesheet transforms the supplied XML file, adding whatever markup
is required to render MathML in the current browser, and pass the resulting
document to the browser for rendering. Clearly this does require that the
browser supports XSLT transformations, which does mean that a relatively new
browser is required, however the current versions of (at least) Internet
Explorer, Netscape and Mozilla all support XSLT, so while XSLT support is not
universal it is, or soon will be, available on the majority of desktop
browsers.
In order to use these stylesheets you need to add one line such as the
following to your document, before the top level <html>
element.
<?xml-stylesheet type="text/xsl" href="mathml.xsl"?> <?xml-stylesheet type="text/xsl" href="http://www.w3.org/Math/XSL/mathml.xsl"?>The stylesheet
mathml.xsl
will render documents containing any
part of MathML, including Content Elements. If the document does not contain
any Content MathML, then as an alternative one may link to a slightly simpler
stylesheet:
<?xml-stylesheet type="text/xsl" href="pmathml.xsl"?> <?xml-stylesheet type="text/xsl" href="http://www.w3.org/Math/XSL/pmathml.xsl"?>
This avoids loading the XSLT required to transform Content MathML to Presentation MathML that is needed to display Content MathML in some platforms. Most of the examples presented here will use this second stylesheet as this is sufficient to demonstrate the rendering capabilities of the various systems.
Normally the stylesheet will transform the input document to use a suitable MathML renderer, depending on the browser in use and any browser extensions that it detects. It tries a list of possibilities and selects the first one which appears to be installed.
One may control this behaviour, adding one rendering possibility to the front of the list of renderers to be attempted. This is accomplished by adding an attribute from the MathML preferences namespace to the top level html element of the input document. For example:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html pref:renderer="css"> </html>
from the pmathml-css example file specifies that the "css" rendering is to be preferred (in preference to Techexplorer or MathPlayer that might otherwise have been chosen in Internet Explorer).
There are still improvements to be made to these stylesheets and the documentation...
In particular the JavaScript code in the pmathml-css stylesheet is not very robust at present.
Support for more browsers is particularly important, including porting the JavaScript/CSS code from Internet Explorer to Netscape to give an alternative on no-MathML builds of Mozilla and Netscape.
OS | Browser | XSLT | MathML Renderer | ||||
---|---|---|---|---|---|---|---|
Native Presentation | MathPlayer Behaviour | Techexplorer Behaviour | Techexplorer Plugin | CSS/Java Script | |||
Windows | IE x, x < 5.0 | no | no | no | no | no | no |
IE 5.0 | wd-xsl | no | no | no | yes | no | |
IE 5.5 | wd-xsl | no | yes | yes | yes | no | |
IE 5.0/MSXML3 | yes | no | no | no | yes | no | |
IE 5.5/MSXML3 | yes | no | yes | yes | yes | yes | |
IE 6 | yes | no | yes | yes | yes | yes | |
Netscape x, x <= 6.0 | no | no | no | no | no | no | |
Netscape 6.1 | yes | no | no | no | yes | no | |
Netscape 7.0 | yes | yes | no | no | no | no | |
Mozilla 0.9.4 | yes | no | no | no | no | no | |
Mozilla 0.9.4/MathML | yes | yes | no | no | no | no | |
Mozilla 0.9.5+ | yes | yes | no | no | no | no | |
Amaya | no | yes | no | no | no | no | |
Opera | no | no | no | no | no | no | |
Lynx | no | no | no | no | no | no | |
Macintosh | IE 5.0 | wd-xsl | no | no | no | yes | no |
Netscape x, x <= 6.0 | no | no | no | no | no | no | |
Netscape 6.1 | yes | no | no | no | yes | no | |
Mozilla | yes | no | no | no | no | no | |
Opera | no | no | no | no | no | no | |
Lynx | no | no | no | no | no | no | |
Linux / Unix | Netscape x, x <= 6.0 | no | no | no | no | no | no |
Netscape 6.1 | yes | no | no | no | yes | no | |
Netscape 7.0 | yes | yes | no | no | no | no | |
Mozilla 0.9.4 | yes | no | no | no | no | no | |
Mozilla 0.9.4/MathML | yes | yes | no | no | no | no | |
Mozilla 0.9.5+ | yes | yes | no | no | no | no | |
Amaya | no | yes | no | no | no | no | |
Opera | no | no | no | no | no | no | |
Lynx | no | no | no | no | no | no |
The majority of the code in these styleseets has been written by David Carlisle. Contributions from others are acknowledged at appropriate places within the sources.
The code is made available under the following conditions:
Copyright David Carlisle 2001, 2002. Use and distribution of this code are permitted under the terms of the W3C Software Notice and License.
Sometimes it is inconvenient to arrange that a document is always generated with the correct relative link to the stylesheet, and the Internet Explorer security restrictions cause problems with using an absolute URI to (for example) the copy on the W3C site.
It is possible to make use of XSLT's "literal result element as stylesheet" syntax, and use the document itself as the stylesheet. This form can not do the Content to Presentation transform required by Mozilla, so it should only be used for documents using presentation MathML, also currently it generates a warning about unsupported XSLT elements in Amaya. However for Internet Explorer, Mozilla and Netscape, one can follow the example pmathml-self-style.xml, the main parts of which are shown below.
<?xml-stylesheet type="text/xsl" href="pmathml-self-style.xml"?> <html xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0" xmlns="http://www.w3.org/1999/xhtml" > <head><title>Presentation MathML</title> <object id="mmlFactory" classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987"> </object> <xsl:processing-instruction name="import" >namespace="m" implementation="#mmlFactory"</xsl:processing-instruction> </head> <body> <h1>Presentation MathML</h1> .... <m:math mode="display"> <m:mrow> <m:msqrt> ..... </m:mrow> </m:math> </body> </html>
To use this mechanism:
classid="clsid:0E76D59A-C088-11D4-9920-002035EFB1A4"
should work for Techexplorer. (This version of the stylesheet can not
support the different options simultaneously.).xsl:processing-instruction
element should be added
as shown, to generate a processing instruction to work with Microsoft
Behaviors.For Content MathML, Mozilla requires a transformation to Presentation, but in all other cases of MathML rendering using the stylesheet, there is little "transformation" happening; the main process is an identity transformation, with some additional features, mainly to enable the Internet explorer behaviors mechanism.
If you have access to the server configuration then an alternative to using the stylesheet is produce the file in XHTML, with the additional object and processing instructions required by Internet explorer. However serve the file as content type text/html if the client requesting the page is Internet Explorer (and text/xml otherwise). By serving the file as HTML, Internet Explorer will use its HTML parser and so trigger the behavior mechanism. Without needing a stylesheet to perform an XHTML to HTML transformation.
If attempting this mechanism one should be aware of the compatibility guidelines in the XHTML 1.0 Recommendation which give advice on how to avoid XHTML features that may cause problems in HTML browsers.
$Id: Overview-tech.html,v 1.9 2003/06/26 13:55:31 mf Exp $