Using macros
Introduction
What are macros A macro is an XML-tag that is not in MathDox, but that can be transformed into Mathdox. An example of a macro could be using p instead of para or iv for an OMOBJ containing an OMV. A first example with macros Using these example macros, Let n be a positive integer.

]]>
would then be short for Let be a positive integer. ]]> which, when displayed looks like: Let be a positive integer.
Why use macros Macros can be abbreviations for longer tags or constructs. An example is a maxima, which could be an abbreviation for a longer MONET-query which calls Maxima with some options, see also the following example. A more complicated macro example: <tag>maxima</tag> Using this example macro, The sum of 1 and 2 is 1 2 . ]]> would then be short for The sum of 1 and 2 is 1 2 . ]]> and if the maxima service is set up properly the output would be: The sum of 1 and 2 is 3 . Another reason to use macros could be familarity with an other format. Editors who are more familiar to HTML might find it easier to use p instead of para.
Disadvantages of using macros The largest problem of using macros is that the resulting document source is no longer MathDox. This could be complicated if multiple people want to work on a document together and not everyone uses the same macros. Another problem is that allowing different ways to enter the same information might result in confusion. People who use macros might be confused when others use the corresponding MathDox instead. Furthermore others will probably not understand the macros. It is possible to convert the code with macros into MathDox and put this in the MathdoxPlayer. This however means having two copies. The people who use the macros might want to edit the macro version, while others might want to edit the MathDox version. This can cause problems when working in teams.
Translating
Introduction Although there is no support for macros in MathDox and in the MathdoxPlayer, it is not so hard to use XSLT to transform the macros to valid MathDox. In this section it will be shown how this can be done with the help of Apache Ant.
XSLT XSL stands for Extensible Stylesheet Language and XSLT stands for XSL Transformations. XSLT is a standard by the World Wide Web consortium. On their website are the specifications for XSLT 1.0 and XSLT 2.0. An example XSLT file The following XSLT 1.0 file can be used to transform the macros mentioned above to MathDox. The file macros2mathdox.xsl is also included in this manual. ]]>
Apache Ant Apache Ant is a program like make. Using a set of transformations in a file build.xml (like Makefile for make), it can be used to build things, in this case it will be used to convert macros to MathDox. The example below is tested and should work with ant version 1.7 or higher. For this example all source files (the files with macros) are put in the directory src, one XSLT 1.0 stylesheet is used, named macros2mathdox.xsl, which is put in the directory xsl. An example build file (for Ant) ]]> Such a file can make it easy to transform macros. By just typing ant the MathDox version will be created in the build directory. This example file build.xml is also included in this manual. It is also possible to download a zip-file containing the complete ant-example. Some more information about the ant task xslt can be found in the Ant manual. More about ant and creating build.xml files can be found in the Ant manual.
Using XSLT 2.0 with Ant: Saxon Ant does not support XSLT 2.0 by itself, but it is possible to add libraries that make it possible to run XSLT 2.0 stylesheets from Ant. To do this go to the open source Saxon homepage and download the open source version (Saxon-B) for Java. Now create a directory libraries/saxon and extract the downloaded zip file there. Look at the new build.xml file: ]]> The differences are the definition and use of saxon.classpath. The new build.xml is also included in the manual, under the name build-xslt2.0.xml. This file should be renamed to build.xml if you want to use XSLT 2.0.