<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
 "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"-->
<html xmlns:mml="http://www.w3.org/1998/Math/MathML"
      xmlns="http://www.w3.org/1999/xhtml">
<head> 

<link rel="stylesheet" href="./mathML2002.css" type="text/css"/>

<title>Mappings between presentation markup and semantic markup for 
variable size objects</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

</head> 

<body> 
<h1 align="center">Mappings between presentation markup and semantic markup for 
variable size objects</h1> 
<p align="center"><strong>Bill Naylor 
<br />Ontario Research Centre for Computer 
Algebra 
<br />The University of Western Ontario 
<br />London Ontario CANADA N6A 
5B7 
<br /><tt>bill@orcca.on.ca</tt></strong></p> 
<p align="left"></p> 
 
<h3>Abstract:</h3> 
<div> 
In this paper we give a brief overview of the paper "meta stylesheets 
for the Conversion of Mathematical Documents into Multiple forms" 
[<a 
href="#naylorWatt">1</a>]. We propose an extension to the techniques proposed 
in [<a 
href="#naylorWatt">1</a>] in order to overcome the problem of 
specifying notation for objects of a varying size, e.g. <em>matrices</em> 
or <em>vectors</em>. The extensions proposed 
in this paper are based on regular expression or XML Schema like 
ideas. We discuss the basics of using XSLT for performing 
the calculations defined by the template functions. We discuss how we 
may use the <em>document</em> element to access external processes which 
may be required to perform calculations for which XSLT is 
ill-suited. Finally, we suggest a way in which a user of the extended MathML 
we propose may specify different notation styles at different levels 
within an object. 
</div> 
<p />
<h1><a name="SECTION00010000000000000000"> 
1 Introduction</a> 
</h1> 
It is an unfortunate fact that due to the varied history of 
mathematics, mathematical notation is ambiguous. There is a many to 
many relationship between the meaning of a mathematical object and the 
notation which mathematicians use to write them down (as noted in 
chapter 4 of the MathML specification [<a 
href="#MathML">2</a>]). A document 
marked up using the OpenMath ([<a 
href="#OpenMath">4</a>] and [<a 
href="#OpenMathStd">3</a>]) 
markup language is a possible alternative approach which does not 
suffer from this problem. However, the OpenMath concept does not 
address the issue of presentation markup. Ideally, we want some markup 
which gives flexible presentation markup for semantically unambiguous 
mathematics. 
<br /> We discuss a possible solution to this quandary in our paper 
[<a 
href="#naylorWatt">1</a>] in which a method is proposed whereby a set of 
<tt>ntn</tt> files (which may be held in a parallel directory structure 
to the OpenMath <em>content dictionaries</em>, in a similar way to the 
<tt>sts</tt> small type system) hold information which declares a mapping 
between an <em>OpenMath symbol</em> and a variety of different 
presentations for that symbol, marked up using <em>presentation 
MathML</em>. These different presentations will be matched against a <em>semantic-template</em>, which will provide a <em>prototype</em> for the 
mathematical object. The prototype will typically be an <tt>OMA</tt> 
element, where the first child is the symbol for which we are giving 
notations. The ordering of the parameters for a symbol are 
conserved by means of <tt>xref</tt> and <tt>id</tt> attributes on the 
presentation and the semantic side of the mapping respectively. 
<br /><p /><div><a name="ex1"><b>Example:  1</b></a> &nbsp; <b>
<em>We give an example of the entries to the notation element for the 
BesselJ symbol, which detail the notations given in the traditional 
style; 
<!-- This MathML has been generated by the TexToMathML application -->
<!-- developed at the Ontario Research Center for Computer Algebra (ORCCA) -->
<!-- Please report problems to TeXToMathML@orcca.on.ca -->
<mml:math overflow="scroll">
  <mml:mrow>
    <mml:msub>
      <mml:mi> J </mml:mi>
      <mml:mi> &#x03BD; </mml:mi>
    </mml:msub>
    <mml:mfenced>
      <mml:mi> z </mml:mi>
    </mml:mfenced>
  </mml:mrow>
</mml:math>
, and that used by Maple 7; <code>BesselJ(n,m)</code>:</em> 
</b> 
<p /> 
<pre> 
&lt;Notation&gt; 
  &lt;version precedence="10"&gt;    &lt;!-- The default style --&gt; 
    &lt;math&gt;&lt;mrow&gt; 
      &lt;msub&gt;&lt;mi&gt;J&lt;/mi&gt; 
        &lt;mrow&gt; 
          &lt;value xref="arg1"&gt;&amp;nu;&lt;/value&gt; 
        &lt;/mrow&gt; 
      &lt;/msub&gt; 
      &lt;mo&gt;&amp;ApplyFunction;&lt;/mo&gt; 
      &lt;mfenced&gt; 
        &lt;value xref="arg2"&gt;z&lt;/value&gt; 
      &lt;/mfenced&gt; 
    &lt;/mrow&gt;&lt;/math&gt; 
  &lt;/version&gt; 
  &lt;version precedence="10" style="maple"&gt; &lt;!-- The Maple Notation --&gt; 
    &lt;math&gt;&lt;mrow&gt; 
      &lt;mi&gt;BesselJ&lt;/mi&gt;&lt;mo&gt;&amp;ApplyFunction;&lt;/mo&gt; 
      &lt;mfenced&gt; 
        &lt;value xref="arg1"&gt;n&lt;/value&gt; 
        &lt;value xref="arg2"&gt;z&lt;/value&gt; 
      &lt;/mfenced&gt; 
    &lt;/mrow&gt;&lt;/math&gt; 
  &lt;/version&gt; 
  &lt;semantic_template&gt;&lt;OMOBJ&gt; 
    &lt;OMA&gt;&lt;OMS cd="bessel" name="BesselJ"/&gt; 
      &lt;OMV name="nu" id="arg1"/&gt; 
      &lt;OMV name="x" id="arg2"/&gt; 
    &lt;/OMA&gt; 
  &lt;/OMOBJ&gt;&lt;/semantic_template&gt; 
