]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/mmlctop.xsl-0.14
This commit was manufactured by cvs2svn to create branch
[helm.git] / helm / style / mmlctop.xsl-0.14
diff --git a/helm/style/mmlctop.xsl-0.14 b/helm/style/mmlctop.xsl-0.14
deleted file mode 100755 (executable)
index 1568e1d..0000000
+++ /dev/null
@@ -1,3103 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- ******************************************************
-    
-     XSL Transform of MathML content to MathML presentation
-                                                    
-     Version 0.14, Dec. 13, 2000       
-     Authors Igor Rodionov <igor@csd.uwo.ca>,
-             Stephen Watt  <watt@csd.uwo.ca>.
-    
-     (C) Copyright 2000  Symbolic Computation Laboratory,
-                         University of Western Ontario,
-                         London, Canada N6A 5B7.
-     ****************************************************** -->
-
-
-<!-- ====================================================== -->
-<!--  April,28 2001 - HELM group:                           -->
-<!--  Added the namespace prefix to all the output elements -->
-<!--  Added the namespace prefix to all the xref attributes -->
-<!--  Changed the mml prefix into m                         -->
-<!--  Added xref to every mo element                        -->
-<!--  Changed mchar into the corresponding entity           -->
-<!--  First draft: April 27 2001, Irene Schena              -->
-<!-- ====================================================== -->
-
-<!-- Mostly complies with the W3C MathML 2.0 Candidate Recommenation 
-     of November 13, 2000.  The main difference is the use of <mchar>
-     which was removed from MathML 2.0 in the last working draft.
-  -->
-
-<xsl:stylesheet id="mmlctop.xsl"
-                version="1.0"
-                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:m="http://www.w3.org/1998/Math/MathML">
-
-<!-- HELM: we don't have a default namespace.
-     Removed xmlns="http://www.w3.org/1998/Math/MathML" -->
-
-<!-- HELM: was
-<xsl:output method="xml" indent="yes"/>
--->
-<xsl:output method="xml"/>
-<!-- HELM -->
-
-<xsl:strip-space elements="apply semantics annotation-xml
-        csymbol fn cn ci interval matrix matrixrow vector
-        lambda bvar condition logbase degree set list
-        lowlimit uplimit"/>
-
-
-<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-<!--         Parameters, variables and constants           -->
-<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-
-<!-- ~~~~~~~~ Semantics related *constants*: ~~~~~~~~ -->
-
-<!-- Strip off semantics -->
-<xsl:variable name="SEM_STRIP" select="-1"/>
-
-<!-- Pass semantics "as is" -->
-<xsl:variable name="SEM_PASS" select="0"/>
-
-<!-- Add semantics at top level only -->
-<xsl:variable name="SEM_TOP" select="1"/>
-
-<!-- Add semantics at all levels -->
-<xsl:variable name="SEM_ALL" select="2"/>
-
-<!-- Semantics at top level only, with id refs -->
-<!-- NOTE: ids have to be already present in the
-           input for this feature to work. -->
-<xsl:variable name="SEM_XREF" select="3"/>
-
-<!-- No semantics at top level, with id refs -->
-<!-- NOTE: ids have to be already present in the
-           input for this feature to work. -->
-<xsl:variable name="SEM_XREF_EXT" select="4"/>
-
-
-<!-- ~~~~~~~~~~ Stylesheet *parameter*: SEM_SW ~~~~~~~~~~~~~~ -->
-<!-- Assumes one of the above values; SEM_PASS is the default -->
-<!-- The default can be overridden by specifying different    -->
-<!-- value on the command line when the stylesheet is invoked -->
-
-<!-- HELM: $SEM_SW was SEM_PASS (error!) -->
-<xsl:param name="SEM_SW" select="$SEM_XREF"/>
-
-<!-- ~~~~~~ Operator precedence definitions ~~~~~~ -->
-
-<xsl:variable name="NO_PREC" select="0"/>
-<xsl:variable name="UNION_PREC" select="1"/>
-<xsl:variable name="SETDIFF_PREC" select="1"/>
-<xsl:variable name="INTERSECT_PREC" select="3"/>
-<xsl:variable name="OR_PREC" select="5"/>
-<xsl:variable name="XOR_PREC" select="5"/>
-<xsl:variable name="AND_PREC" select="7"/>
-<xsl:variable name="PLUS_PREC" select="9"/>
-<xsl:variable name="MINUS_PREC" select="9"/>
-<xsl:variable name="MUL_PREC" select="11"/>
-<xsl:variable name="DIV_PREC" select="11"/>
-<xsl:variable name="NEG_PREC" select="13"/>
-<xsl:variable name="FUNCTION_PREC" select="99"/>
-
-<!-- ~~~~~ Miscellaneous constant definitions ~~~~~ -->
-
-<xsl:variable name="YES" select="1"/>
-<xsl:variable name="NO" select="0"/>
-<xsl:variable name="NO_PARAM" select="-1"/>
-<xsl:variable name="PAR_SAME" select="-3"/>
-<xsl:variable name="PAR_YES" select="-5"/>
-<xsl:variable name="PAR_NO" select="-7"/>
-
-
-<!-- +++++++++++++++++ INDEX OF TEMPLATES +++++++++++++++++++ -->
-
-<!-- All templates are subdivided into the following categories
-     (listed in the order of appearance in the stylesheet):
-
-THE TOPMOST ELEMENT: MATH
- math
-
-SEMANTICS HANDLING
- semantics
-
-BASIC CONTAINER ELEMENTS
- cn, ci, csymbol
-
-BASIC CONTENT ELEMENTS
- fn, interval, inverse, sep, condition, declare, lambda, compose, ident
-
-ARITHMETIC, ALGEBRA & LOGIC
- quotient, exp, factorial, max, min, minus, plus, power, rem, divide,
- times, root, gcd, and, or, xor, not, forall, exists, abs, conjugate,
- arg, real, imaginary
-
-RELATIONS
- neq, approx, tendsto, implies, in, notin, notsubset, notprsubset,
- subset, prsubset, eq, gt, lt, geq, leq, equivalent
-
-CALCULUS
- ln, log, diff, partialdiff, lowlimit, uplimit, bvar, degree,
- logbase, divergence, grad, curl, laplacian
-
-SET THEORY
- set, list, union, intersect, setdiff, card
-
-SEQUENCES AND SERIES
- sum, product, limit
-
-TRIGONOMETRY
- sin, cos, tan, sec, csc, cot, sinh, cosh, tanh, sech, csch, coth,
- arcsin, arccos, arctan
-
-STATISTICS
- mean, sdev, variance, median, mode, moment
-
-LINEAR ALGEBRA
- vector, matrix, matrixrow, determinant, transpose, selector,
- vectorproduct, scalarproduct, outerproduct
--->
-
-
-<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ TEMPLATES ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-
-
-<!-- ***************** THE TOPMOST ELEMENT: MATH ***************** -->
-
-<xsl:template match = "m:math">
-  <xsl:choose>
-    <xsl:when test="$SEM_SW=$SEM_TOP or $SEM_SW=$SEM_ALL and *[2] or
-                                                    $SEM_SW=$SEM_XREF">
-      <m:semantics>
-        <m:mrow>
-          <xsl:apply-templates mode = "semantics"/>
-        </m:mrow>
-        <m:annotation-xml encoding="MathML">
-          <xsl:copy-of select="*"/>
-        </m:annotation-xml>
-      </m:semantics>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:mrow>
-        <xsl:apply-templates mode = "semantics"/>
-      </m:mrow>  
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-
-<!-- ***************** SEMANTICS HANDLING ***************** -->
-
-<!-- This template is called recursively.  At each level   -->
-<!-- in the source tree it decides whether to strip off,   -->
-<!-- pass or add semantics at that level (depending on the -->
-<!-- value of SEM_SW parameter).  Then the actual template -->
-<!-- is applied to the node.                               -->
-
-<xsl:template match = "m:*" mode = "semantics">
-  <xsl:param name="IN_PREC" select="$NO_PREC"/>
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:choose>
-    <xsl:when test="$SEM_SW=$SEM_STRIP and self::m:semantics">
-      <xsl:apply-templates select="m:annotation-xml[@encoding='MathML']">
-        <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
-        <xsl:with-param name="PARAM" select="$PARAM"/>
-        <xsl:with-param name="PAREN" select="$PAREN"/>
-        <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-      </xsl:apply-templates>
-    </xsl:when>
-    <xsl:when test="($SEM_SW=$SEM_PASS or $SEM_SW=$SEM_TOP) and self::m:semantics">
-      <m:semantics>
-        <xsl:apply-templates select="*[1]">
-          <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
-          <xsl:with-param name="PARAM" select="$PARAM"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-        <xsl:copy-of select="m:annotation-xml"/>
-      </m:semantics>
-    </xsl:when>
-    <xsl:when test="$SEM_SW=$SEM_ALL">
-      <m:semantics>
-        <xsl:choose>
-          <xsl:when test="self::m:semantics">
-            <xsl:apply-templates select="*[1]">
-              <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
-              <xsl:with-param name="PARAM" select="$PARAM"/>
-              <xsl:with-param name="PAREN" select="$PAREN"/>
-              <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-            </xsl:apply-templates>
-            <xsl:copy-of select="m:annotation-xml"/>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:apply-templates select=".">
-              <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
-              <xsl:with-param name="PARAM" select="$PARAM"/>
-              <xsl:with-param name="PAREN" select="$PAREN"/>
-              <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-            </xsl:apply-templates>
-            <m:annotation-xml encoding="MathML">
-              <xsl:copy-of select="."/>
-            </m:annotation-xml>
-          </xsl:otherwise>
-        </xsl:choose>
-      </m:semantics>
-    </xsl:when>
-    <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:choose>
-<!-- HELM: syntax error: sematics -->
-        <xsl:when test="self::m:semantics">
-          <xsl:copy>
-            <xsl:copy-of select="@*"/>
-            <xsl:attribute name="xref">
-              <xsl:value-of select="@id"/>
-            </xsl:attribute>
-            <xsl:copy-of select="*[1]"/>
-            <xsl:copy-of select="m:annotation-xml"/>
-          </xsl:copy>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:apply-templates select=".">
-            <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
-            <xsl:with-param name="PARAM" select="$PARAM"/>
-            <xsl:with-param name="PAREN" select="$PAREN"/>
-            <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-          </xsl:apply-templates>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:choose>
-        <xsl:when test="self::m:semantics">
-          <xsl:copy-of select="."/>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:apply-templates select=".">
-            <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
-            <xsl:with-param name="PARAM" select="$PARAM"/>
-            <xsl:with-param name="PAREN" select="$PAREN"/>
-            <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-          </xsl:apply-templates>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:semantics">
-  <xsl:apply-templates select="." mode = "semantics"/>
-</xsl:template>
-
-
-<!-- ***************** BASIC CONTAINER ELEMENTS ***************** -->
-
-<!-- HELM: cn could not contain MAthML presentation -->
-<xsl:template match = "m:cn">
-  <xsl:param name="IN_PREC" select="$NO_PREC"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-<!-- HELM: added -->
-<!-- CSC
-<xsl:choose>
-  <xsl:when test="child::text()">
--->
-<!-- HELM -->
-  <xsl:choose>
-    <xsl:when test=". &lt; 0 and $IN_PREC &gt; $NO_PREC and $PAREN=$PAR_NO
-                                                   and $PAR_NO_IGNORE=$NO">
-      <m:mfenced separators="">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="cn"/>
-      </m:mfenced>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:choose>
-        <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:apply-templates select="." mode="cnid"/>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:apply-templates select="." mode="cn"/>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:otherwise>
-  </xsl:choose>
-<!-- HELM: added -->
-<!--CSC
-  </xsl:when>
-  <xsl:otherwise>
-   <m:mrow>
-    <xsl:attribute name="xref">
-     <xsl:value-of select="@id"/>
-    </xsl:attribute>
-    <xsl:copy-of select="*"/>
-   </m:mrow> 
-  </xsl:otherwise>
- </xsl:choose>
--->
-<!-- HELM -->
-</xsl:template>
-
-<xsl:template match = "m:cn" mode="cn">
-  <xsl:choose>
-    <xsl:when test="@base and (not(@type) or @type='integer' or @type='real')">
-      <m:msub>
-        <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
-        <m:mn> <xsl:value-of select="@base"/> </m:mn>
-      </m:msub>
-    </xsl:when>
-    <xsl:when test="@type='complex' and not(@base) and child::m:sep[1]">
-      <m:mfenced separators="">
-        <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
-        <xsl:if test="text()[2] &lt; 0">
-          <m:mo>-</m:mo>
-          <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
-        </xsl:if>
-        <xsl:if test="not(text()[2] &lt; 0)">
-          <m:mo>+</m:mo>
-          <m:mn> <xsl:value-of select="text()[2]"/> </m:mn>
-        </xsl:if>
-        <m:mo>&#x02062;</m:mo>
-        <m:mo>i</m:mo>
-      </m:mfenced>
-    </xsl:when>
-    <xsl:when test="@type='complex' and @base and child::m:sep[1]">
-      <m:msub>
-        <m:mfenced separators="">
-          <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
-          <xsl:if test="text()[2] &lt; 0">
-            <m:mo>-</m:mo>
-            <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
-          </xsl:if>
-          <xsl:if test="not(text()[2] &lt; 0)">
-            <m:mo>+</m:mo>
-            <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
-          </xsl:if>
-          <m:mo>&#x02062;</m:mo>
-          <m:mo>i</m:mo>
-        </m:mfenced>
-        <m:mn> <xsl:value-of select="@base"/> </m:mn>
-      </m:msub>
-    </xsl:when>
-    <xsl:when test="@type='rational' and not(@base) and child::m:sep[1]">
-      <m:mfrac>
-        <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
-        <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
-      </m:mfrac>
-    </xsl:when>
-    <xsl:when test="@type='rational' and @base and child::m:sep[1]">
-      <m:msub>
-        <m:mfenced>
-          <m:mfrac>
-            <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
-            <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
-          </m:mfrac>
-        </m:mfenced>
-        <m:mn> <xsl:value-of select="@base"/> </m:mn>
-      </m:msub>
-    </xsl:when>
-    <xsl:when test="@type='polar' and not(@base) and child::m:sep[1]">
-      <m:mrow>
-        <m:mo>Polar</m:mo>
-        <m:mo>&#x02062;</m:mo>
-        <m:mfenced separators=",">
-          <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
-          <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
-        </m:mfenced>
-      </m:mrow>
-    </xsl:when>
-    <xsl:when test="@type='polar' and @base and child::m:sep[1]">
-      <m:msub>
-        <m:mrow>
-          <m:mo>Polar</m:mo>
-          <m:mo>&#x02062;</m:mo>
-          <m:mfenced separators=",">
-            <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
-            <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
-          </m:mfenced>
-        </m:mrow>
-        <m:mn> <xsl:value-of select="@base"/> </m:mn>
-      </m:msub>
-   </xsl:when>
-   <xsl:otherwise>
-<!--HELM: Was:
- <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
-HELM: Now is: -->
-    <xsl:choose>
-     <xsl:when test="child::text() and not(*[1])">
-      <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
-     </xsl:when>
-     <xsl:otherwise>
-      <xsl:choose>
-       <xsl:when test="not(*[2])">
-        <xsl:copy-of select="*[1]"/>
-       </xsl:when>
-       <xsl:otherwise>
-        <m:mrow>
-         <xsl:copy-of select="*|text()"/>
-        </m:mrow>
-       </xsl:otherwise>
-      </xsl:choose>
-     </xsl:otherwise>
-    </xsl:choose>
-<!-- HELM -->
-   </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:cn" mode="cnid">
-  <xsl:choose>
-    <xsl:when test="@base and (not(@type) or @type='integer' or @type='real')">
-      <m:msub xref="{@id}">
-        <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
-        <m:mn> <xsl:value-of select="@base"/> </m:mn>
-      </m:msub>
-    </xsl:when>
-    <xsl:when test="@type='complex' and not(@base) and child::m:sep[1]">
-      <m:mfenced separators="" xref="{@id}">
-        <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
-        <xsl:if test="text()[2] &lt; 0">
-          <m:mo>-</m:mo>
-          <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
-        </xsl:if>
-        <xsl:if test="not(text()[2] &lt; 0)">
-          <m:mo>+</m:mo>
-          <m:mn> <xsl:value-of select="text()[2]"/> </m:mn>
-        </xsl:if>
-        <m:mo>&#x02062;</m:mo>
-        <m:mo>i</m:mo>
-      </m:mfenced>
-    </xsl:when>
-    <xsl:when test="@type='complex' and @base and child::m:sep[1]">
-      <m:msub xref="{@id}">
-        <m:mfenced separators="">
-          <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
-          <xsl:if test="text()[2] &lt; 0">
-            <m:mo>-</m:mo>
-            <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
-          </xsl:if>
-          <xsl:if test="not(text()[2] &lt; 0)">
-            <m:mo>+</m:mo>
-            <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
-          </xsl:if>
-          <m:mo>&#x02062;</m:mo>
-          <m:mo>i</m:mo>
-        </m:mfenced>
-        <m:mn> <xsl:value-of select="@base"/> </m:mn>
-      </m:msub>
-    </xsl:when>
-    <xsl:when test="@type='rational' and not(@base) and child::m:sep[1]">
-      <m:mfrac xref="{@id}">
-        <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
-        <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
-      </m:mfrac>
-    </xsl:when>
-    <xsl:when test="@type='rational' and @base and child::m:sep[1]">
-      <m:msub xref="{@id}">
-        <m:mfenced>
-          <m:mfrac>
-            <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
-            <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
-          </m:mfrac>
-        </m:mfenced>
-        <m:mn> <xsl:value-of select="@base"/> </m:mn>
-      </m:msub>
-    </xsl:when>
-    <xsl:when test="@type='polar' and not(@base) and child::m:sep[1]">
-      <m:mrow xref="{@id}">
-        <m:mo>Polar</m:mo>
-        <m:mo>&#x02062;</m:mo>
-        <m:mfenced separators=",">
-          <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
-          <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
-        </m:mfenced>
-      </m:mrow>
-    </xsl:when>
-    <xsl:when test="@type='polar' and @base and child::m:sep[1]">
-      <m:msub xref="{@id}">
-        <m:mrow>
-          <m:mo>Polar</m:mo>
-          <m:mo>&#x02062;</m:mo>
-          <m:mfenced separators=",">
-            <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
-            <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
-          </m:mfenced>
-        </m:mrow>
-        <m:mn> <xsl:value-of select="@base"/> </m:mn>
-      </m:msub>
-   </xsl:when>
-   <xsl:otherwise>
-    <xsl:choose>
-     <xsl:when test="child::text() and not(*[1])">
-      <m:mn xref="{@id}"> <xsl:apply-templates mode = "semantics"/> </m:mn>
-     </xsl:when>
-     <xsl:otherwise>
-      <xsl:variable name="id" select="@id"/>
-      <xsl:choose>
-       <xsl:when test="not(*[2])">
-        <xsl:for-each select="*[1]">
-         <xsl:copy>
-          <xsl:attribute name="xref">
-           <xsl:value-of select="$id"/>
-          </xsl:attribute>
-          <xsl:copy-of select="@*|*"/>
-         </xsl:copy>
-        </xsl:for-each>
-       </xsl:when>
-       <xsl:otherwise>
-        <m:mrow xref="{$id}">
-         <xsl:copy-of select="*|text()"/>
-        </m:mrow>
-       </xsl:otherwise>
-      </xsl:choose>
-     </xsl:otherwise>
-    </xsl:choose>
-   </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<!-- HELM: ci could not contain MAthML presentation -->
-<xsl:template match = "m:ci">
-<!-- HELM -->
-  <xsl:choose>
-    <xsl:when test="@type='vector' or @type=matrix or @type=set">
-      <m:mi fontweight="bold">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates mode = "semantics"/>
-      </m:mi>
-    </xsl:when>
-    <xsl:when test="child::text() and not(child::*[1])">
-      <m:mi>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-<!-- HELM: added mode=semantics -->
-        <xsl:apply-templates mode = "semantics"/>
-      </m:mi>
-    </xsl:when>
-    <xsl:when test="child::text() and *[1] and not(*[1]=m:sep)">
-      <m:mrow>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-<!-- HELM: added mode=semantics -->
-        <xsl:apply-templates mode = "semantics"/>
-      </m:mrow>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:if test="*[2]">
-        <m:mrow>
-          <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-            <xsl:attribute name="xref">
-              <xsl:value-of select="@id"/>
-            </xsl:attribute>
-          </xsl:if>
-          <xsl:apply-templates select="*"/>
-        </m:mrow>
-      </xsl:if>
-      <xsl:if test="not(*[2])">
-<!--HELM: Was:
-        <xsl:apply-templates select="*[1]"/>
-HELM: Now is: -->
-        <xsl:variable name="id" select="@id"/>
-        <xsl:for-each select="*[1]">
-         <xsl:copy>
-          <xsl:attribute name="xref">
-           <xsl:value-of select="$id"/>
-          </xsl:attribute>
-         <xsl:copy-of select="@*|*"/>
-         </xsl:copy>
-        </xsl:for-each>
-<!-- HELM -->
-      </xsl:if>
-    </xsl:otherwise>
-  </xsl:choose>
-<!-- HELM -->
-</xsl:template>
-
-<xsl:template match = "m:ci/m:*[not(self::m:sep)]">
-  <xsl:copy-of select = "."/>
-</xsl:template>
-
-<!-- HELM: previous Version x.xx from Feb. 18, 2000 -->
-<xsl:template match = "m:csymbol">
-<!-- HELM: added -->
-   <m:mrow>
-    <xsl:attribute name="xref">
-     <xsl:value-of select="@id"/>
-    </xsl:attribute>
-<!-- HELM -->
-   <xsl:choose>
-    <xsl:when test="*[1]">
-     <xsl:copy-of select = "*"/>
-    </xsl:when>
-   <xsl:otherwise>
-    <m:mo>
-     <xsl:apply-templates mode = "semantics"/>
-    </m:mo>
-   </xsl:otherwise>
-  </xsl:choose>
- </m:mrow>
-</xsl:template>
-
-
-<!-- HELM: csymbol cannot contain ci or cn elements, but only text or 
-presentation elements. PCDATA should render as if it were wrapped in 
-an mo. Mixed content: mrow which contains mo + presentation elements -->
-<!--<xsl:template match = "m:csymbol/m:*">
-  <xsl:choose>
-    <xsl:when test="self::m:cn or self::m:ci">
-      <xsl:apply-templates mode = "semantics"/>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:copy-of select = "."/>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:csymbol/text()">
-  <xsl:choose>
-    <xsl:when test=". &lt; 0 or . = 0 or . &gt; 0">
-      <mn> <xsl:copy-of select = "."/> </mn>
-    </xsl:when>
-    <xsl:otherwise>
-      <mi> <xsl:copy-of select = "."/> </mi>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>-->
-
-
-<!-- ***************** BASIC CONTENT ELEMENTS ***************** -->
-
-<xsl:template match = "m:apply[m:*[1][self::m:fn]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:apply-templates select = "m:fn[1]" mode = "semantics"/>
-    <m:mo> 
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:fn/@id"/>
-          </xsl:attribute>
-        </xsl:if>&#x02061;</m:mo>
-    <m:mfenced separators=",">
-      <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
-    </m:mfenced>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:fn">
-  <xsl:apply-templates select = "*[1]" mode = "semantics">
-    <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
-  </xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match = "m:interval">
-  <m:mfenced separators=",">
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:if test="@closure='closed' or @closure='closed-open'">
-      <xsl:attribute name="open">[</xsl:attribute>
-    </xsl:if>
-    <xsl:if test="@closure='closed' or @closure='open-closed'">
-      <xsl:attribute name="close">]</xsl:attribute>
-    </xsl:if>
-    <xsl:apply-templates select="*" mode = "semantics"/>
-  </m:mfenced>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:*[1][self::m:apply[m:inverse[1]]]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:apply-templates select = "*[1]" mode = "semantics"/>
-    <m:mo>&#x02061;</m:mo>
-    <m:mfenced separators=",">
-      <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
-    </m:mfenced>
- </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[*[1][self::m:inverse]]">
-  <xsl:choose>
-    <xsl:when test="*[2]=m:exp or *[2]=m:ln or *[2]=m:sin or *[2]=m:cos or
-                    *[2]=m:tan or *[2]=m:sec or *[2]=m:csc or *[2]=m:cot or
-                    *[2]=m:sinh or *[2]=m:cosh or *[2]=m:tanh or *[2]=m:sech or
-                    *[2]=m:csch or *[2]=m:coth or *[2]=m:arcsin or
-                    *[2]=m:arccos or *[2]=m:arctan">
-      <m:mo>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="*[2]" mode="inverse"/>
-      </m:mo>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:msup>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select = "*[2]"/>
-        <m:mfenced>
-          <m:mn>-1</m:mn>
-        </m:mfenced>
-      </m:msup>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "*" mode="inverse">
-  <xsl:choose>
-    <xsl:when test="self::m:exp">
-      <xsl:value-of select="'ln'"/>
-    </xsl:when>
-    <xsl:when test="self::m:ln">
-      <xsl:value-of select="'exp'"/>
-    </xsl:when>
-    <xsl:when test="self::m:sin">
-      <xsl:value-of select="'arcsin'"/>
-    </xsl:when>
-    <xsl:when test="self::m:cos">
-      <xsl:value-of select="'arccos'"/>
-    </xsl:when>
-    <xsl:when test="self::m:tan">
-      <xsl:value-of select="'arctan'"/>
-    </xsl:when>
-    <xsl:when test="self::m:sec">
-      <xsl:value-of select="'arcsec'"/>
-    </xsl:when>
-    <xsl:when test="self::m:csc">
-      <xsl:value-of select="'arccsc'"/>
-    </xsl:when>
-    <xsl:when test="self::m:cot">
-      <xsl:value-of select="'arccot'"/>
-    </xsl:when>
-    <xsl:when test="self::m:sinh">
-      <xsl:value-of select="'arcsinh'"/>
-    </xsl:when>
-    <xsl:when test="self::m:cosh">
-      <xsl:value-of select="'arccosh'"/>
-    </xsl:when>
-    <xsl:when test="self::m:tanh">
-      <xsl:value-of select="'arctanh'"/>
-    </xsl:when>
-    <xsl:when test="self::m:sech">
-      <xsl:value-of select="'arcsech'"/>
-    </xsl:when>
-    <xsl:when test="self::m:csch">
-      <xsl:value-of select="'arccsch'"/>
-    </xsl:when>
-    <xsl:when test="self::m:coth">
-      <xsl:value-of select="'arccoth'"/>
-    </xsl:when>
-    <xsl:when test="self::m:arcsin">
-      <xsl:value-of select="'sin'"/>
-    </xsl:when>
-    <xsl:when test="self::m:arccos">
-      <xsl:value-of select="'cos'"/>
-    </xsl:when>
-    <xsl:when test="self::m:arctan">
-      <xsl:value-of select="'tan'"/>
-    </xsl:when>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:sep"/>
-
-<xsl:template match = "m:condition">
-  <xsl:choose>
-    <xsl:when test="parent::m:apply[m:forall[1]]"/>
-    <xsl:otherwise>
-      <xsl:choose>
-        <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <m:mrow xref="{@id}">
-            <xsl:apply-templates select="*" mode = "semantics"/>
-          </m:mrow>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:if test="not(*[2])">
-            <xsl:apply-templates select="*" mode = "semantics"/>
-          </xsl:if>
-          <xsl:if test="*[2]">
-            <m:mrow>
-              <xsl:apply-templates select="*" mode = "semantics"/>
-            </m:mrow>
-          </xsl:if>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:declare"/>
-
-<xsl:template match = "m:lambda">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mo>&#x0039B;</m:mo>
-    <m:mo>&#x02061;</m:mo>
-    <m:mfenced separators=",">
-      <xsl:for-each select = "*">
-        <xsl:choose>
-          <xsl:when test="self::m:ci or self::m:cn">
-            <xsl:apply-templates select = "." mode="semantics"/>
-          </xsl:when>
-          <xsl:otherwise>
-            <m:mrow>
-              <xsl:apply-templates select = "." mode="semantics"/>
-            </m:mrow>
-          </xsl:otherwise>
-        </xsl:choose>
-      </xsl:for-each>
-    </m:mfenced>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[*[1][self::m:apply[m:compose[1]]]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:apply-templates select = "*[1]" mode = "semantics"/>
-    <m:mo>&#x02061;</m:mo>
-    <m:mfenced separators=",">
-      <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
-    </m:mfenced>
- </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[*[1][self::m:compose]]">
-  <m:mfenced separators="">
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:apply-templates select = "m:*[2][self::m:ci[@type='fn'] |
-                                       self::m:fn]" mode="semantics"/>
-    <xsl:for-each select = "m:*[position()>2][self::m:ci[@type='fn'] |
-                                                            self::m:fn]">
-      <m:mo>
- <!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:compose/@id"/>
-          </xsl:attribute>
-        </xsl:if>&#x02218;</m:mo>
-      <xsl:apply-templates select = "." mode="semantics"/>
-    </xsl:for-each>
-  </m:mfenced>
-</xsl:template>
-
-<xsl:template match = "m:ident">
-  <xsl:choose>
-    <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <m:mo xref="{@id}">id</m:mo>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:mo>id</m:mo>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-
-<!-- ***************** ARITHMETIC, ALGEBRA & LOGIC ***************** -->
-
-<xsl:template match = "m:apply[m:quotient[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mo form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em">&#x0230A;</m:mo>
-    <m:mfrac>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:quotient/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-      <m:mrow>
-        <xsl:apply-templates select="*[2]" mode = "semantics">
-          <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
-        </xsl:apply-templates>
-      </m:mrow>
-      <m:mrow>
-        <xsl:apply-templates select="*[3]" mode = "semantics">
-          <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-        </xsl:apply-templates>
-      </m:mrow>
-    </m:mfrac>
-    <m:mo form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em">&#x0230A;</m:mo>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[*[1][self::m:exp]]">
-  <m:msup>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mo>
-    <!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:exp/@id"/>
-          </xsl:attribute>
-        </xsl:if>e</m:mo>
-    <xsl:apply-templates select = "*[2]" mode = "semantics"/>
-  </m:msup>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:factorial[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:apply-templates select = "*[2]" mode = "semantics">
-      <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
-      <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-    </xsl:apply-templates>
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:factorial/@id"/>
-          </xsl:attribute>
-        </xsl:if>!</m:mo>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:max[1] | m:min[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:if test="*[2]=m:bvar">
-      <m:munder>
-        <xsl:if test="*[1]=m:max">
-          <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:max/@id"/>
-          </xsl:attribute>
-        </xsl:if>max</m:mo>
-        </xsl:if>
-        <xsl:if test="*[1]=m:min">
-          <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:min/@id"/>
-          </xsl:attribute>
-        </xsl:if>min</m:mo>
-        </xsl:if>
-        <xsl:apply-templates select="*[2]" mode = "semantics"/>
-      </m:munder>
-      <xsl:if test="*[3]=m:condition">
-        <m:mfenced open="{{" close="}}" separators="">
-          <m:mfenced open="" close="" separators=",">
-            <xsl:for-each select = "*[position()>3]">
-              <xsl:apply-templates select = "." mode="semantics"/>
-            </xsl:for-each>
-          </m:mfenced>
-          <m:mo>|</m:mo>
-          <xsl:apply-templates select="*[3]" mode = "semantics"/>
-        </m:mfenced>
-      </xsl:if>
-      <xsl:if test="not(*[3]=m:condition)">
-        <m:mfenced open="{{" close="}}" separators=",">
-          <xsl:for-each select = "*[position()>2]">
-            <xsl:apply-templates select = "." mode="semantics"/>
-          </xsl:for-each>
-        </m:mfenced>
-      </xsl:if>
-    </xsl:if>
-    <xsl:if test="*[2]=m:condition">
-      <xsl:if test="*[1]=m:max">
-        <m:mo>max</m:mo>
-      </xsl:if>
-      <xsl:if test="*[1]=m:min">
-        <m:mo>min</m:mo>
-      </xsl:if>
-      <m:mfenced open="{{" close="}}" separators="">
-        <xsl:if test="*[3]">
-          <m:mfenced open="" close="" separators=",">
-            <xsl:for-each select = "*[position()>2]">
-              <xsl:apply-templates select = "." mode="semantics"/>
-            </xsl:for-each>
-          </m:mfenced>
-          <m:mo>|</m:mo>
-        </xsl:if>
-        <xsl:apply-templates select="*[2]" mode = "semantics"/>
-      </m:mfenced>
-    </xsl:if>
-    <xsl:if test="not(*[2]=m:condition) and not(*[2]=m:bvar)">
-      <xsl:if test="*[1]=m:max">
-        <m:mo>max</m:mo>
-      </xsl:if>
-      <xsl:if test="*[1]=m:min">
-        <m:mo>min</m:mo>
-      </xsl:if>
-      <m:mfenced open="{{" close="}}" separators=",">
-        <xsl:for-each select = "*[position()>1]">
-          <xsl:apply-templates select = "." mode="semantics"/>
-        </xsl:for-each>
-      </m:mfenced>
-    </xsl:if>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:minus[1]]">
-  <xsl:param name="IN_PREC" select="$NO_PREC"/>
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:choose>
-    <xsl:when test="$IN_PREC &gt; $MINUS_PREC or $IN_PREC=$MINUS_PREC and
-                                                        $PARAM=$PAR_SAME">
-      <m:mfenced separators="">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="minus">
-          <xsl:with-param name="PARAM" select="$PARAM"/>
-          <xsl:with-param name="PAREN" select="$PAR_YES"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mfenced>
-    </xsl:when>
-    <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC
-                    and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
-                    and not($SEM_SW=$SEM_XREF_EXT)">
-      <xsl:apply-templates select="." mode="minus">
-        <xsl:with-param name="PARAM" select="$PARAM"/>
-        <xsl:with-param name="PAREN" select="$PAREN"/>
-        <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-      </xsl:apply-templates>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:mrow>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="minus">
-          <xsl:with-param name="PARAM" select="$PARAM"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mrow>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:minus[1]]" mode="minus">
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:if test="not(*[3])">
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:minus/@id"/>
-          </xsl:attribute>
-        </xsl:if>-</m:mo>
-    <xsl:apply-templates select="*[2]" mode = "semantics">
-      <xsl:with-param name="IN_PREC" select="$NEG_PREC"/>
-      <xsl:with-param name="PAREN" select="$PAREN"/>
-      <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-    </xsl:apply-templates>
-  </xsl:if>
-  <xsl:if test="*[3]">
-    <xsl:apply-templates select="*[2]" mode = "semantics">
-      <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
-      <xsl:with-param name="PARAM" select="$PARAM"/>
-      <xsl:with-param name="PAREN" select="$PAREN"/>
-      <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-    </xsl:apply-templates>
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:minus/@id"/>
-          </xsl:attribute>
-        </xsl:if>-</m:mo>
-    <xsl:apply-templates select="*[3]" mode = "semantics">
-      <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
-      <xsl:with-param name="PARAM" select="$PAR_SAME"/>
-      <xsl:with-param name="PAREN" select="$PAREN"/>
-      <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-    </xsl:apply-templates>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:plus[1]]">
-  <xsl:param name="IN_PREC" select="$NO_PREC"/>
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:choose>
-    <xsl:when test="$IN_PREC &gt; $PLUS_PREC or $IN_PREC=$PLUS_PREC and
-                                                      $PARAM=$PAR_SAME">
-      <m:mfenced separators="">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="plus">
-          <xsl:with-param name="PARAM" select="$IN_PREC"/>
-          <xsl:with-param name="PAREN" select="$PAR_YES"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mfenced>
-    </xsl:when>
-    <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC
-                    and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
-                    and not($SEM_SW=$SEM_XREF_EXT)">
-      <xsl:apply-templates select="." mode="plus">
-        <xsl:with-param name="PARAM" select="$PARAM"/>
-        <xsl:with-param name="PAREN" select="$PAREN"/>
-        <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-      </xsl:apply-templates>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:mrow>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="plus">
-          <xsl:with-param name="PARAM" select="$IN_PREC"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mrow>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:plus[1]]" mode="plus">
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:if test="*[2]">
-    <xsl:apply-templates select="*[2]" mode = "semantics">
-      <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
-      <xsl:with-param name="PARAM" select="$PARAM"/>
-      <xsl:with-param name="PAREN" select="$PAREN"/>
-      <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-    </xsl:apply-templates>
-    <xsl:for-each select = "*[position()>2]">
-      <xsl:choose>
-        <xsl:when test=". &lt; 0">
-          <m:mo>-</m:mo>
-          <m:mn> <xsl:value-of select="-."/> </m:mn>
-        </xsl:when>
-        <xsl:when test="self::m:apply[m:minus[1]] and not(*[3])">
-          <xsl:apply-templates select="." mode = "semantics">
-            <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
-            <xsl:with-param name="PAREN" select="$PAREN"/>
-            <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-          </xsl:apply-templates>
-        </xsl:when>
-        <xsl:otherwise>
-          <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:plus/@id"/>
-          </xsl:attribute>
-        </xsl:if>+</m:mo>
-          <xsl:apply-templates select="." mode = "semantics">
-            <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
-            <xsl:with-param name="PAREN" select="$PAREN"/>
-            <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-          </xsl:apply-templates>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:for-each>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:power[1]]">
-  <xsl:choose>
-    <xsl:when test="*[2]=m:apply[m:ln[1] | m:log[1] | m:abs[1] |
-                         m:gcd[1] | m:sin[1] | m:cos[1] | m:tan[1] |
-                         m:sec[1] | m:csc[1] | m:cot[1] | m:sinh[1] |
-                         m:cosh[1] | m:tanh[1] | m:sech[1] | m:csch[1] |
-                         m:coth[1] | m:arcsin[1] | m:arccos[1] |
-                         m:arctan[1]]">
-      <xsl:apply-templates select="*[2]" mode = "semantics"/>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:msup>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select = "*[2]" mode = "semantics">
-          <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-        </xsl:apply-templates>
-        <xsl:apply-templates select = "*[3]" mode = "semantics"/>
-      </m:msup>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:rem[1] | m:divide[1]]">
-  <xsl:param name="IN_PREC" select="$NO_PREC"/>
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:choose>
-    <xsl:when test="$IN_PREC &gt; $DIV_PREC or $IN_PREC=$DIV_PREC and
-                                                    $PARAM=$PAR_SAME">
-      <m:mfenced separators="">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="remdiv">
-          <xsl:with-param name="PARAM" select="$IN_PREC"/>
-          <xsl:with-param name="PAREN" select="$PAR_YES"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mfenced>
-    </xsl:when>
-    <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC
-                    and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
-                    and not($SEM_SW=$SEM_XREF_EXT)">
-      <xsl:apply-templates select="." mode="remdiv">
-        <xsl:with-param name="PARAM" select="$PARAM"/>
-        <xsl:with-param name="PAREN" select="$PAREN"/>
-        <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-      </xsl:apply-templates>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:mrow>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="remdiv">
-          <xsl:with-param name="PARAM" select="$IN_PREC"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mrow>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:rem[1] | m:divide[1]]" mode="remdiv">
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:apply-templates select = "*[2]" mode = "semantics">
-    <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
-      <xsl:with-param name="PARAM" select="$PARAM"/>
-      <xsl:with-param name="PAREN" select="$PAREN"/>
-      <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-  </xsl:apply-templates>
-  <m:mo>
-    <xsl:if test="m:rem">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:rem/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-      <xsl:value-of select="'%'"/>
-    </xsl:if>
-    <xsl:if test="m:divide">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:divide/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-      <xsl:value-of select="'/'"/>
-    </xsl:if>
-  </m:mo>
-  <xsl:apply-templates select = "*[3]" mode = "semantics">
-    <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
-    <xsl:with-param name="PARAM" select="$PAR_SAME"/>
-    <xsl:with-param name="PAREN" select="$PAREN"/>
-    <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-  </xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:times[1]]">
-  <xsl:param name="IN_PREC" select="$NO_PREC"/>
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:choose>
-    <xsl:when test="$IN_PREC &gt; $MUL_PREC or $IN_PREC=$MUL_PREC and
-                                                    $PARAM=$PAR_SAME">
-      <m:mfenced separators="">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="times">
-          <xsl:with-param name="PARAM" select="$IN_PREC"/>
-          <xsl:with-param name="PAREN" select="$PAR_YES"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mfenced>
-    </xsl:when>
-    <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC
-                    and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
-                    and not($SEM_SW=$SEM_XREF_EXT)">
-      <xsl:apply-templates select="." mode="times">
-        <xsl:with-param name="PARAM" select="$PARAM"/>
-        <xsl:with-param name="PAREN" select="$PAREN"/>
-        <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-      </xsl:apply-templates>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:mrow>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="times">
-          <xsl:with-param name="PARAM" select="$IN_PREC"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mrow>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:times[1]]" mode="times">
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:apply-templates select="*[2]" mode = "semantics">
-    <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
-    <xsl:with-param name="PARAM" select="$PARAM"/>
-    <xsl:with-param name="PAREN" select="$PAREN"/>
-    <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-  </xsl:apply-templates>
-  <xsl:if test="*[3]">
-    <xsl:for-each select = "*[position()>2]">
-<!-- HELM: to distinguish between * and the application -->
-<!--      <m:mo>&#x02062;</m:mo> -->
-      <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:times/@id"/>
-          </xsl:attribute>
-        </xsl:if>*</m:mo>
-      <xsl:apply-templates select="." mode = "semantics">
-        <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
-        <xsl:with-param name="PAREN" select="$PAREN"/>
-        <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-      </xsl:apply-templates>
-    </xsl:for-each>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:root[1]]">
-  <m:msqrt>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:if test="*[2]=m:degree">
-      <xsl:apply-templates select="*[3]" mode = "semantics">
-        <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
-        <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-      </xsl:apply-templates>
-      <xsl:apply-templates select="*[2]" mode = "semantics"/>
-    </xsl:if>
-    <xsl:if test="not(*[2]=m:degree)">
-      <xsl:apply-templates select="*[2]" mode = "semantics">
-        <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
-        <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-      </xsl:apply-templates>
-      <m:mn>2</m:mn>
-    </xsl:if>
-  </m:msqrt>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:gcd[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:if test="not(parent::m:apply[m:power[1]])">
-      <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:gcd/@id"/>
-          </xsl:attribute>
-        </xsl:if>gcd</m:mo>
-    </xsl:if>
-    <xsl:if test="parent::m:apply[m:power[1]]">
-      <m:msup>
-        <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:gcd/@id"/>
-          </xsl:attribute>
-        </xsl:if>gcd</m:mo>
-        <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
-      </m:msup>
-    </xsl:if>
-    <m:mfenced separators=",">
-      <xsl:for-each select = "*[position()>1]">
-        <xsl:apply-templates select = "." mode="semantics"/>
-      </xsl:for-each>
-    </m:mfenced>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:and[1]]">
-  <xsl:param name="IN_PREC" select="$NO_PREC"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:choose>
-    <xsl:when test="$IN_PREC &gt; $AND_PREC">
-      <m:mfenced separators="">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="and">
-          <xsl:with-param name="PARAM" select="$IN_PREC"/>
-          <xsl:with-param name="PAREN" select="$PAR_YES"/>
-        </xsl:apply-templates>
-      </m:mfenced>
-    </xsl:when>
-    <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC
-                    and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
-                    and not($SEM_SW=$SEM_XREF_EXT)">
-      <xsl:apply-templates select="." mode="and">
-        <xsl:with-param name="PARAM" select="$IN_PREC"/>
-        <xsl:with-param name="PAREN" select="$PAREN"/>
-        <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-      </xsl:apply-templates>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:mrow>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="and">
-          <xsl:with-param name="PARAM" select="$IN_PREC"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mrow>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:and[1]]" mode="and">
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:apply-templates select="*[2]" mode = "semantics">
-    <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
-    <xsl:with-param name="PARAM" select="$PARAM"/>
-    <xsl:with-param name="PAREN" select="$PAREN"/>
-    <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-  </xsl:apply-templates>
-  <xsl:for-each select = "*[position()>2]">
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:and/@id"/>
-          </xsl:attribute>
-        </xsl:if>&#x02227;</m:mo>
-    <xsl:apply-templates select="." mode = "semantics">
-      <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
-      <xsl:with-param name="PAREN" select="$PAREN"/>
-      <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-    </xsl:apply-templates>
-  </xsl:for-each>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:or[1]]">
-  <xsl:param name="IN_PREC" select="$NO_PREC"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:choose>
-    <xsl:when test="$IN_PREC &gt; $OR_PREC">
-      <m:mfenced separators="">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="or">
-          <xsl:with-param name="PARAM" select="$IN_PREC"/>
-          <xsl:with-param name="PAREN" select="$PAR_YES"/>
-        </xsl:apply-templates>
-      </m:mfenced>
-    </xsl:when>
-    <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC
-                    and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
-                    and not($SEM_SW=$SEM_XREF_EXT)">
-      <xsl:apply-templates select="." mode="or">
-        <xsl:with-param name="PARAM" select="$IN_PREC"/>
-        <xsl:with-param name="PAREN" select="$PAREN"/>
-        <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-      </xsl:apply-templates>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:mrow>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="or">
-          <xsl:with-param name="PARAM" select="$IN_PREC"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mrow>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:or[1]]" mode="or">
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:apply-templates select="*[2]" mode = "semantics">
-    <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
-    <xsl:with-param name="PARAM" select="$PARAM"/>
-    <xsl:with-param name="PAREN" select="$PAREN"/>
-    <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-  </xsl:apply-templates>
-  <xsl:for-each select = "*[position()>2]">
-    <m:mo> 
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:or/@id"/>
-          </xsl:attribute>
-        </xsl:if>&#x02228;</m:mo>
-    <xsl:apply-templates select="." mode = "semantics">
-      <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
-      <xsl:with-param name="PAREN" select="$PAREN"/>
-      <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-    </xsl:apply-templates>
-  </xsl:for-each>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:xor[1]]">
-  <xsl:param name="IN_PREC" select="$NO_PREC"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:choose>
-    <xsl:when test="$IN_PREC &gt; $XOR_PREC">
-      <m:mfenced separators="">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="xor">
-          <xsl:with-param name="PARAM" select="$IN_PREC"/>
-          <xsl:with-param name="PAREN" select="$PAR_YES"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mfenced>
-    </xsl:when>
-    <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC
-                                                and not($SEM_SW=$SEM_ALL)">
-      <xsl:apply-templates select="." mode="xor">
-        <xsl:with-param name="PARAM" select="$IN_PREC"/>
-        <xsl:with-param name="PAREN" select="$PAREN"/>
-      </xsl:apply-templates>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:mrow>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="xor">
-          <xsl:with-param name="PARAM" select="$IN_PREC"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mrow>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:xor[1]]" mode="xor">
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:apply-templates select="*[2]" mode = "semantics">
-    <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
-    <xsl:with-param name="PARAM" select="$PARAM"/>
-    <xsl:with-param name="PAREN" select="$PAREN"/>
-    <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-  </xsl:apply-templates>
-  <xsl:for-each select = "*[position()>2]">
-    <m:mo>
- <!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:xor/@id"/>
-          </xsl:attribute>
-        </xsl:if>&#x022BB;</m:mo>
-    <xsl:apply-templates select="." mode = "semantics">
-      <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
-      <xsl:with-param name="PAREN" select="$PAREN"/>
-      <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-    </xsl:apply-templates>
-  </xsl:for-each>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:not[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-<!-- HELM: was <m:mo>not</m:mo> -->
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:not/@id"/>
-          </xsl:attribute>
-        </xsl:if>&#x000AC;</m:mo>
-    <xsl:apply-templates select = "*[2]" mode = "semantics">
-      <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
-    </xsl:apply-templates>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:forall[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:forall/@id"/>
-          </xsl:attribute>
-        </xsl:if>for all</m:mo>
-    <xsl:if test="count(m:bvar) &gt; 1">
-      <m:mfenced separators=",">
-        <xsl:for-each select = "m:bvar">
-          <xsl:apply-templates select = "." mode="semantics"/>
-        </xsl:for-each>
-      </m:mfenced>
-    </xsl:if>
-    <xsl:if test="count(m:bvar)=1">
-      <xsl:apply-templates select = "m:bvar" mode="semantics"/>
-    </xsl:if>
-    <xsl:if test="m:condition">
-      <m:mo>:</m:mo>
-      <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
-      <m:mo>,</m:mo>
-    </xsl:if>
-    <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and
-                                not(self::m:condition)]" mode = "semantics"/>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:exists[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mo> 
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:exists/@id"/>
-          </xsl:attribute>
-        </xsl:if>&#x02203;</m:mo>
-    <xsl:if test="count(m:bvar) &gt; 1">
-      <m:mfenced separators=",">
-        <xsl:for-each select = "m:bvar">
-          <xsl:apply-templates select = "." mode="semantics"/>
-        </xsl:for-each>
-      </m:mfenced>
-    </xsl:if>
-    <xsl:if test="count(m:bvar)=1">
-      <xsl:apply-templates select = "m:bvar" mode="semantics"/>
-    </xsl:if>
-    <xsl:if test="m:condition">
-      <m:mo>,</m:mo>
-      <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
-    </xsl:if>
-    <xsl:if test="*[position()>1 and not(self::m:bvar) and not(self::m:condition)]">
-      <m:mo>:</m:mo>
-      <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and
-                                not(self::m:condition)]" mode = "semantics"/>
-    </xsl:if>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:abs[1]]">
-  <xsl:if test="not(parent::m:apply[m:power[1]])">
-    <m:mfenced open="|" close="|" separators="">
-      <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-        <xsl:attribute name="xref">
-          <xsl:value-of select="@id"/>
-        </xsl:attribute>
-      </xsl:if>
-      <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
-    </m:mfenced>
-  </xsl:if>
-  <xsl:if test="parent::m:apply[m:power[1]]">
-    <m:msup>
-      <m:mfenced open="|" close="|" separators="">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
-      </m:mfenced>
-      <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
-    </m:msup>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:conjugate[1]]">
-  <m:mover>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mrow>
-      <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
-    </m:mrow>
-    <m:mo>
- <!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:conjugate/@id"/>
-          </xsl:attribute>
-        </xsl:if>&#x00332;</m:mo>
-  </m:mover>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:arg[1] | m:real[1] | m:imaginary[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mo>
-      <xsl:if test="m:arg">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:arg/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:value-of select="'Arg'"/>
-      </xsl:if>
-      <xsl:if test="m:real">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:real/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:value-of select="'Re'"/>
-      </xsl:if>
-      <xsl:if test="m:imaginary">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:imaginary/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:value-of select="'Im'"/>
-      </xsl:if>
-    </m:mo>
-    <m:mfenced separators="">
-      <xsl:apply-templates select = "*[2]" mode = "semantics"/>
-    </m:mfenced>
-  </m:mrow>
-</xsl:template>
-
-
-<!-- ***************** RELATIONS ***************** -->
-
-<xsl:template match = "m:apply[m:neq | m:approx | m:tendsto | m:implies
-                     | m:in | m:notin | m:notsubset | m:notprsubset
-                     | m:subset | m:prsubset | m:eq | m:gt | m:lt
-                     | m:geq | m:leq | m:equivalent]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:if test="*[1]=m:neq or *[1]=m:approx or *[1]=m:tendsto or
-                  *[1]=m:implies or *[1]=m:in or *[1]=m:notin or
-                  *[1]=m:notsubset or *[1]=m:notprsubset">
-      <xsl:apply-templates select = "*[2]" mode = "semantics"/>
-      <m:mo>
-        <xsl:if test="*[1]=m:neq">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:neq/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02260;
-        </xsl:if>
-        <xsl:if test="*[1]=m:approx">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:approx/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x0224A;
-        </xsl:if>
-        <xsl:if test="*[1]=m:tendsto">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:tendsto/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02192;
-        </xsl:if>
-        <xsl:if test="*[1]=m:implies">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:implies/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x021D2;
-        </xsl:if>
-        <xsl:if test="*[1]=m:in">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:in/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02208;
-        </xsl:if>
-        <xsl:if test="*[1]=m:notin">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:notin/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02209;
-        </xsl:if>
-        <xsl:if test="*[1]=m:notsubset">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:notsubset/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02284;
-        </xsl:if>
-        <xsl:if test="*[1]=m:notprsubset">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:notprsubset/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02288;
-        </xsl:if>
-      </m:mo>
-      <xsl:apply-templates select = "*[3]" mode = "semantics"/>
-      <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='below']">
-        <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:tendsto/@id"/>
-          </xsl:attribute>
-        </xsl:if>-</m:mo>
-      </xsl:if>
-      <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='above']">
-        <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:tendsto/@id"/>
-          </xsl:attribute>
-        </xsl:if>+</m:mo>
-      </xsl:if>
-    </xsl:if>
-    <xsl:if test="*[1]=m:subset or *[1]=m:prsubset or *[1]=m:eq or *[1]=m:gt
-               or *[1]=m:lt or *[1]=m:geq or *[1]=m:leq or *[1]=m:equivalent">
-      <xsl:apply-templates select = "*[2]" mode="semantics"/>
-      <xsl:for-each select = "*[position()>2]">
-        <m:mo>
-          <xsl:if test="../*[self::m:subset][1]">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:subset/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02286;
-          </xsl:if>
-          <xsl:if test="../*[self::m:prsubset][1]">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:prsubset/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02282;
-          </xsl:if>
-          <xsl:if test="../*[self::m:eq][1]">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:eq/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-            <xsl:value-of select="'='"/>
-          </xsl:if>
-          <xsl:if test="../*[self::m:gt][1]">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:gt/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-            <xsl:value-of select="'&gt;'"/>
-          </xsl:if>
-          <xsl:if test="../*[self::m:lt][1]">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:lt/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-            <xsl:value-of select="'&lt;'"/>
-          </xsl:if>
-          <xsl:if test="../*[self::m:geq][1]">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:geq/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02265;
-          </xsl:if>
-          <xsl:if test="../*[self::m:leq][1]">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:leq/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02264;
-          </xsl:if>
-          <xsl:if test="../*[self::m:equivalent][1]">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:equivalent/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02261;
-          </xsl:if>
-        </m:mo>
-        <xsl:apply-templates select = "." mode="semantics"/>
-      </xsl:for-each>
-    </xsl:if>
-  </m:mrow>
-</xsl:template>
-
-
-<!-- ***************** CALCULUS ***************** -->
-
-<xsl:template match = "m:apply[*[1][self::m:ln]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:choose>
-      <xsl:when test="parent::m:apply[m:power[1]]">
-        <m:msup>
-          <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:ln/@id"/>
-          </xsl:attribute>
-        </xsl:if>ln</m:mo>
-          <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
-        </m:msup>
-      </xsl:when>
-      <xsl:otherwise>
-        <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:ln/@id"/>
-          </xsl:attribute>
-        </xsl:if>ln</m:mo>
-      </xsl:otherwise>
-    </xsl:choose>
-    <m:mo>&#x02061;</m:mo>
-    <xsl:apply-templates select = "*[2]" mode = "semantics">
-      <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
-    </xsl:apply-templates>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:log[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:choose>
-      <xsl:when test="parent::m:apply[m:power[1]]">
-        <xsl:if test="not(*[2]=m:logbase)">
-          <m:msup>
-            <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:log/@id"/>
-          </xsl:attribute>
-        </xsl:if>log</m:mo>
-            <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
-          </m:msup>
-        </xsl:if>
-        <xsl:if test="*[2]=m:logbase">
-          <m:msubsup>
-            <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:log/@id"/>
-          </xsl:attribute>
-        </xsl:if>log</m:mo>
-            <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
-            <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
-          </m:msubsup>
-        </xsl:if>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:if test="not(*[2]=m:logbase)">
-          <m:mo>log</m:mo>
-        </xsl:if>
-        <xsl:if test="*[2]=m:logbase">
-          <m:msub>
-            <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:log/@id"/>
-          </xsl:attribute>
-        </xsl:if>log</m:mo>
-            <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
-          </m:msub>
-        </xsl:if>
-      </xsl:otherwise>
-    </xsl:choose>
-    <m:mo>&#x02061;</m:mo>
-    <xsl:if test="*[2]=m:logbase">
-      <xsl:apply-templates select = "*[3]" mode = "semantics">
-        <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
-      </xsl:apply-templates>
-    </xsl:if>
-    <xsl:if test="not(*[2]=m:logbase)">
-      <xsl:apply-templates select = "*[2]" mode = "semantics">
-        <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
-      </xsl:apply-templates>
-    </xsl:if>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:diff[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:if test="*[2]=m:bvar and m:bvar[*[2]=m:degree]">
-      <m:mfrac>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:diff/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <m:msup>
-          <m:mo>d</m:mo>
-          <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
-        </m:msup>
-        <m:mrow>
-          <m:mo>d</m:mo>
-          <m:msup>
-            <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
-            <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
-          </m:msup>
-        </m:mrow>
-      </m:mfrac>
-    </xsl:if>
-    <xsl:if test="*[2]=m:bvar and not(m:bvar[*[2]=m:degree])">
-      <m:mfrac>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:diff/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <m:mo>d</m:mo>
-        <m:mrow>
-          <m:mo>d</m:mo>
-          <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
-        </m:mrow>
-      </m:mfrac>
-    </xsl:if>
-    <xsl:apply-templates select = "*[3]" mode = "semantics"/>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:partialdiff[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:for-each select = "m:bvar">
-      <xsl:if test="*[last()]=m:degree">
-        <m:mfrac>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:partialdiff/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-          <m:msup>
-             <m:mo>d</m:mo>
-             <xsl:apply-templates select = "m:degree" mode = "semantics"/>
-          </m:msup>
-          <m:mrow>
-            <m:mo>d</m:mo>
-            <m:msup>
-              <xsl:apply-templates select = "*[1]" mode = "semantics"/>
-              <xsl:apply-templates select = "m:degree" mode = "semantics"/>
-            </m:msup>
-          </m:mrow>
-        </m:mfrac>
-      </xsl:if>
-      <xsl:if test="not(*[last()]=m:degree)">
-        <m:mfrac>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:partialdiff/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-          <m:mo>d</m:mo>
-          <m:mrow>
-            <m:mo>d</m:mo>
-            <xsl:apply-templates select = "*[1]" mode = "semantics"/>
-          </m:mrow>
-        </m:mfrac>
-      </xsl:if>
-    </xsl:for-each>
-    <xsl:apply-templates select = "*[last()]" mode = "semantics"/>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:lowlimit | m:uplimit | m:bvar | m:degree |
-                                                               m:logbase">
-  <xsl:apply-templates select="*" mode = "semantics"/>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:divergence[1] | m:grad[1] | m:curl[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mo>
-      <xsl:if test="*[1]=m:divergence">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:divergence/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:value-of select="'div'"/>
-      </xsl:if>
-      <xsl:if test="*[1]=m:grad">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:grad/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:value-of select="'grad'"/>
-      </xsl:if>
-      <xsl:if test="*[1]=m:curl">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:curl/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:value-of select="'curl'"/>
-      </xsl:if>
-    </m:mo>
-    <xsl:choose>
-      <xsl:when test="*[2]=m:ci">
-        <xsl:apply-templates select = "*[2]" mode = "semantics"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <m:mfenced separators="">
-          <xsl:apply-templates select = "*[2]" mode = "semantics"/>
-        </m:mfenced>
-      </xsl:otherwise>
-    </xsl:choose>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:laplacian[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:msup>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:laplacian/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-      <m:mo>&#x00394;</m:mo>
-      <m:mn>2</m:mn>
-    </m:msup>
-    <xsl:apply-templates select = "*[2]" mode = "semantics"/>
-  </m:mrow>
-</xsl:template>
-
-
-<!-- ***************** SET THEORY ***************** -->
-
-<xsl:template match = "m:set | m:list">
-  <m:mfenced open="{{" close="}}" separators="">
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:if test="*[1]=m:bvar and *[2]=m:condition">
-      <xsl:apply-templates select="m:bvar" mode = "semantics"/>
-      <m:mo>|</m:mo>
-      <xsl:apply-templates select="m:condition" mode = "semantics"/>
-    </xsl:if>
-    <xsl:if test="*[1]=m:condition and not(child::m:bvar)">
-      <m:mfenced open="" close="" separators=",">
-        <xsl:for-each select = "*[not(self::m:condition) and not(self::m:bvar)]">
-          <xsl:apply-templates select = "." mode="semantics"/>
-        </xsl:for-each>
-      </m:mfenced>
-      <m:mo>|</m:mo>
-      <xsl:apply-templates select="m:condition" mode = "semantics"/>
-    </xsl:if>
-    <xsl:if test="not(child::m:bvar) and not(child::m:condition)">
-      <m:mfenced open="" close="" separators=",">
-        <xsl:for-each select = "*">
-          <xsl:apply-templates select = "." mode="semantics"/>
-        </xsl:for-each>
-      </m:mfenced>
-    </xsl:if>
-  </m:mfenced>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:union[1]]">
-  <xsl:param name="IN_PREC" select="$NO_PREC"/>
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:choose>
-    <xsl:when test="$IN_PREC &gt; $UNION_PREC or $IN_PREC=$UNION_PREC
-                    and $PARAM=$PAR_SAME">
-      <m:mfenced separators="">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="union">
-          <xsl:with-param name="PARAM" select="$PARAM"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mfenced>
-    </xsl:when>
-    <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC
-                    and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
-                    and not($SEM_SW=$SEM_XREF_EXT)">
-      <xsl:apply-templates select="." mode="union">
-        <xsl:with-param name="PARAM" select="$PARAM"/>
-        <xsl:with-param name="PAREN" select="$PAREN"/>
-        <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-      </xsl:apply-templates>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:mrow>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="union">
-          <xsl:with-param name="PARAM" select="$PARAM"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mrow>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:union[1]]" mode="union">
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:apply-templates select = "*[2]" mode="semantics">
-    <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
-    <xsl:with-param name="PARAM" select="$PARAM"/>
-    <xsl:with-param name="PAREN" select="$PAREN"/>
-    <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-  </xsl:apply-templates>
-  <xsl:for-each select = "*[position()>2]">
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:union/@id"/>
-          </xsl:attribute>
-        </xsl:if>&#x022C3;</m:mo>
-    <xsl:apply-templates select = "." mode="semantics">
-      <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
-      <xsl:with-param name="PAREN" select="$PAREN"/>
-      <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-    </xsl:apply-templates>
-  </xsl:for-each>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:intersect[1]]">
-  <xsl:param name="IN_PREC" select="$NO_PREC"/>
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:choose>
-    <xsl:when test="$IN_PREC &gt; $INTERSECT_PREC">
-      <m:mfenced separators="">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="intersect">
-          <xsl:with-param name="PARAM" select="$PARAM"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mfenced>
-    </xsl:when>
-    <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC
-                    and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
-                    and not($SEM_SW=$SEM_XREF_EXT)">
-      <xsl:apply-templates select="." mode="intersect">
-        <xsl:with-param name="PARAM" select="$PARAM"/>
-        <xsl:with-param name="PAREN" select="$PAREN"/>
-        <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-      </xsl:apply-templates>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:mrow>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="intersect">
-          <xsl:with-param name="PARAM" select="$PARAM"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mrow>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:intersect[1]]" mode="intersect">
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:apply-templates select = "*[2]" mode="semantics">
-    <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
-    <xsl:with-param name="PARAM" select="$PARAM"/>
-    <xsl:with-param name="PAREN" select="$PAREN"/>
-    <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-  </xsl:apply-templates>
-  <xsl:for-each select = "*[position()>2]">
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="../m:intersect/@id"/>
-          </xsl:attribute>
-        </xsl:if>&#x022C2;</m:mo>
-    <xsl:apply-templates select = "." mode="semantics">
-      <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
-      <xsl:with-param name="PAREN" select="$PAREN"/>
-      <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-    </xsl:apply-templates>
-  </xsl:for-each>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:setdiff[1]]">
-  <xsl:param name="IN_PREC" select="$NO_PREC"/>
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:choose>
-    <xsl:when test="$IN_PREC &gt; $SETDIFF_PREC or $IN_PREC=$SETDIFF_PREC
-                    and $PARAM=$PAR_SAME">
-      <m:mfenced separators="">
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="setdiff">
-          <xsl:with-param name="PARAM" select="$PARAM"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mfenced>
-    </xsl:when>
-    <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC
-                    and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
-                    and not($SEM_SW=$SEM_XREF_EXT)">
-      <xsl:apply-templates select="." mode="setdiff">
-        <xsl:with-param name="PARAM" select="$PARAM"/>
-        <xsl:with-param name="PAREN" select="$PAREN"/>
-        <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-      </xsl:apply-templates>
-    </xsl:when>
-    <xsl:otherwise>
-      <m:mrow>
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="setdiff">
-          <xsl:with-param name="PARAM" select="$PARAM"/>
-          <xsl:with-param name="PAREN" select="$PAREN"/>
-          <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-        </xsl:apply-templates>
-      </m:mrow>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:setdiff[1]]" mode="setdiff">
-  <xsl:param name="PARAM" select="$NO_PARAM"/>
-  <xsl:param name="PAREN" select="$PAR_NO"/>
-  <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
-  <xsl:apply-templates select = "*[2]" mode = "semantics">
-    <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
-    <xsl:with-param name="PARAM" select="$PARAM"/>
-    <xsl:with-param name="PAREN" select="$PAREN"/>
-    <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
-  </xsl:apply-templates>
-  <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:setdiff/@id"/>
-          </xsl:attribute>
-        </xsl:if>\</m:mo>
-  <xsl:apply-templates select = "*[3]" mode = "semantics">
-    <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
-    <xsl:with-param name="PARAM" select="$PAR_SAME"/>
-    <xsl:with-param name="PAREN" select="$PAREN"/>
-    <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-  </xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:card[1]]">
-  <m:mfenced open="|" close="|" separators=",">
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:for-each select = "*[position()>1]">
-      <xsl:apply-templates select = "." mode="semantics"/>
-    </xsl:for-each>
-  </m:mfenced>
-</xsl:template>
-
-
-<!-- ***************** SEQUENCES AND SERIES ***************** -->
-
-<xsl:template match = "m:apply[m:sum[1] | m:product[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:choose>
-      <xsl:when test="*[2]=m:bvar and m:lowlimit and m:uplimit">
-        <m:munderover>
-          <m:mo>
-            <xsl:if test="*[1]=m:sum">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:sum/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02211;
-            </xsl:if>
-            <xsl:if test="*[1]=m:product">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:product/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x0220F;
-            </xsl:if>
-          </m:mo>
-          <m:mrow>
-            <xsl:apply-templates select = "*[2]" mode = "semantics"/>
-            <m:mo>=</m:mo>
-            <xsl:apply-templates select = "m:lowlimit" mode = "semantics"/>
-          </m:mrow>
-          <xsl:apply-templates select = "m:uplimit" mode = "semantics"/>
-        </m:munderover>
-        <xsl:apply-templates select = "*[5]" mode = "semantics"/>
-      </xsl:when>
-      <xsl:when test="*[2]=m:bvar and *[3]=m:condition">
-        <m:munder>
-          <m:mo>
-            <xsl:if test="*[1]=m:sum">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:sum/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02211;
-            </xsl:if>
-            <xsl:if test="*[1]=m:product">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:product/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x0220F;
-            </xsl:if>
-          </m:mo>
-          <xsl:apply-templates select = "*[3]" mode = "semantics"/>
-        </m:munder>
-        <xsl:apply-templates select = "*[4]" mode = "semantics"/>
-      </xsl:when>
-    </xsl:choose>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:limit[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:munder>
-      <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:lim/@id"/>
-          </xsl:attribute>
-        </xsl:if>lim</m:mo>
-      <m:mrow>
-        <xsl:if test="*[2]=m:bvar and *[3]=m:lowlimit">
-            <xsl:apply-templates select = "*[2]" mode = "semantics"/>
-            <m:mo>&#x02192;</m:mo>
-            <xsl:apply-templates select = "*[3]" mode = "semantics"/>
-        </xsl:if>
-        <xsl:if test="*[2]=m:bvar and *[3]=m:condition">
-          <xsl:apply-templates select = "*[3]" mode = "semantics"/>
-        </xsl:if>
-      </m:mrow>
-    </m:munder>
-    <xsl:apply-templates select = "*[4]" mode = "semantics"/>
-  </m:mrow>
-</xsl:template>
-
-
-<!-- ***************** TRIGONOMETRY ***************** -->
-
-<xsl:template match = "m:apply[*[1][self::m:sin | self::m:cos |
-                       self::m:tan | self::m:sec | self::m:csc |
-                       self::m:cot | self::m:sinh | self::m:cosh |
-                       self::m:tanh | self::m:sech | self::m:csch |
-                       self::m:coth | self::m:arcsin | self::m:arccos |
-                       self::m:arctan]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:if test="not(parent::m:apply[m:power[1]])">
-      <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
-    </xsl:if>
-    <xsl:if test="parent::m:apply[m:power[1]]">
-      <m:msup>
-        <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
-        <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
-      </m:msup>
-    </xsl:if>
-    <m:mo>&#x02061;</m:mo>
-    <xsl:apply-templates select = "*[2]" mode = "semantics">
-      <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
-      <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
-    </xsl:apply-templates>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "*" mode="trigonometry">
-  <m:mo>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:choose>
-      <xsl:when test="self::m:sin">
-        <xsl:value-of select="'sin'"/>
-      </xsl:when>
-      <xsl:when test="self::m:cos">
-        <xsl:value-of select="'cos'"/>
-      </xsl:when>
-      <xsl:when test="self::m:tan">
-        <xsl:value-of select="'tan'"/>
-      </xsl:when>
-      <xsl:when test="self::m:sec">
-        <xsl:value-of select="'sec'"/>
-      </xsl:when>
-      <xsl:when test="self::m:csc">
-        <xsl:value-of select="'csc'"/>
-      </xsl:when>
-      <xsl:when test="self::m:cot">
-        <xsl:value-of select="'cot'"/>
-      </xsl:when>
-      <xsl:when test="self::m:sinh">
-        <xsl:value-of select="'sinh'"/>
-      </xsl:when>
-      <xsl:when test="self::m:cosh">
-        <xsl:value-of select="'cosh'"/>
-      </xsl:when>
-      <xsl:when test="self::m:tanh">
-        <xsl:value-of select="'tanh'"/>
-      </xsl:when>
-      <xsl:when test="self::m:sech">
-        <xsl:value-of select="'sech'"/>
-      </xsl:when>
-      <xsl:when test="self::m:csch">
-        <xsl:value-of select="'csch'"/>
-      </xsl:when>
-      <xsl:when test="self::m:coth">
-        <xsl:value-of select="'coth'"/>
-      </xsl:when>
-      <xsl:when test="self::m:arcsin">
-        <xsl:value-of select="'arcsin'"/>
-      </xsl:when>
-      <xsl:when test="self::m:arccos">
-        <xsl:value-of select="'arccos'"/>
-      </xsl:when>
-      <xsl:when test="self::m:arctan">
-        <xsl:value-of select="'arctan'"/>
-      </xsl:when>
-    </xsl:choose>
-  </m:mo>
-</xsl:template>
-
-
-<!-- ***************** STATISTICS ***************** -->
-
-<xsl:template match = "m:apply[m:mean[1]]">
-  <m:mfenced open="&lt;" close="&gt;" separators=",">
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:for-each select = "*[position()>1]">
-      <xsl:apply-templates select = "." mode="semantics"/>
-    </xsl:for-each>
-  </m:mfenced>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:sdev[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:sdev/@id"/>
-          </xsl:attribute>
-        </xsl:if>&#x003C3;</m:mo>
-    <m:mfenced separators=",">
-      <xsl:for-each select = "*[position()>1]">
-        <xsl:apply-templates select = "." mode="semantics"/>
-      </xsl:for-each>
-    </m:mfenced>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:variance[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:variance/@id"/>
-          </xsl:attribute>
-        </xsl:if>&#x003C3;</m:mo>
-    <m:msup>
-      <m:mfenced separators=",">
-        <xsl:for-each select = "*[position()>1]">
-          <xsl:apply-templates select = "." mode="semantics"/>
-        </xsl:for-each>
-      </m:mfenced>
-      <m:mn>2</m:mn>
-    </m:msup>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:median[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:median/@id"/>
-          </xsl:attribute>
-        </xsl:if>median</m:mo>
-    <m:mfenced separators=",">
-      <xsl:for-each select = "*[position()>1]">
-        <xsl:apply-templates select = "." mode="semantics"/>
-      </xsl:for-each>
-    </m:mfenced>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:mode[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:mode/@id"/>
-          </xsl:attribute>
-        </xsl:if>mode</m:mo>
-    <m:mfenced separators=",">
-      <xsl:for-each select = "*[position()>1]">
-        <xsl:apply-templates select = "." mode="semantics"/>
-      </xsl:for-each>
-    </m:mfenced>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:moment[1]]">
-  <m:mfenced open="&lt;" close="&gt;" separators="">
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:if test="*[2]=m:degree">
-      <m:msup>
-        <xsl:apply-templates select="*[3]" mode = "semantics"/>
-        <xsl:apply-templates select="*[2]" mode = "semantics"/>
-      </m:msup>
-    </xsl:if>
-    <xsl:if test="not(*[2]=m:degree)">
-      <xsl:for-each select = "*[position()>1]">
-        <xsl:apply-templates select = "." mode="semantics"/>
-      </xsl:for-each>
-    </xsl:if>
-  </m:mfenced>
-</xsl:template>
-
-
-<!-- ***************** LINEAR ALGEBRA ***************** -->
-
-<xsl:template match="m:vector">
-  <m:mfenced separators="">
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mtable>
-      <xsl:for-each select="*">
-        <m:mtd>
-          <xsl:apply-templates select="." mode = "semantics"/>
-        </m:mtd>
-      </xsl:for-each>
-    </m:mtable>
-  </m:mfenced>
-</xsl:template>
-
-<xsl:template match = "m:matrix">
-  <m:mfenced separators="">
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mtable>
-      <xsl:apply-templates select="*" mode = "semantics"/>
-    </m:mtable>
-  </m:mfenced>
-</xsl:template>
-
-<xsl:template match = "m:matrixrow">
-  <m:mtr>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:for-each select="*">
-      <m:mtd>
-        <xsl:apply-templates select="." mode = "semantics"/>
-      </m:mtd>
-    </xsl:for-each>
-  </m:mtr>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:determinant[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:determinant/@id"/>
-          </xsl:attribute>
-        </xsl:if>det</m:mo>
-    <xsl:apply-templates select = "*[2]" mode = "semantics"/>
-  </m:mrow>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:transpose[1]]">
-  <m:msup>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:apply-templates select = "*[2]" mode = "semantics"/>
-    <m:mo>
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:transpose/@id"/>
-          </xsl:attribute>
-        </xsl:if>T</m:mo>
-  </m:msup>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:selector[1]]">
-  <xsl:if test="*[2]=m:matrix and *[3]=m:cn">
-      <xsl:variable name="m" select = "*[3]"/>
-      <xsl:choose>
-        <xsl:when test="*[4]=m:cn">
-          <xsl:variable name="n" select = "*[4]"/>
-          <xsl:copy-of select = "m:matrix/*[position()=$m]/*[position()=$n]"/>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:copy-of select = "m:matrix/*[position()=$m]"/>
-        </xsl:otherwise>
-      </xsl:choose>
-  </xsl:if>
-  <xsl:if test="(*[2]=m:vector or *[2]=m:list) and *[3]=m:cn">
-    <xsl:variable name="m" select = "*[3]"/>
-    <xsl:copy-of select = "*[2]/*[position()=$m]"/>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match = "m:apply[m:vectorproduct[1] |
-                                 m:scalarproduct[1] | m:outerproduct[1]]">
-  <m:mrow>
-    <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-      <xsl:attribute name="xref">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
-    <xsl:apply-templates select="*[2]" mode = "semantics"/>
-    <m:mo>
-      <xsl:if test="m:vectorproduct[1]">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="m:vectorproduct/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        &#x02A2F;
-      </xsl:if>
-      <xsl:if test="m:scalarproduct[1] | m:outerproduct[1]">
-<!-- HELM: added -->        
-        <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
-          <xsl:attribute name="xref">
-            <xsl:value-of select="*[1]/@id"/>
-          </xsl:attribute>
-        </xsl:if>
-        <xsl:value-of select="'.'"/>
-      </xsl:if>
-    </m:mo>
-    <xsl:apply-templates select="*[3]" mode = "semantics"/>
-  </m:mrow>
-</xsl:template>
-
-</xsl:stylesheet>