My homepage | My math page | My math news | Donate for the research


Math XSLT Stylesheets - Documentation

See also Math XSLT Stylesheets' Homepage.

Overview

The current version of Math XSLT Stylesheets transform a modified XHTML format file into native XHTML file (with MathML markup). These stylesheets have extensive support for embedded math formulas and other math formatting features. They are intended for writing mathematical articles.

Note that XHTML can be converted to PostScript using html2ps program. However this program (as of version 1.03b) does not support MathML formulas, so we need some software for converting MathML to images (or better PostScript files). Support for this is planned in the future.

This is an early (pre-)alpha version, but in the future it is to become not less feature-rich than LaTeX document preparation system.

The future version should also support converting XML into LaTeX.

Running Stylesheets

See the source of formulas theory article for examples.

You should run the input file through main.xsl stylesheet with some XSLT (version 1.0 or above) processor.

After this it is recommended to run output file through first copy-html.xsl and then copy2-html.xsl stylesheets (to clean out superfluous namespace declarations).

One way to accomplish it is to use a pipeline, as in the following example with XSLTproc on Unix:

xsltproc --catalogs --stringparam main-source article.xml \
    math-xslt/main.xsl article-template.xml | \
xsltproc --catalogs math-xslt/copy-html.xsl - | \
xsltproc --catalogs math-xslt/copy2-html.xsl - > article.out.xml

Note that (as in the above example), if you use templates (see below), you must specify the template file as the input file for the XSLT processor and specify the location of your main source (article) file as the main-source XSLT parameter (e.g. main-source='srcdir/article.xml').

Please take note that certain browsers (such as Firefox 1.0) render MathML only if the (output) file has extensions .xml (not .html).

Note that future versions of the stylesheets may either require several passes (like Knuth's LaTeX) or use a higher than 1.0 version of XSLT.

Input File Format

The input file format is a modification of XHTML. Strictly speaking it isn't conforming to XHTML Standard, because of <m> element added to XHTML namespace. (However if you will not use this element, then the input format is fully compatible with XHTML Standard.)

The input file format is XHTML (version 1.0 or 1.1) with some tags from different namespaces added. You can use these tags along with the standard XHTML tags.

Currently the exact input format is unspecified but you are to use some of the replacement tags instead of certain normal XHTML tags which are recommended to be not used, for example use <dc:description> tag instead of native XHTML <meta name="Description"/> tag.

Inserting Math

You can insert MathML formulas into your articles by the following means:

Standard Way

The standard way to include MathML into XHTML is to use <m:math> MathML tag:

<math xmlns="http://www.w3.org/1998/Math/MathML">...</math>

or

<m:math>...</m:math>

Direct Embedding

Math XSLT Stylesheets allows to embed MathML in a more compact way, without <m:math> tag, so increasing readability of XML sources. For example, you can write simply <m:mi>x</m:mi> instead of

<m:math><m:mi>x</m:mi></m:math>

<m> Element

Alternatively you can use non-standard <m> element (with either MathML or XHTML namespace) instead of <m:math> element:

<m><mi>x</mi></m>

Presentational MathML

Math XSLT Stylesheets has support for content markup in MathML which is transformed into presentational markup.

Note that you can use the stylesheet mathml-struct.xsl separately to transform content MathML into presentational MathML.

(Currently only a small subset of content markup is supported. However among supported things there already are such complex things as quantifiers and sets.)

Sections

Use the following structure instead of conventional HTML heading tags:

<struct:section>
  <struct:title>Section Title</struct:title>

  ...

</struct:section>

This has that advantage over HTML heading tags, that you don't specify heading level explicitly and so the level of heading can be easily changed (for example dependently on where an XML fragment is included.

Templates and Metadata

You can use templates to format an article.

See source of formulas theory article (file article-template.xml) for an example of article template.

Analogous to article templates, metadata also can be in a separate file. (It is useful for several articles to share of the same metadata.) See the file meta.xml in the above mentioned example.

Other Features

Math XSLT Stylesheets have many more features which are not yet described in the documentation.



My homepage | My math page | My math news | Donate for the research