&lt;/Notation&gt; 
</pre></div>
<br /> 
Occasionally it occurs that part of the presentation for a notation 
for a particular symbol do not correspond to a particular part of the 
prototype of the semantic template, for example the superscript 
<mml:math overflow="scroll">
  <mml:mi> n </mml:mi>
</mml:math>
 in the 
partial derivative presentation: 

<mml:math display="block" overflow="scroll">
  <mml:mrow>
    <mml:mfrac>
      <mml:msup>
        <mml:mo> &#x2202; </mml:mo>
        <mml:mi> n </mml:mi>
      </mml:msup>
      <mml:mrow>
        <mml:mo> &#x2202; </mml:mo>
        <mml:msup>
          <mml:mi> x </mml:mi>
          <mml:msub>
            <mml:mi> n </mml:mi>
            <mml:mn> 1 </mml:mn>
          </mml:msub>
        </mml:msup>
        <mml:mo> &#x2202; </mml:mo>
        <mml:msup>
          <mml:mi> y </mml:mi>
          <mml:msub>
            <mml:mi> n </mml:mi>
            <mml:mn> 2 </mml:mn>
          </mml:msub>
        </mml:msup>
      </mml:mrow>
    </mml:mfrac>
    <mml:mi> f </mml:mi>
    <mml:mo> &#x2061; </mml:mo>
    <mml:mfenced separators=",">
      <mml:mi> x </mml:mi>
      <mml:mi> y </mml:mi>
    </mml:mfenced>
  </mml:mrow>
</mml:math>
 
<p></p> 
is redundant, (implicitly 
<mml:math overflow="scroll">
  <mml:mrow>
    <mml:mi> n </mml:mi>
    <mml:mo> = </mml:mo>
    <mml:msub>
      <mml:mi> n </mml:mi>
      <mml:mn> 1 </mml:mn>
    </mml:msub>
    <mml:mo> + </mml:mo>
    <mml:msub>
      <mml:mi> n </mml:mi>
      <mml:mn> 2 </mml:mn>
    </mml:msub>
  </mml:mrow>
</mml:math>
), and so has no corresponding 
part in an efficient scheme for a semantic template. As a solution to 
this problem, we have proposed that a <em>template function</em>, marked 
up in OpenMath markup, should be present in the <tt>ntn</tt> file. The function 
may have parameters, the example above however would have a nullary 
template function. A calculation 
represented in the body of the function, will be an (OpenMath) 
expression involving its parameters and possible references (via <tt>xref</tt> <em>pointers</em>) to the 
prototype. For the example above the template function would be 

<mml:math overflow="scroll">
  <mml:mrow>
    <mml:mfenced open="{" close="}"/>
    <mml:mo> &#x2192; </mml:mo>
    <mml:msub>
      <mml:mi> n </mml:mi>
      <mml:mn> 1 </mml:mn>
    </mml:msub>
    <mml:mo> + </mml:mo>
    <mml:msub>
      <mml:mi> n </mml:mi>
      <mml:mn> 2 </mml:mn>
    </mml:msub>
  </mml:mrow>
</mml:math>
, where 
<mml:math overflow="scroll">
  <mml:msub>
    <mml:mi> n </mml:mi>
    <mml:mn> 1 </mml:mn>
  </mml:msub>
</mml:math>
 and 
<mml:math overflow="scroll">
  <mml:msub>
    <mml:mi> n </mml:mi>
    <mml:mn> 2 </mml:mn>
  </mml:msub>
</mml:math>
 would be references 
to objects in the prototype (the XML markup for this particular case 
is given in Appendix <a href="#partialD">1</a>). The particular presentation which is required 
in a specific document will be specified either by a particular 
attribute, or via a set of defaulting mechanisms (which are detailed 
in [<a 
href="#naylorWatt">1</a>]). This mechanism allows an author freedom to use 
the notation he (or she) wants, whilst retaining precise mathematical 
meaning. 
<p /><div><b>Example:  2</b> &nbsp; <b>
<em>In this example we assume the availability of the <tt>Notation</tt> element 
given in example <a href="#ex1">1</a>. An author may select the</em> Maple <em>style of 
notation by giving the following markup. It should be noted that the 
ordering of the parameters will be as given in the respective content 
dictionary. The following shall be displayed as</em> <tt>BesselJ(1,2):</tt><a name="tex2html1" 
href="#foot235"><sup>1</sup></a></b> 
<p /> 
<pre> 
&lt;xm:apply&gt; 
  &lt;xm:BesselJ style="maple"/&gt; 
  &lt;xm:mn&gt; 1 &lt;/xm:mn&gt; &lt;xm:mn&gt; 2 &lt;/xm:mn&gt; 
&lt;/xm:apply&gt; 
</pre></div> 
<br /> 
It would appear that these mechanisms are sufficient for providing a 
presentation/semantics mapping for mathematical objects which take a 
specific number of parameters. However the situation is more complex in 
the case of mathematical operators which take a variable, or arbitrary 
number of parameters, for example nary functions like plus which in 
OpenMath terminology is represented by the symbol:<br />
<pre>&lt;OMS cd="arith1" name="plus"/&gt;
</pre> <br />
or a constructor of objects with no predetermined size, for example 
the basic vector constructor, in OpenMath this is represented by the symbol:<br />
<pre> &lt;OMS cd="linalg2" name="vector"/&gt; 
</pre>  <br />
Some attempt has been made to address this problem in the OMDoc 
[<a 
href="#OMDoc">5</a>] specification with the introduction of the <tt>presentation</tt> element. The style of the presentation may be 
controlled via a number of attributes which control various aspects 
of the presentation, e.g. the bracketing style, fixity etc. However 
notations exist for which there is no obvious way to include the 
relevant presentation markup in a 
<tt>presentation</tt> element apart from including XSLT in an <tt>XML 
CDATA</tt> section in the OMDoc. This is discouraged even in the OMDoc 
specification, which recognizes that hand-coding XSLT is ``a tedious 
and error-prone process''. An example of such a presentation is the 
standard presentation for a simple continued fraction: <br />
<center>
<mml:math display="block" overflow="scroll">
  <mml:mrow>
    <mml:msub>
      <mml:mi> a </mml:mi>
      <mml:mn> 0 </mml:mn>
    </mml:msub>
    <mml:mo> + </mml:mo>
    <mml:mfrac>
      <mml:mn> 1 </mml:mn>
      <mml:mrow>
        <mml:msub>
          <mml:mi> a </mml:mi>
          <mml:mn> 1 </mml:mn>
        </mml:msub>
        <mml:mo> + </mml:mo>
        <mml:mfrac>
          <mml:mn> 1 </mml:mn>
          <mml:mrow>
            <mml:msub>
              <mml:mi> a </mml:mi>
              <mml:mn> 2 </mml:mn>
            </mml:msub>
            <mml:mo> + </mml:mo>
            <mml:mfrac>
              <mml:mn> 1 </mml:mn>
              <mml:mrow>
                <mml:msub>
                  <mml:mi> a </mml:mi>
                  <mml:mn> 3 </mml:mn>
                </mml:msub>
                <mml:mo> + </mml:mo>
                <mml:mo> &#x22EF; </mml:mo>
              </mml:mrow>
            </mml:mfrac>
          </mml:mrow>
        </mml:mfrac>
      </mml:mrow>
    </mml:mfrac>
  </mml:mrow>
</mml:math>
</center>
 
<h1><a name="SECTION00020000000000000000"> 
2 Specification Languages for classes of documents or texts</a> 
</h1> 
A regular grammar allows specification of classes of sentences in a 
string. For example:  
<ul> 
<li>The regular expression ''<code>.</code>'' matches any single character, 
</li> 
<li>The regular expression ''<code>*</code>'' matches any sequence of characters. 
</li> 
<li>The regular expression ''<code>.\{4,6\}</code>'' matches any sequence of 
characters which is 4, 5 or 6 characters long. 
</li> 
</ul> 
<br />
It is matches of the final type with which we shall be primarily interested. 
<br />In a similar way XML Schema [<a 
href="#XMLSchema">6</a>] allows 
specification of a class of objects in an XML document in an XML 
format. One may specify sequences of elements with particular types, 
containing children of particular types. It is also possible in XML 
Schema to restrict the names and values of attributes belonging to a 
specific element. Text content of an element may be restricted in an 
exact manner. The subset of the regular expression grammar that we are 
especially interested in when expressed in the XML Schema framework, 
is shown by the following example:<a name="tex2html2" 
href="#foot241"><sup>2</sup></a> 
<font size="-1"></font><pre> &lt;xsd:sequence minOccurs="1" maxOccurs="5"&gt; 
  &lt;xsd:element name="mn" type="xsd:decimal"/&gt; 
&lt;/xsd:sequence&gt; 
</pre><font size="-1"></font> <br />
This fragment would match a sequence of elements which 
consisted of between 1 to 5 occurrences of the element 
<code>"&lt;mn&gt; nn.nn &lt;/mn&gt;"</code>, where <code>nn.nn</code> denotes some decimal content. 
<br />We incorporate some of the ideas from XML Schema in the extended 
MathML language we propose. However we have necessarily made some 
changes for the following reason. In order to use the template 
function technology outlined above, it is not sufficient to merely 
have a way of specifying the sets of objects we would like to operate 
on (as with XML Schema or regular grammars), we must also have a 
handle on the individual instances of the objects. We also realise 
that we do not require the full power of a regular grammar (or XML 
Schema) for our purposes, for example, we do not require the ability 
to choose members of a class. 
 
<h1><a name="SECTION00030000000000000000"></a><a name="extensions"></a><br /> 
3 Extension to the Specification Presentation MathML 
</h1> 
With the considerations of the previous section in mind we propose a 
slight change to the part of the XML Schema language that we shall 
utilise. A dtd fragment detailing this is shown below: 
<font size="-1"></font><pre> 
&lt;!ELEMENT sequence (minOccurs,maxOccurs,particle)&gt; 
  &lt;!ATTLIST sequence var NMTOKEN #REQUIRED&gt; 
&lt;!ELEMENT minOccurs (#PCDATA)&gt; 
  &lt;!ATTLIST minOccurs val NMTOKEN #IMPLIED 
                      xref NMTOKEN #IMPLIED&gt; 
&lt;!ELEMENT maxOccurs (#PCDATA)&gt; 
  &lt;!ATTLIST maxOccurs val NMTOKEN #IMPLIED 
                      xref NMTOKEN #IMPLIED&gt; 
&lt;!ELEMENT particle ANY&gt; 
</pre><font size="-1"></font>The meaning and reasons for including these different elements follows: 
 
<ul> 
<li>The <tt>sequence</tt> element is the container for the 
specification of a repeated sequence. 
</li> 
<li>The <tt>minOccurs</tt> and <tt>maxOccurs</tt> elements have similar purposes 
to the <tt>minOccurs</tt> and <tt>maxOccurs</tt> attributes of XML Schema 
and specify lower and upper bounds respectively to the values that the 
identifier variable <tt>var</tt> may take. Together these two elements 
imply the number of repetitions of the body within the <tt>particle</tt> 
element which must occur. 
</li> 
<li>The <tt>particle</tt> element holds the body of the MathML fragment which 
is to be repeated. 
</li> 
<li>The attribute <tt>var</tt> of the <tt>sequence</tt> element holds an 
identifier to identify the repeated instances of the body held in the 
<tt>particle</tt> element. 
</li> 
<li>The attribute <tt>val</tt> (or <tt>xref</tt>) of the elements <tt>maxOccurs</tt> and <tt>minOccurs</tt> respectively hold the minimum and 
maximum values (or references to template functions which calculate 
these values) taken by the repetition index (identified by the 
attribute <tt>var</tt>). 
</li> 
</ul><p /><div><b>Example:  3</b> &nbsp; <b>
<em>we give an example of a notation element for the nary 
function </em><tt>plus</tt><em>.</em><br /> 
</b><pre> 
&lt;Notation name="plus"&gt; 
  &lt;version precedence="10"&gt; 
    &lt;math&gt; 
      &lt;value xref="itheltPlus"&gt;1&lt;/value&gt; 
      &lt;sequence var="i"&gt; 
        &lt;minOccurs val="2"/&gt;&lt;maxOccurs xref="sizePlus"/&gt; 
        &lt;particle&gt; 
          &lt;mo&gt;+&lt;/mo&gt;&lt;value xref="itheltPlus"&gt;i&lt;/value&gt; 
        &lt;/particle&gt; 
      &lt;/sequence&gt; 
    &lt;/math&gt; 
  &lt;/version&gt; 
  &lt;semantic_template&gt; 
    &lt;OMOBJ&gt;&lt;OMA&gt; 
      &lt;OMS cd="arith1" name="plus"/&gt; 
      &lt;OMV name="seq" id="sequencePlus"/&gt; 
    &lt;/OMA&gt;&lt;/OMOBJ&gt; 
    &lt;OMBIND id="sizePlus"&gt; &lt;!-- return the length of a sequence --&gt; 
</pre>
{}
<mml:math overflow="scroll">
  <mml:mo> &#x2192; </mml:mo>
</mml:math>
<tt> #sequencePlus</tt><pre>
      &lt;/OMBIND&gt;
      &lt;OMBIND id="itheltPlus"&gt; &lt;!-- return the i'th element of a sequence --&gt;</pre>
<mml:math overflow="scroll">
  <mml:mrow>
    <mml:mi> i </mml:mi>
    <mml:mo> &#x2192; </mml:mo>
  </mml:mrow>
</mml:math>
<tt> sequencePlus.i</tt> 
<pre>      &lt;/OMBIND&gt;
    &lt;/semantic_template&gt; 
  &lt;/Notation&gt;
</pre></div><br />

The template functions of the preceding, perform utility operations 
like  selecting the i'th parameter to an nary operator, or selecting 
the i'th element of a vector. 
<br />More complex situations, for example notation specification for the 
structured matrices, specified in the content dictionary <tt>linalg5</tt> 
involve complicated mappings between the presentation and semantics, 
these often involve a two dimensional nesting of the XML Schema (like) 
expressions. 
<p></p>
<h1><a name="SECTION00040000000000000000"> 
4 Different styles at different levels</a> 
</h1> 
It is sometimes necessary to specify different styles at different 
nesting levels within the notation for some mathematical objects, for 
example, if it was required to print a <tt>matrix</tt> with <tt>style="round"</tt> which had entries which where rational numbers and it 
was required that they appear with <tt>style="display_style"</tt>. This 
is no problem if all the content of the matrix appears in the Extended 
MathML markup, for example, in order to markup a matrix which was to 
appear as: 
<br />(we are assuming that this is the display intended by the options <tt>style="round"</tt> for <tt>matrix</tt> and <tt>style="display_style"</tt> for 
rationals.)<div>
<center>
<mml:math display="block" overflow="scroll">
  <mml:mfenced>
    <mml:mtable>
      <mml:mtr>
        <mml:mtd>
          <mml:mfrac>
            <mml:mn> 1 </mml:mn>
            <mml:mn> 2 </mml:mn>
          </mml:mfrac>
        </mml:mtd>
        <mml:mtd>
          <mml:mfrac>
            <mml:mn> 1 </mml:mn>
            <mml:mn> 3 </mml:mn>
          </mml:mfrac>
        </mml:mtd>
      </mml:mtr>
      <mml:mtr>
        <mml:mtd>
          <mml:mfrac>
            <mml:mn> 1 </mml:mn>
            <mml:mn> 5 </mml:mn>
          </mml:mfrac>
        </mml:mtd>
        <mml:mtd>
          <mml:mfrac>
            <mml:mn> 1 </mml:mn>
            <mml:mn> 7 </mml:mn>
          </mml:mfrac>
        </mml:mtd>
      </mml:mtr>
    </mml:mtable>
  </mml:mfenced>
</mml:math>
</center>
</div><p></p> 
one could use the following Extended MathML markup: 
<pre> 
&lt;xm:apply&gt; 
  &lt;xm:matrix style="round"/&gt; 
  &lt;xm:apply&gt; 
    &lt;xm:matrixrow/&gt; 
    &lt;xm:apply&gt; 
      &lt;xm:rational style="display_style"/&gt; 
      &lt;xm:mn&gt;1&lt;/xm:mn&gt;&lt;xm:mn&gt;2&lt;/xm:mn&gt; 
    &lt;/xm:apply&gt; 
    &lt;xm:apply&gt; 
      &lt;xm:rational style="display_style"/&gt; 
      &lt;xm:mn&gt;1&lt;/xm:mn&gt;&lt;xm:mn&gt;3&lt;/xm:mn&gt; 
    &lt;/xm:apply&gt; 
  &lt;/xm:apply&gt; 
  &lt;xm:apply&gt; 
    &lt;xm:matrixrow/&gt; 
    &lt;xm:apply&gt; 
      &lt;xm:rational style="display_style"/&gt; 
      &lt;xm:mn&gt;1&lt;/xm:mn&gt;&lt;xm:mn&gt;5&lt;/xm:mn&gt; 
    &lt;/xm:apply&gt; 
    &lt;xm:apply&gt; 
      &lt;xm:rational style="display_style"/&gt; 
      &lt;xm:mn&gt;1&lt;/xm:mn&gt;&lt;xm:mn&gt;7&lt;/xm:mn&gt; 
    &lt;/xm:apply&gt; 
  &lt;/xm:apply&gt;
&lt;/xm:apply&gt;  
</pre> 
 
<p /> 
However we do have a problem if the elements of the output are 
implicit in the style for that object. For example, the markup for 
a 3x3 identity matrix with <tt>style="square"</tt> in Extended MathML would be: 
<pre> 
&lt;xm:apply&gt; 
  &lt;xm:identity style="square"/&gt; 
  &lt;cn&gt;3&lt;/cn&gt;    &lt;!-- N.B. this element does not occur in the presentation, --&gt; 
                &lt;!--      so we use content MathML. --&gt; 
&lt;/xm:apply&gt; 
</pre> This gives us no freedom to specialise the specification of the 
'<code>0</code>'s and '<code>1</code>'s which will appear in this markup. One 
could give a different <tt>version</tt> associated with the <tt>identity</tt> symbol for each different style of '<code>0</code>' or '<code>1</code>', 
but this was thought undesirable as it would mean that the number of 
<tt>version</tt> elements necessary to describe every presentation for a 
symbol would be exponential in the depth of implicit features in the 
notation. Another reason why do not proceed in this direction is that 
it is conceivable that there may exist notations, which have some 
recursive nature to their implicit features, and this would imply an 
infinite nature to the number of versions which where 
necessary. Clearly it is impossible to provide these. In order to 
avoid this problem we propose supplying this information in the value 
of the style attribute which must be supplied to specify anything but a 
default style. 
<br />The value of the style element should be a concatenation of the value 
used to specify the style for the outermost element, the '<code>[</code>' 
character, a sequence of strings to specify styles for inner elements 
separated by the '<code>;</code>' character and the '<code>]</code>' character. The strings 
used to specify inner elements should be modeled on the string 
<code>"name:val"</code>, where <code>name</code> is the name of the element and 
val is the value used to specify the <code>style</code> attribute for this 
element (which may have internal elements, in which case the same 
scheme is used recursively to provide a value for <code>val</code>). i.e.<br />
<center>
<font size="-1"><br /><code> style="val[name1:val1;name2:val2</code> 
<mml:math overflow="scroll">
  <mml:mo> &#x22EF; </mml:mo>
</mml:math>
 <code>]"</code></font> </center>
<br />where <code>val</code> is the name of the outermost 
element, and <code>name1</code>, <code>name2</code>, etc are the names of the 
inner elements, which have values <code>val1</code>, <code>val2</code>, etc. 
 
<p /> 
For example if it was required to display a 3x3 
identity matrix as:
<br /><table  border="0" >
<tr><td> 
<mml:math display="block" overflow="scroll">
  <mml:mfenced open="[" close="]">
    <mml:mtable>
      <mml:mtr>
        <mml:mtd>
          <mml:mn mathvariant="bold"> 1 </mml:mn>
        </mml:mtd>
        <mml:mtd>
          <mml:mn mathvariant="italic"> 0 </mml:mn>
        </mml:mtd>
        <mml:mtd>
          <mml:mn mathvariant="italic"> 0 </mml:mn>
        </mml:mtd>
      </mml:mtr>
      <mml:mtr>
        <mml:mtd>
          <mml:mn mathvariant="italic"> 0 </mml:mn>
        </mml:mtd>
        <mml:mtd>
          <mml:mn mathvariant="bold"> 1 </mml:mn>
        </mml:mtd>
        <mml:mtd>
          <mml:mn mathvariant="italic"> 0 </mml:mn>
        </mml:mtd>
      </mml:mtr>
      <mml:mtr>
        <mml:mtd>
          <mml:mn mathvariant="italic"> 0 </mml:mn>
        </mml:mtd>
        <mml:mtd>
          <mml:mn mathvariant="italic"> 0 </mml:mn>
        </mml:mtd>
        <mml:mtd>
          <mml:mn mathvariant="bold"> 1 </mml:mn>
        </mml:mtd>
      </mml:mtr>
    </mml:mtable>
  </mml:mfenced>
</mml:math>
</td><td> as opposed to </td>
<td> 
<mml:math display="block" overflow="scroll">
  <mml:mfenced open="[" close="]">
    <mml:mtable>
      <mml:mtr>
        <mml:mtd>
          <mml:mn> 1 </mml:mn>
        </mml:mtd>
        <mml:mtd>
          <mml:mn> 0 </mml:mn>
        </mml:mtd>
        <mml:mtd>
          <mml:mn> 0 </mml:mn>
        </mml:mtd>
      </mml:mtr>
      <mml:mtr>
        <mml:mtd>
          <mml:mn> 0 </mml:mn>
        </mml:mtd>
        <mml:mtd>
          <mml:mn> 1 </mml:mn>
        </mml:mtd>
        <mml:mtd>
          <mml:mn> 0 </mml:mn>
        </mml:mtd>
      </mml:mtr>
      <mml:mtr>
        <mml:mtd>
          <mml:mn> 0 </mml:mn>
        </mml:mtd>
        <mml:mtd>
          <mml:mn> 0 </mml:mn>
        </mml:mtd>
        <mml:mtd>
          <mml:mn> 1 </mml:mn>
        </mml:mtd>
      </mml:mtr>
    </mml:mtable>
  </mml:mfenced>
</mml:math>
</td></tr> 
</table> 
<br /> 
we would use the following markup:
<br />
<pre> 
&lt;xm:apply&gt; 
  &lt;xm:identity style="square[zero:italics;one:bold]"/&gt; 
  &lt;cn&gt; 3 &lt;/cn&gt; 
&lt;/xm:apply&gt; 
</pre><br /> 
 
<h1><a name="SECTION00050000000000000000"> 
5 Meta Stylesheets</a> 
</h1> 
The main theme of the paper [<a 
href="#naylorWatt">1</a>] concerns the process of 
producing <em>meta stylesheets</em> to construct XSLT stylesheets [<a 
href="#XSLT">7</a>] for 
converting documents written in an <em>extended MathML</em> into another 
form, for example presentation MathML. Now, one of the most difficult 
problems encountered in the construction of these meta stylesheets, is 
how to deal with the template functions. It is clear that for 
different template functions one may (not always, as certain 
mathematical objects are structurally similar with respect to their 
components, e.g. consider a vector and a list object) require 
different meta stylesheets in order to perform the 
desired translation. This could be seen as a never ending job if one 
is allowed total freedom in the OpenMath symbols used in the template 
functions (especially since OpenMath is an extensible markup 
mechanism). It is therefore necessary to specify a restricted 
vocabulary for use within the template functions. It may also occur 
that XSLT is ill-suited for performing some of the calculations 
implied by the template functions. We may use the XSLT <tt>document</tt> 
function, element in this case. 
One use of the <tt>document</tt> element would be to execute a Java 
method designed to perform the required calculation via a 
servlet. The Java method could take XML elements as its parameters and 
return XML as its return value, e.g. it might operate on an OpenMath 
expression and return a minimal form. 
 
<h1><a name="SECTION00060000000000000000"> 
6 Conclusion</a> 
</h1> 
By the use of the extensions suggested in section <a href="#extensions">3</a> to 
the scheme suggested in [<a 
href="#naylorWatt">1</a>] we may specify effective 
presentation/semantic mappings for mathematical objects which are not 
of a fixed size. With respect to a database of notation/content 
dictionary mappings written using this scheme, it will then be 
possible to specify mathematical notation which has an unambiguous 
meaning. We also suggest an effective markup which allows 
specification of different styles for implicit objects appearing at 
any level within a notation. With respect to implementing some 
conversions of this extended markup to some other form (for example, 
presentation MathML), we suggest the use of the XSLT <tt>document</tt> element, in conjunction with  servlets to communicate with 
external processes for performing calculations which are ill-suited 
to XSLT. 
 
<h1><a name="SECTION00070000000000000000"> 
1 Appendix: Partial Differentiation example</a> 
</h1><a name="tex2html3" 
href="#foot249"><sup>3</sup></a><a name="partialD"></a> We display a 
notation element for the <code>partialdiff</code> symbol. The version of the 
notation used here is that which will display as 
<mml:math overflow="scroll">
  <mml:mrow>
    <mml:mfrac>
      <mml:mrow>
        <mml:msup>
          <mml:mo> &#x2202; </mml:mo>
          <mml:mi> n </mml:mi>
        </mml:msup>
      </mml:mrow>
      <mml:mrow>
        <mml:mo> &#x2202; </mml:mo>
        <mml:msup>
          <mml:mi> x </mml:mi>
          <mml:msub>
            <mml:mi> n </mml:mi>
            <mml:mn> 1 </mml:mn>
          </mml:msub>
        </mml:msup>
        <mml:mo> &#x2202; </mml:mo>
        <mml:msup>
          <mml:mi> y </mml:mi>
          <mml:msub>
            <mml:mi> n </mml:mi>
            <mml:mn> 2 </mml:mn>
          </mml:msub>
        </mml:msup>
      </mml:mrow>
    </mml:mfrac>
    <mml:mi> f </mml:mi>
    <mml:mo> &#x2061; </mml:mo>
    <mml:mfenced separators=",">
      <mml:mi> x </mml:mi>
      <mml:mi> y </mml:mi>
    </mml:mfenced>
  </mml:mrow>
</mml:math>

. Where the function 
<mml:math overflow="scroll">
  <mml:mi> f </mml:mi>
</mml:math>
 is differentiated with 
respect to 
<mml:math overflow="scroll">
  <mml:mi> x </mml:mi>
</mml:math>
 and 
<mml:math overflow="scroll">
  <mml:mi> y </mml:mi>
</mml:math>
. The order of the 
differentiation is 
<mml:math overflow="scroll">
  <mml:msub>
    <mml:mi> n </mml:mi>
    <mml:mn> 1 </mml:mn>
  </mml:msub>
</mml:math>
 and 
<mml:math overflow="scroll">
  <mml:msub>
    <mml:mi> n </mml:mi>
    <mml:mn> 2 </mml:mn>
  </mml:msub>
</mml:math>
 with respect to 

<mml:math overflow="scroll">
  <mml:mi> x </mml:mi>
</mml:math>
 and 
<mml:math overflow="scroll">
  <mml:mi> y </mml:mi>
</mml:math>
 respectively and 
<mml:math overflow="scroll">
  <mml:mrow>
    <mml:mi> n </mml:mi>
    <mml:mo> = </mml:mo>
    <mml:msub>
      <mml:mi> n </mml:mi>
      <mml:mn> 1 </mml:mn>
    </mml:msub>
    <mml:mo> + </mml:mo>
    <mml:msub>
      <mml:mi> n </mml:mi>
      <mml:mn> 2 </mml:mn>
    </mml:msub>
  </mml:mrow>
</mml:math>
. 
<pre> 
&lt;Notation&gt;
  &lt;version precedence="100"&gt;
  &lt;image src="partialDiffDefault.gif"/&gt;
  &lt;tex&gt;
\frac{\partial^
     ...
  &lt;/tex&gt;
  &lt;math&gt;
    &lt;mrow&gt;
      &lt;mfrac&gt;
        &lt;msup&gt;&lt;mo&gt;&amp;part;&lt;/mo&gt;&lt;mi xref="sum"&gt;n&lt;/mi&gt;&lt;/msup&gt;
        &lt;mrow&gt;&lt;msup&gt;
          &lt;mrow&gt;&lt;mo&gt;&amp;part;&lt;/mo&gt;
            &lt;mi xref="x"&gt;x&lt;/mi&gt;
          &lt;mrow&gt;
          &lt;msub xref="n1"&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/msub&gt;&lt;/msup&gt;
          &lt;mrow&gt;&lt;mo&gt;&amp;part;&lt;/mo&gt;
            &lt;mi xref="y"&gt;y&lt;/mi&gt;
          &lt;mrow&gt;
          &lt;msub xref="n2"&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msub&gt;&lt;/msup&gt;
        &lt;/mrow&gt;
      &lt;/mfrac&gt;
      &lt;mi&gt;f&lt;/mi&gt;
      &lt;mo&gt;&amp;ApplyFunction;&lt;/mo&gt;
      &lt;mfenced&gt;
        &lt;mi xref="x"&gt;x&lt;/mi&gt;
        &lt;mi xref="y"&gt;y&lt;/mi&gt;
      &lt;/mfenced&gt;
    &lt;/mrow&gt;
  &lt;/math&gt;
  &lt;/version&gt;
  &lt;semantic_template&gt;
    &lt;OMOBJ&gt; &lt;!-- this OMOBJ is the prototype --&gt;
      &lt;OMA&gt;&lt;OMS cd="calculus2" name="partialdiff"/&gt;
        &lt;OMA&gt;&lt;OMS cd="list1" name="list"/&gt;
          &lt;OMA&gt;&lt;OMS cd="list1" name="list"/&gt;
            &lt;OMI id='x'&gt; 1 &lt;/OMI&gt;
            &lt;OMV name="n1" id="n1"/&gt;
          &lt;/OMA&gt;
          &lt;OMA&gt;&lt;OMS cd="list1" name="list"/&gt;
            &lt;OMI id='y'&gt; 2 &lt;/OMI&gt;
            &lt;OMV name="n2" id="n2"/&gt;
          &lt;/OMA&gt;
        &lt;/OMA&gt;
        &lt;OMV name="f" id="functionName"/&gt; &lt;!-- this is the function --&gt;
      &lt;/OMA&gt;
    &lt;/OMOBJ&gt;
&lt;!-- the following function specification calculates the sum of the the two 
     orders located in the prototype --&gt;
    &lt;OMBIND id="sum"&gt;
      &lt;OMS cd="fns1" name="lambda"/&gt;
      &lt;OMBVAR&gt;
      &lt;/OMBVAR&gt;
      &lt;OMA&gt;
        &lt;OMS cd="arith1" name="plus"/&gt;
        &lt;OMV name="n1" xref="n1"/&gt;
        &lt;OMV name="n2" xref="n2"/&gt;
      &lt;/OMA&gt;
    &lt;/OMBIND&gt;
  &lt;/semantic_template&gt;
&lt;/Notation&gt;
</pre>
 
<h2><a name="SECTION00071000000000000000"> 
Definition of some Non Standard Symbols</a> 
</h2> 
We give some definitions of symbols which have been used in the 
preceding, but which are not part of the standard OpenMath content 
dictionaries at present. 
<dl> 
<dt><tt>partialdiff</tt>:</dt> 
<dd>This symbol represents the partial-differentiation 
of a function with respect to a number of 
variables. The arguments should be given in the following form: 
<dl> 
<dt>first</dt> 
<dd>argument - A list of pairs, where the first element of 
each pair is an index to the variable with respect to which the 
differentiation is taken, the second element is the order of that 
differentiation. 
</dd> 
<dt>second</dt> 
<dd>argument - The function on which the partial 
differentiation is taking place. 
</dd> 
</dl> 
</dd> 
</dl> 
 
<p /> 
 
<h2><a name="SECTION00080000000000000000"> 
Bibliography</a> 
</h2>
<dl><dt><a name="naylorWatt">1</a> </dt>
<dd> Bill Naylor, Stephen Watt: Meta Stylesheets for 
the Conversion of Mathematical Documents into Multiple Forms, 
Proceedings of the first International Workshop on Mathematical 
Knowledge Management, September 2001 </dd>
<dt><a name="MathML">2</a> </dt>
<dd> MathML: <a href="http://www.w3.org/TR/MathML2">http://www.w3.org/TR/MathML2</a> </dd>
<dt><a name="OpenMathStd">3</a> </dt>
<dd> O.Caprotti, D.P.Carlisle, A.M.Cohen: The 
OpenMath Standard, February 2000 </dd>
<dt><a name="OpenMath">4</a> </dt>
<dd> The OpenMath Society: <a href="http://www.openmath.org/">http://www.openmath.org/</a> </dd>
<dt><a name="OMDoc">5</a> </dt>
<dd> OMDoc, A standard for <em>O</em>pen <em>M</em>athematical 
<em>Doc</em>uments: 
<br /><a href="http://www.mathweb.org/omdoc/">http://www.mathweb.org/omdoc/</a> </dd>
<dt><a name="XMLSchema">6</a> </dt>
<dd> XML Schema: <a href="http://www.w3.org/XML/Schema">http://www.w3.org/XML/Schema</a></dd>
<dt><a name="XSLT">7</a> </dt>
<dd> XSLT: <a href="http://www.w3.org/TR/xslt">http://www.w3.org/TR/xslt</a></dd>
</dl> 
 <H4>Footnotes</H4>
<dl> 
<dt><a name="foot235">...<tt>BesselJ(1,2):</tt></a><a name="foot235" 
href="#tex2html1"><sup>1</sup></a> </dt>
<dd>in this markup it is assumed that the prefix 
<tt>xm</tt> has been bound (in an enclosing element) to a URI indicating 
the Extended MathML namespace. </dd>
 
<dt><a name="foot241">... example:</a><a name="foot241" 
href="#tex2html2"><sup>2</sup></a> </dt>
<dd>The <tt>xsd</tt> prefixes 
which appear on some elements will be declared to imply the XML Schema 
namespace; <a href="http:www.w3.org/2001/XMLSchema">http:www.w3.org/2001/XMLSchema</a>. This declaration should 
appear in some ancestor element. </dd>
 
<dt><a name="foot249">...&nbsp;</a><a name="foot249" 
href="#tex2html3"><sup>3</sup></a> </dt>
<dd>We note here that 
the symbol <tt>partialdiff</tt> from the content dictionary <tt>calculus2</tt> are 
not part of the OpenMath standard at present. </dd>
 
</dl><hr /> 
<address> 
Bill Naylor 
2002-03-28 
</address> 
</body> 
</html> 

