3 <!-- ******************************************************
5 XSL Transform of MathML content to MathML presentation
7 Version 0.14, Dec. 13, 2000
8 Authors Igor Rodionov <igor@csd.uwo.ca>,
9 Stephen Watt <watt@csd.uwo.ca>.
11 (C) Copyright 2000 Symbolic Computation Laboratory,
12 University of Western Ontario,
13 London, Canada N6A 5B7.
14 ****************************************************** -->
17 <!-- ====================================================== -->
18 <!-- April,28 2001 - HELM group: -->
19 <!-- Added the namespace prefix to all the output elements -->
20 <!-- Added the namespace prefix to all the xref attributes -->
21 <!-- Changed the mml prefix into m -->
22 <!-- Added m:xref to every mo element -->
23 <!-- Changed mchar into the corresponding entity -->
24 <!-- First draft: April 27 2001, Irene Schena -->
25 <!-- ====================================================== -->
27 <!-- Mostly complies with the W3C MathML 2.0 Candidate Recommenation
28 of November 13, 2000. The main difference is the use of <mchar>
29 which was removed from MathML 2.0 in the last working draft.
32 <xsl:stylesheet id="mmlctop.xsl"
34 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
35 xmlns:m="http://www.w3.org/1998/Math/MathML">
37 <!-- HELM: we don't have a default namespace.
38 Removed xmlns="http://www.w3.org/1998/Math/MathML" -->
40 <xsl:output method="xml" indent="yes"/>
42 <xsl:strip-space elements="apply semantics annotation-xml
43 csymbol fn cn ci interval matrix matrixrow vector
44 lambda bvar condition logbase degree set list
48 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
49 <!-- Parameters, variables and constants -->
50 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
52 <!-- ~~~~~~~~ Semantics related *constants*: ~~~~~~~~ -->
54 <!-- Strip off semantics -->
55 <xsl:variable name="SEM_STRIP" select="-1"/>
57 <!-- Pass semantics "as is" -->
58 <xsl:variable name="SEM_PASS" select="0"/>
60 <!-- Add semantics at top level only -->
61 <xsl:variable name="SEM_TOP" select="1"/>
63 <!-- Add semantics at all levels -->
64 <xsl:variable name="SEM_ALL" select="2"/>
66 <!-- Semantics at top level only, with id refs -->
67 <!-- NOTE: ids have to be already present in the
68 input for this feature to work. -->
69 <xsl:variable name="SEM_XREF" select="3"/>
71 <!-- No semantics at top level, with id refs -->
72 <!-- NOTE: ids have to be already present in the
73 input for this feature to work. -->
74 <xsl:variable name="SEM_XREF_EXT" select="4"/>
77 <!-- ~~~~~~~~~~ Stylesheet *parameter*: SEM_SW ~~~~~~~~~~~~~~ -->
78 <!-- Assumes one of the above values; SEM_PASS is the default -->
79 <!-- The default can be overridden by specifying different -->
80 <!-- value on the command line when the stylesheet is invoked -->
82 <!-- HELM: $SEM_SW was SEM_PASS (error!) -->
83 <xsl:param name="SEM_SW" select="$SEM_XREF"/>
85 <!-- ~~~~~~ Operator precedence definitions ~~~~~~ -->
87 <xsl:variable name="NO_PREC" select="0"/>
88 <xsl:variable name="UNION_PREC" select="1"/>
89 <xsl:variable name="SETDIFF_PREC" select="1"/>
90 <xsl:variable name="INTERSECT_PREC" select="3"/>
91 <xsl:variable name="OR_PREC" select="5"/>
92 <xsl:variable name="XOR_PREC" select="5"/>
93 <xsl:variable name="AND_PREC" select="7"/>
94 <xsl:variable name="PLUS_PREC" select="9"/>
95 <xsl:variable name="MINUS_PREC" select="9"/>
96 <xsl:variable name="MUL_PREC" select="11"/>
97 <xsl:variable name="DIV_PREC" select="11"/>
98 <xsl:variable name="NEG_PREC" select="13"/>
99 <xsl:variable name="FUNCTION_PREC" select="99"/>
101 <!-- ~~~~~ Miscellaneous constant definitions ~~~~~ -->
103 <xsl:variable name="YES" select="1"/>
104 <xsl:variable name="NO" select="0"/>
105 <xsl:variable name="NO_PARAM" select="-1"/>
106 <xsl:variable name="PAR_SAME" select="-3"/>
107 <xsl:variable name="PAR_YES" select="-5"/>
108 <xsl:variable name="PAR_NO" select="-7"/>
111 <!-- +++++++++++++++++ INDEX OF TEMPLATES +++++++++++++++++++ -->
113 <!-- All templates are subdivided into the following categories
114 (listed in the order of appearance in the stylesheet):
116 THE TOPMOST ELEMENT: MATH
122 BASIC CONTAINER ELEMENTS
125 BASIC CONTENT ELEMENTS
126 fn, interval, inverse, sep, condition, declare, lambda, compose, ident
128 ARITHMETIC, ALGEBRA & LOGIC
129 quotient, exp, factorial, max, min, minus, plus, power, rem, divide,
130 times, root, gcd, and, or, xor, not, forall, exists, abs, conjugate,
134 neq, approx, tendsto, implies, in, notin, notsubset, notprsubset,
135 subset, prsubset, eq, gt, lt, geq, leq, equivalent
138 ln, log, diff, partialdiff, lowlimit, uplimit, bvar, degree,
139 logbase, divergence, grad, curl, laplacian
142 set, list, union, intersect, setdiff, card
148 sin, cos, tan, sec, csc, cot, sinh, cosh, tanh, sech, csch, coth,
149 arcsin, arccos, arctan
152 mean, sdev, variance, median, mode, moment
155 vector, matrix, matrixrow, determinant, transpose, selector,
156 vectorproduct, scalarproduct, outerproduct
160 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
161 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ TEMPLATES ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
162 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
165 <!-- ***************** THE TOPMOST ELEMENT: MATH ***************** -->
167 <xsl:template match = "m:math">
169 <xsl:when test="$SEM_SW=$SEM_TOP or $SEM_SW=$SEM_ALL and *[2] or
173 <xsl:apply-templates mode = "semantics"/>
175 <m:annotation-xml encoding="MathML">
176 <xsl:copy-of select="*"/>
182 <xsl:apply-templates mode = "semantics"/>
189 <!-- ***************** SEMANTICS HANDLING ***************** -->
191 <!-- This template is called recursively. At each level -->
192 <!-- in the source tree it decides whether to strip off, -->
193 <!-- pass or add semantics at that level (depending on the -->
194 <!-- value of SEM_SW parameter). Then the actual template -->
195 <!-- is applied to the node. -->
197 <xsl:template match = "m:*" mode = "semantics">
198 <xsl:param name="IN_PREC" select="$NO_PREC"/>
199 <xsl:param name="PARAM" select="$NO_PARAM"/>
200 <xsl:param name="PAREN" select="$PAR_NO"/>
201 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
203 <xsl:when test="$SEM_SW=$SEM_STRIP and self::m:semantics">
204 <xsl:apply-templates select="m:annotation-xml[@encoding='MathML']">
205 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
206 <xsl:with-param name="PARAM" select="$PARAM"/>
207 <xsl:with-param name="PAREN" select="$PAREN"/>
208 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
209 </xsl:apply-templates>
211 <xsl:when test="($SEM_SW=$SEM_PASS or $SEM_SW=$SEM_TOP) and self::m:semantics">
213 <xsl:apply-templates select="*[1]">
214 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
215 <xsl:with-param name="PARAM" select="$PARAM"/>
216 <xsl:with-param name="PAREN" select="$PAREN"/>
217 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
218 </xsl:apply-templates>
219 <xsl:copy-of select="m:annotation-xml"/>
222 <xsl:when test="$SEM_SW=$SEM_ALL">
225 <xsl:when test="self::m:semantics">
226 <xsl:apply-templates select="*[1]">
227 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
228 <xsl:with-param name="PARAM" select="$PARAM"/>
229 <xsl:with-param name="PAREN" select="$PAREN"/>
230 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
231 </xsl:apply-templates>
232 <xsl:copy-of select="m:annotation-xml"/>
235 <xsl:apply-templates select=".">
236 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
237 <xsl:with-param name="PARAM" select="$PARAM"/>
238 <xsl:with-param name="PAREN" select="$PAREN"/>
239 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
240 </xsl:apply-templates>
241 <m:annotation-xml encoding="MathML">
242 <xsl:copy-of select="."/>
248 <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
250 <!-- HELM: syntax error: sematics -->
251 <xsl:when test="self::m:semantics">
253 <xsl:copy-of select="@*"/>
254 <xsl:attribute name="m:xref">
255 <xsl:value-of select="@id"/>
257 <xsl:copy-of select="*[1]"/>
258 <xsl:copy-of select="m:annotation-xml"/>
262 <xsl:apply-templates select=".">
263 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
264 <xsl:with-param name="PARAM" select="$PARAM"/>
265 <xsl:with-param name="PAREN" select="$PAREN"/>
266 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
267 </xsl:apply-templates>
273 <xsl:when test="self::m:semantics">
274 <xsl:copy-of select="."/>
277 <xsl:apply-templates select=".">
278 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
279 <xsl:with-param name="PARAM" select="$PARAM"/>
280 <xsl:with-param name="PAREN" select="$PAREN"/>
281 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
282 </xsl:apply-templates>
289 <xsl:template match = "m:semantics">
290 <xsl:apply-templates select="." mode = "semantics"/>
294 <!-- ***************** BASIC CONTAINER ELEMENTS ***************** -->
296 <!-- HELM: cn could not contain MAthML presentation -->
297 <xsl:template match = "m:cn">
298 <xsl:param name="IN_PREC" select="$NO_PREC"/>
299 <xsl:param name="PAREN" select="$PAR_NO"/>
300 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
303 <xsl:when test="child::text()">
306 <xsl:when test=". < 0 and $IN_PREC > $NO_PREC and $PAREN=$PAR_NO
307 and $PAR_NO_IGNORE=$NO">
308 <m:mfenced separators="">
309 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
310 <xsl:attribute name="m:xref">
311 <xsl:value-of select="@id"/>
314 <xsl:apply-templates select="." mode="cn"/>
319 <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
320 <xsl:apply-templates select="." mode="cnid"/>
323 <xsl:apply-templates select="." mode="cn"/>
332 <xsl:attribute name="m:xref">
333 <xsl:value-of select="@id"/>
335 <xsl:copy-of select="*"/>
342 <xsl:template match = "m:cn" mode="cn">
344 <xsl:when test="@base and (not(@type) or @type='integer' or @type='real')">
346 <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
347 <m:mn> <xsl:value-of select="@base"/> </m:mn>
350 <xsl:when test="@type='complex' and not(@base) and child::m:sep[1]">
351 <m:mfenced separators="">
352 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
353 <xsl:if test="text()[2] < 0">
355 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
357 <xsl:if test="not(text()[2] < 0)">
359 <m:mn> <xsl:value-of select="text()[2]"/> </m:mn>
361 <m:mo>⁢</m:mo>
365 <xsl:when test="@type='complex' and @base and child::m:sep[1]">
367 <m:mfenced separators="">
368 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
369 <xsl:if test="text()[2] < 0">
371 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
373 <xsl:if test="not(text()[2] < 0)">
375 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
377 <m:mo>⁢</m:mo>
380 <m:mn> <xsl:value-of select="@base"/> </m:mn>
383 <xsl:when test="@type='rational' and not(@base) and child::m:sep[1]">
385 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
386 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
389 <xsl:when test="@type='rational' and @base and child::m:sep[1]">
393 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
394 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
397 <m:mn> <xsl:value-of select="@base"/> </m:mn>
400 <xsl:when test="@type='polar' and not(@base) and child::m:sep[1]">
403 <m:mo>⁢</m:mo>
404 <m:mfenced separators=",">
405 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
406 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
410 <xsl:when test="@type='polar' and @base and child::m:sep[1]">
414 <m:mo>⁢</m:mo>
415 <m:mfenced separators=",">
416 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
417 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
420 <m:mn> <xsl:value-of select="@base"/> </m:mn>
424 <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
429 <xsl:template match = "m:cn" mode="cnid">
431 <xsl:when test="@base and (not(@type) or @type='integer' or @type='real')">
432 <m:msub m:xref="{@id}">
433 <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
434 <m:mn> <xsl:value-of select="@base"/> </m:mn>
437 <xsl:when test="@type='complex' and not(@base) and child::m:sep[1]">
438 <m:mfenced separators="" m:xref="{@id}">
439 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
440 <xsl:if test="text()[2] < 0">
442 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
444 <xsl:if test="not(text()[2] < 0)">
446 <m:mn> <xsl:value-of select="text()[2]"/> </m:mn>
448 <m:mo>⁢</m:mo>
452 <xsl:when test="@type='complex' and @base and child::m:sep[1]">
453 <m:msub m:xref="{@id}">
454 <m:mfenced separators="">
455 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
456 <xsl:if test="text()[2] < 0">
458 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
460 <xsl:if test="not(text()[2] < 0)">
462 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
464 <m:mo>⁢</m:mo>
467 <m:mn> <xsl:value-of select="@base"/> </m:mn>
470 <xsl:when test="@type='rational' and not(@base) and child::m:sep[1]">
471 <m:mfrac m:xref="{@id}">
472 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
473 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
476 <xsl:when test="@type='rational' and @base and child::m:sep[1]">
477 <m:msub m:xref="{@id}">
480 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
481 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
484 <m:mn> <xsl:value-of select="@base"/> </m:mn>
487 <xsl:when test="@type='polar' and not(@base) and child::m:sep[1]">
488 <m:mrow m:xref="{@id}">
490 <m:mo>⁢</m:mo>
491 <m:mfenced separators=",">
492 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
493 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
497 <xsl:when test="@type='polar' and @base and child::m:sep[1]">
498 <m:msub m:xref="{@id}">
501 <m:mo>⁢</m:mo>
502 <m:mfenced separators=",">
503 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
504 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
507 <m:mn> <xsl:value-of select="@base"/> </m:mn>
511 <m:mn m:xref="{@id}"> <xsl:apply-templates mode = "semantics"/> </m:mn>
516 <!-- HELM: ci could not contain MAthML presentation -->
517 <xsl:template match = "m:ci">
520 <xsl:when test="child::text()">
523 <xsl:when test="@type='vector' or @type=matrix or @type=set">
524 <m:mi fontweight="bold">
525 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
526 <xsl:attribute name="m:xref">
527 <xsl:value-of select="@id"/>
530 <xsl:apply-templates mode = "semantics"/>
533 <xsl:when test="child::text() and not(child::*[1])">
535 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
536 <xsl:attribute name="m:xref">
537 <xsl:value-of select="@id"/>
540 <!-- HELM: added mode=semantics -->
541 <xsl:apply-templates mode = "semantics"/>
544 <xsl:when test="child::text() and *[1] and not(*[1]=m:sep)">
546 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
547 <xsl:attribute name="m:xref">
548 <xsl:value-of select="@id"/>
551 <!-- HELM: added mode=semantics -->
552 <xsl:apply-templates mode = "semantics"/>
558 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
559 <xsl:attribute name="m:xref">
560 <xsl:value-of select="@id"/>
563 <xsl:apply-templates select="*"/>
566 <xsl:if test="not(*[2])">
567 <xsl:apply-templates select="*[1]"/>
575 <xsl:copy-of select="*"/>
576 <xsl:attribute name="m:xref">
577 <xsl:value-of select="@id"/>
585 <xsl:template match = "m:ci/m:*[not(self::m:sep)]">
586 <xsl:copy-of select = "."/>
589 <!-- HELM: previous Version x.xx from Feb. 18, 2000 -->
590 <xsl:template match = "m:csymbol">
593 <xsl:attribute name="m:xref">
594 <xsl:value-of select="@id"/>
598 <xsl:when test="*[1]">
599 <xsl:copy-of select = "*"/>
603 <xsl:apply-templates mode = "semantics"/>
611 <!-- HELM: csymbol cannot contain ci or cn elements, but only text or
612 presentation elements. PCDATA should render as if it were wrapped in
613 an mo. Mixed content: mrow which contains mo + presentation elements -->
614 <!--<xsl:template match = "m:csymbol/m:*">
616 <xsl:when test="self::m:cn or self::m:ci">
617 <xsl:apply-templates mode = "semantics"/>
620 <xsl:copy-of select = "."/>
625 <xsl:template match = "m:csymbol/text()">
627 <xsl:when test=". < 0 or . = 0 or . > 0">
628 <mn> <xsl:copy-of select = "."/> </mn>
631 <mi> <xsl:copy-of select = "."/> </mi>
637 <!-- ***************** BASIC CONTENT ELEMENTS ***************** -->
639 <xsl:template match = "m:apply[m:*[1][self::m:fn]]">
641 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
642 <xsl:attribute name="m:xref">
643 <xsl:value-of select="@id"/>
646 <xsl:apply-templates select = "m:fn[1]" mode = "semantics"/>
649 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
650 <xsl:attribute name="m:xref">
651 <xsl:value-of select="m:fn/@id"/>
653 </xsl:if>⁡</m:mo>
654 <m:mfenced separators=",">
655 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
660 <xsl:template match = "m:fn">
661 <xsl:apply-templates select = "*[1]" mode = "semantics">
662 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
663 </xsl:apply-templates>
666 <xsl:template match = "m:interval">
667 <m:mfenced separators=",">
668 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
669 <xsl:attribute name="m:xref">
670 <xsl:value-of select="@id"/>
673 <xsl:if test="@closure='closed' or @closure='closed-open'">
674 <xsl:attribute name="open">[</xsl:attribute>
676 <xsl:if test="@closure='closed' or @closure='open-closed'">
677 <xsl:attribute name="close">]</xsl:attribute>
679 <xsl:apply-templates select="*" mode = "semantics"/>
683 <xsl:template match = "m:apply[m:*[1][self::m:apply[m:inverse[1]]]]">
685 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
686 <xsl:attribute name="m:xref">
687 <xsl:value-of select="@id"/>
690 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
691 <m:mo>⁡</m:mo>
692 <m:mfenced separators=",">
693 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
698 <xsl:template match = "m:apply[*[1][self::m:inverse]]">
700 <xsl:when test="*[2]=m:exp or *[2]=m:ln or *[2]=m:sin or *[2]=m:cos or
701 *[2]=m:tan or *[2]=m:sec or *[2]=m:csc or *[2]=m:cot or
702 *[2]=m:sinh or *[2]=m:cosh or *[2]=m:tanh or *[2]=m:sech or
703 *[2]=m:csch or *[2]=m:coth or *[2]=m:arcsin or
704 *[2]=m:arccos or *[2]=m:arctan">
706 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
707 <xsl:attribute name="m:xref">
708 <xsl:value-of select="@id"/>
711 <xsl:apply-templates select="*[2]" mode="inverse"/>
716 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
717 <xsl:attribute name="m:xref">
718 <xsl:value-of select="@id"/>
721 <xsl:apply-templates select = "*[2]"/>
730 <xsl:template match = "*" mode="inverse">
732 <xsl:when test="self::m:exp">
733 <xsl:value-of select="'ln'"/>
735 <xsl:when test="self::m:ln">
736 <xsl:value-of select="'exp'"/>
738 <xsl:when test="self::m:sin">
739 <xsl:value-of select="'arcsin'"/>
741 <xsl:when test="self::m:cos">
742 <xsl:value-of select="'arccos'"/>
744 <xsl:when test="self::m:tan">
745 <xsl:value-of select="'arctan'"/>
747 <xsl:when test="self::m:sec">
748 <xsl:value-of select="'arcsec'"/>
750 <xsl:when test="self::m:csc">
751 <xsl:value-of select="'arccsc'"/>
753 <xsl:when test="self::m:cot">
754 <xsl:value-of select="'arccot'"/>
756 <xsl:when test="self::m:sinh">
757 <xsl:value-of select="'arcsinh'"/>
759 <xsl:when test="self::m:cosh">
760 <xsl:value-of select="'arccosh'"/>
762 <xsl:when test="self::m:tanh">
763 <xsl:value-of select="'arctanh'"/>
765 <xsl:when test="self::m:sech">
766 <xsl:value-of select="'arcsech'"/>
768 <xsl:when test="self::m:csch">
769 <xsl:value-of select="'arccsch'"/>
771 <xsl:when test="self::m:coth">
772 <xsl:value-of select="'arccoth'"/>
774 <xsl:when test="self::m:arcsin">
775 <xsl:value-of select="'sin'"/>
777 <xsl:when test="self::m:arccos">
778 <xsl:value-of select="'cos'"/>
780 <xsl:when test="self::m:arctan">
781 <xsl:value-of select="'tan'"/>
786 <xsl:template match = "m:sep"/>
788 <xsl:template match = "m:condition">
790 <xsl:when test="parent::m:apply[m:forall[1]]"/>
793 <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
794 <m:mrow m:xref="{@id}">
795 <xsl:apply-templates select="*" mode = "semantics"/>
799 <xsl:if test="not(*[2])">
800 <xsl:apply-templates select="*" mode = "semantics"/>
804 <xsl:apply-templates select="*" mode = "semantics"/>
813 <xsl:template match = "m:declare"/>
815 <xsl:template match = "m:lambda">
817 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
818 <xsl:attribute name="m:xref">
819 <xsl:value-of select="@id"/>
822 <m:mo>Λ</m:mo>
823 <m:mo>⁡</m:mo>
824 <m:mfenced separators=",">
825 <xsl:for-each select = "*">
827 <xsl:when test="self::m:ci or self::m:cn">
828 <xsl:apply-templates select = "." mode="semantics"/>
832 <xsl:apply-templates select = "." mode="semantics"/>
841 <xsl:template match = "m:apply[*[1][self::m:apply[m:compose[1]]]]">
843 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
844 <xsl:attribute name="m:xref">
845 <xsl:value-of select="@id"/>
848 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
849 <m:mo>⁡</m:mo>
850 <m:mfenced separators=",">
851 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
856 <xsl:template match = "m:apply[*[1][self::m:compose]]">
857 <m:mfenced separators="">
858 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
859 <xsl:attribute name="m:xref">
860 <xsl:value-of select="@id"/>
863 <xsl:apply-templates select = "m:*[2][self::m:ci[@type='fn'] |
864 self::m:fn]" mode="semantics"/>
865 <xsl:for-each select = "m:*[position()>2][self::m:ci[@type='fn'] |
869 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
870 <xsl:attribute name="m:xref">
871 <xsl:value-of select="../m:compose/@id"/>
873 </xsl:if>∘</m:mo>
874 <xsl:apply-templates select = "." mode="semantics"/>
879 <xsl:template match = "m:ident">
881 <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
882 <m:mo m:xref="{@id}">id</m:mo>
891 <!-- ***************** ARITHMETIC, ALGEBRA & LOGIC ***************** -->
893 <xsl:template match = "m:apply[m:quotient[1]]">
895 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
896 <xsl:attribute name="m:xref">
897 <xsl:value-of select="@id"/>
900 <m:mo form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em">⌊</m:mo>
903 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
904 <xsl:attribute name="m:xref">
905 <xsl:value-of select="m:quotient/@id"/>
909 <xsl:apply-templates select="*[2]" mode = "semantics">
910 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
911 </xsl:apply-templates>
914 <xsl:apply-templates select="*[3]" mode = "semantics">
915 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
916 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
917 </xsl:apply-templates>
920 <m:mo form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em">⌊</m:mo>
924 <xsl:template match = "m:apply[*[1][self::m:exp]]">
926 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
927 <xsl:attribute name="m:xref">
928 <xsl:value-of select="@id"/>
933 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
934 <xsl:attribute name="m:xref">
935 <xsl:value-of select="m:exp/@id"/>
938 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
942 <xsl:template match = "m:apply[m:factorial[1]]">
944 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
945 <xsl:attribute name="m:xref">
946 <xsl:value-of select="@id"/>
949 <xsl:apply-templates select = "*[2]" mode = "semantics">
950 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
951 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
952 </xsl:apply-templates>
955 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
956 <xsl:attribute name="m:xref">
957 <xsl:value-of select="m:factorial/@id"/>
963 <xsl:template match = "m:apply[m:max[1] | m:min[1]]">
965 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
966 <xsl:attribute name="m:xref">
967 <xsl:value-of select="@id"/>
970 <xsl:if test="*[2]=m:bvar">
972 <xsl:if test="*[1]=m:max">
975 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
976 <xsl:attribute name="m:xref">
977 <xsl:value-of select="m:max/@id"/>
981 <xsl:if test="*[1]=m:min">
984 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
985 <xsl:attribute name="m:xref">
986 <xsl:value-of select="m:min/@id"/>
990 <xsl:apply-templates select="*[2]" mode = "semantics"/>
992 <xsl:if test="*[3]=m:condition">
993 <m:mfenced open="{{" close="}}" separators="">
994 <m:mfenced open="" close="" separators=",">
995 <xsl:for-each select = "*[position()>3]">
996 <xsl:apply-templates select = "." mode="semantics"/>
1000 <xsl:apply-templates select="*[3]" mode = "semantics"/>
1003 <xsl:if test="not(*[3]=m:condition)">
1004 <m:mfenced open="{{" close="}}" separators=",">
1005 <xsl:for-each select = "*[position()>2]">
1006 <xsl:apply-templates select = "." mode="semantics"/>
1011 <xsl:if test="*[2]=m:condition">
1012 <xsl:if test="*[1]=m:max">
1015 <xsl:if test="*[1]=m:min">
1018 <m:mfenced open="{{" close="}}" separators="">
1019 <xsl:if test="*[3]">
1020 <m:mfenced open="" close="" separators=",">
1021 <xsl:for-each select = "*[position()>2]">
1022 <xsl:apply-templates select = "." mode="semantics"/>
1027 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1030 <xsl:if test="not(*[2]=m:condition) and not(*[2]=m:bvar)">
1031 <xsl:if test="*[1]=m:max">
1034 <xsl:if test="*[1]=m:min">
1037 <m:mfenced open="{{" close="}}" separators=",">
1038 <xsl:for-each select = "*[position()>1]">
1039 <xsl:apply-templates select = "." mode="semantics"/>
1046 <xsl:template match = "m:apply[m:minus[1]]">
1047 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1048 <xsl:param name="PARAM" select="$NO_PARAM"/>
1049 <xsl:param name="PAREN" select="$PAR_NO"/>
1050 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1052 <xsl:when test="$IN_PREC > $MINUS_PREC or $IN_PREC=$MINUS_PREC and
1054 <m:mfenced separators="">
1055 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1056 <xsl:attribute name="m:xref">
1057 <xsl:value-of select="@id"/>
1060 <xsl:apply-templates select="." mode="minus">
1061 <xsl:with-param name="PARAM" select="$PARAM"/>
1062 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1063 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1064 </xsl:apply-templates>
1067 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1068 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1069 and not($SEM_SW=$SEM_XREF_EXT)">
1070 <xsl:apply-templates select="." mode="minus">
1071 <xsl:with-param name="PARAM" select="$PARAM"/>
1072 <xsl:with-param name="PAREN" select="$PAREN"/>
1073 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1074 </xsl:apply-templates>
1078 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1079 <xsl:attribute name="m:xref">
1080 <xsl:value-of select="@id"/>
1083 <xsl:apply-templates select="." mode="minus">
1084 <xsl:with-param name="PARAM" select="$PARAM"/>
1085 <xsl:with-param name="PAREN" select="$PAREN"/>
1086 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1087 </xsl:apply-templates>
1093 <xsl:template match = "m:apply[m:minus[1]]" mode="minus">
1094 <xsl:param name="PARAM" select="$NO_PARAM"/>
1095 <xsl:param name="PAREN" select="$PAR_NO"/>
1096 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1097 <xsl:if test="not(*[3])">
1099 <!-- HELM: added -->
1100 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1101 <xsl:attribute name="m:xref">
1102 <xsl:value-of select="m:minus/@id"/>
1105 <xsl:apply-templates select="*[2]" mode = "semantics">
1106 <xsl:with-param name="IN_PREC" select="$NEG_PREC"/>
1107 <xsl:with-param name="PAREN" select="$PAREN"/>
1108 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1109 </xsl:apply-templates>
1111 <xsl:if test="*[3]">
1112 <xsl:apply-templates select="*[2]" mode = "semantics">
1113 <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
1114 <xsl:with-param name="PARAM" select="$PARAM"/>
1115 <xsl:with-param name="PAREN" select="$PAREN"/>
1116 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1117 </xsl:apply-templates>
1119 <!-- HELM: added -->
1120 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1121 <xsl:attribute name="m:xref">
1122 <xsl:value-of select="m:minus/@id"/>
1125 <xsl:apply-templates select="*[3]" mode = "semantics">
1126 <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
1127 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
1128 <xsl:with-param name="PAREN" select="$PAREN"/>
1129 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1130 </xsl:apply-templates>
1134 <xsl:template match = "m:apply[m:plus[1]]">
1135 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1136 <xsl:param name="PARAM" select="$NO_PARAM"/>
1137 <xsl:param name="PAREN" select="$PAR_NO"/>
1138 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1140 <xsl:when test="$IN_PREC > $PLUS_PREC or $IN_PREC=$PLUS_PREC and
1142 <m:mfenced separators="">
1143 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1144 <xsl:attribute name="m:xref">
1145 <xsl:value-of select="@id"/>
1148 <xsl:apply-templates select="." mode="plus">
1149 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1150 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1151 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1152 </xsl:apply-templates>
1155 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1156 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1157 and not($SEM_SW=$SEM_XREF_EXT)">
1158 <xsl:apply-templates select="." mode="plus">
1159 <xsl:with-param name="PARAM" select="$PARAM"/>
1160 <xsl:with-param name="PAREN" select="$PAREN"/>
1161 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1162 </xsl:apply-templates>
1166 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1167 <xsl:attribute name="m:xref">
1168 <xsl:value-of select="@id"/>
1171 <xsl:apply-templates select="." mode="plus">
1172 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1173 <xsl:with-param name="PAREN" select="$PAREN"/>
1174 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1175 </xsl:apply-templates>
1181 <xsl:template match = "m:apply[m:plus[1]]" mode="plus">
1182 <xsl:param name="PARAM" select="$NO_PARAM"/>
1183 <xsl:param name="PAREN" select="$PAR_NO"/>
1184 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1185 <xsl:if test="*[2]">
1186 <xsl:apply-templates select="*[2]" mode = "semantics">
1187 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
1188 <xsl:with-param name="PARAM" select="$PARAM"/>
1189 <xsl:with-param name="PAREN" select="$PAREN"/>
1190 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1191 </xsl:apply-templates>
1192 <xsl:for-each select = "*[position()>2]">
1194 <xsl:when test=". < 0">
1196 <m:mn> <xsl:value-of select="-."/> </m:mn>
1198 <xsl:when test="self::m:apply[m:minus[1]] and not(*[3])">
1199 <xsl:apply-templates select="." mode = "semantics">
1200 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
1201 <xsl:with-param name="PAREN" select="$PAREN"/>
1202 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1203 </xsl:apply-templates>
1207 <!-- HELM: added -->
1208 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1209 <xsl:attribute name="m:xref">
1210 <xsl:value-of select="../m:plus/@id"/>
1213 <xsl:apply-templates select="." mode = "semantics">
1214 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
1215 <xsl:with-param name="PAREN" select="$PAREN"/>
1216 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1217 </xsl:apply-templates>
1224 <xsl:template match = "m:apply[m:power[1]]">
1226 <xsl:when test="*[2]=m:apply[m:ln[1] | m:log[1] | m:abs[1] |
1227 m:gcd[1] | m:sin[1] | m:cos[1] | m:tan[1] |
1228 m:sec[1] | m:csc[1] | m:cot[1] | m:sinh[1] |
1229 m:cosh[1] | m:tanh[1] | m:sech[1] | m:csch[1] |
1230 m:coth[1] | m:arcsin[1] | m:arccos[1] |
1232 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1236 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1237 <xsl:attribute name="m:xref">
1238 <xsl:value-of select="@id"/>
1241 <xsl:apply-templates select = "*[2]" mode = "semantics">
1242 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1243 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1244 </xsl:apply-templates>
1245 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1251 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]">
1252 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1253 <xsl:param name="PARAM" select="$NO_PARAM"/>
1254 <xsl:param name="PAREN" select="$PAR_NO"/>
1255 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1257 <xsl:when test="$IN_PREC > $DIV_PREC or $IN_PREC=$DIV_PREC and
1259 <m:mfenced separators="">
1260 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1261 <xsl:attribute name="m:xref">
1262 <xsl:value-of select="@id"/>
1265 <xsl:apply-templates select="." mode="remdiv">
1266 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1267 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1268 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1269 </xsl:apply-templates>
1272 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1273 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1274 and not($SEM_SW=$SEM_XREF_EXT)">
1275 <xsl:apply-templates select="." mode="remdiv">
1276 <xsl:with-param name="PARAM" select="$PARAM"/>
1277 <xsl:with-param name="PAREN" select="$PAREN"/>
1278 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1279 </xsl:apply-templates>
1283 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1284 <xsl:attribute name="m:xref">
1285 <xsl:value-of select="@id"/>
1288 <xsl:apply-templates select="." mode="remdiv">
1289 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1290 <xsl:with-param name="PAREN" select="$PAREN"/>
1291 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1292 </xsl:apply-templates>
1298 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]" mode="remdiv">
1299 <xsl:param name="PARAM" select="$NO_PARAM"/>
1300 <xsl:param name="PAREN" select="$PAR_NO"/>
1301 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1302 <xsl:apply-templates select = "*[2]" mode = "semantics">
1303 <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
1304 <xsl:with-param name="PARAM" select="$PARAM"/>
1305 <xsl:with-param name="PAREN" select="$PAREN"/>
1306 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1307 </xsl:apply-templates>
1309 <xsl:if test="m:rem">
1310 <!-- HELM: added -->
1311 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1312 <xsl:attribute name="m:xref">
1313 <xsl:value-of select="m:rem/@id"/>
1316 <xsl:value-of select="'%'"/>
1318 <xsl:if test="m:divide">
1319 <!-- HELM: added -->
1320 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1321 <xsl:attribute name="m:xref">
1322 <xsl:value-of select="m:divide/@id"/>
1325 <xsl:value-of select="'/'"/>
1328 <xsl:apply-templates select = "*[3]" mode = "semantics">
1329 <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
1330 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
1331 <xsl:with-param name="PAREN" select="$PAREN"/>
1332 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1333 </xsl:apply-templates>
1336 <xsl:template match = "m:apply[m:times[1]]">
1337 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1338 <xsl:param name="PARAM" select="$NO_PARAM"/>
1339 <xsl:param name="PAREN" select="$PAR_NO"/>
1340 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1342 <xsl:when test="$IN_PREC > $MUL_PREC or $IN_PREC=$MUL_PREC and
1344 <m:mfenced separators="">
1345 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1346 <xsl:attribute name="m:xref">
1347 <xsl:value-of select="@id"/>
1350 <xsl:apply-templates select="." mode="times">
1351 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1352 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1353 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1354 </xsl:apply-templates>
1357 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1358 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1359 and not($SEM_SW=$SEM_XREF_EXT)">
1360 <xsl:apply-templates select="." mode="times">
1361 <xsl:with-param name="PARAM" select="$PARAM"/>
1362 <xsl:with-param name="PAREN" select="$PAREN"/>
1363 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1364 </xsl:apply-templates>
1368 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1369 <xsl:attribute name="m:xref">
1370 <xsl:value-of select="@id"/>
1373 <xsl:apply-templates select="." mode="times">
1374 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1375 <xsl:with-param name="PAREN" select="$PAREN"/>
1376 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1377 </xsl:apply-templates>
1383 <xsl:template match = "m:apply[m:times[1]]" mode="times">
1384 <xsl:param name="PARAM" select="$NO_PARAM"/>
1385 <xsl:param name="PAREN" select="$PAR_NO"/>
1386 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1387 <xsl:apply-templates select="*[2]" mode = "semantics">
1388 <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
1389 <xsl:with-param name="PARAM" select="$PARAM"/>
1390 <xsl:with-param name="PAREN" select="$PAREN"/>
1391 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1392 </xsl:apply-templates>
1393 <xsl:if test="*[3]">
1394 <xsl:for-each select = "*[position()>2]">
1395 <!-- HELM: to distinguish between * and the application -->
1396 <!-- <m:mo>⁢</m:mo> -->
1398 <!-- HELM: added -->
1399 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1400 <xsl:attribute name="m:xref">
1401 <xsl:value-of select="../m:times/@id"/>
1404 <xsl:apply-templates select="." mode = "semantics">
1405 <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
1406 <xsl:with-param name="PAREN" select="$PAREN"/>
1407 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1408 </xsl:apply-templates>
1413 <xsl:template match = "m:apply[m:root[1]]">
1415 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1416 <xsl:attribute name="m:xref">
1417 <xsl:value-of select="@id"/>
1420 <xsl:if test="*[2]=m:degree">
1421 <xsl:apply-templates select="*[3]" mode = "semantics">
1422 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1423 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1424 </xsl:apply-templates>
1425 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1427 <xsl:if test="not(*[2]=m:degree)">
1428 <xsl:apply-templates select="*[2]" mode = "semantics">
1429 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1430 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1431 </xsl:apply-templates>
1437 <xsl:template match = "m:apply[m:gcd[1]]">
1439 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1440 <xsl:attribute name="m:xref">
1441 <xsl:value-of select="@id"/>
1444 <xsl:if test="not(parent::m:apply[m:power[1]])">
1446 <!-- HELM: added -->
1447 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1448 <xsl:attribute name="m:xref">
1449 <xsl:value-of select="m:gcd/@id"/>
1453 <xsl:if test="parent::m:apply[m:power[1]]">
1456 <!-- HELM: added -->
1457 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1458 <xsl:attribute name="m:xref">
1459 <xsl:value-of select="m:gcd/@id"/>
1462 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1465 <m:mfenced separators=",">
1466 <xsl:for-each select = "*[position()>1]">
1467 <xsl:apply-templates select = "." mode="semantics"/>
1473 <xsl:template match = "m:apply[m:and[1]]">
1474 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1475 <xsl:param name="PAREN" select="$PAR_NO"/>
1476 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1478 <xsl:when test="$IN_PREC > $AND_PREC">
1479 <m:mfenced separators="">
1480 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1481 <xsl:attribute name="m:xref">
1482 <xsl:value-of select="@id"/>
1485 <xsl:apply-templates select="." mode="and">
1486 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1487 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1488 </xsl:apply-templates>
1491 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1492 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1493 and not($SEM_SW=$SEM_XREF_EXT)">
1494 <xsl:apply-templates select="." mode="and">
1495 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1496 <xsl:with-param name="PAREN" select="$PAREN"/>
1497 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1498 </xsl:apply-templates>
1502 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1503 <xsl:attribute name="m:xref">
1504 <xsl:value-of select="@id"/>
1507 <xsl:apply-templates select="." mode="and">
1508 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1509 <xsl:with-param name="PAREN" select="$PAREN"/>
1510 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1511 </xsl:apply-templates>
1517 <xsl:template match = "m:apply[m:and[1]]" mode="and">
1518 <xsl:param name="PARAM" select="$NO_PARAM"/>
1519 <xsl:param name="PAREN" select="$PAR_NO"/>
1520 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1521 <xsl:apply-templates select="*[2]" mode = "semantics">
1522 <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
1523 <xsl:with-param name="PARAM" select="$PARAM"/>
1524 <xsl:with-param name="PAREN" select="$PAREN"/>
1525 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1526 </xsl:apply-templates>
1527 <xsl:for-each select = "*[position()>2]">
1529 <!-- HELM: added -->
1530 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1531 <xsl:attribute name="m:xref">
1532 <xsl:value-of select="../m:and/@id"/>
1534 </xsl:if>∧</m:mo>
1535 <xsl:apply-templates select="." mode = "semantics">
1536 <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
1537 <xsl:with-param name="PAREN" select="$PAREN"/>
1538 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1539 </xsl:apply-templates>
1543 <xsl:template match = "m:apply[m:or[1]]">
1544 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1545 <xsl:param name="PAREN" select="$PAR_NO"/>
1546 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1548 <xsl:when test="$IN_PREC > $OR_PREC">
1549 <m:mfenced separators="">
1550 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1551 <xsl:attribute name="m:xref">
1552 <xsl:value-of select="@id"/>
1555 <xsl:apply-templates select="." mode="or">
1556 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1557 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1558 </xsl:apply-templates>
1561 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1562 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1563 and not($SEM_SW=$SEM_XREF_EXT)">
1564 <xsl:apply-templates select="." mode="or">
1565 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1566 <xsl:with-param name="PAREN" select="$PAREN"/>
1567 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1568 </xsl:apply-templates>
1572 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1573 <xsl:attribute name="m:xref">
1574 <xsl:value-of select="@id"/>
1577 <xsl:apply-templates select="." mode="or">
1578 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1579 <xsl:with-param name="PAREN" select="$PAREN"/>
1580 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1581 </xsl:apply-templates>
1587 <xsl:template match = "m:apply[m:or[1]]" mode="or">
1588 <xsl:param name="PARAM" select="$NO_PARAM"/>
1589 <xsl:param name="PAREN" select="$PAR_NO"/>
1590 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1591 <xsl:apply-templates select="*[2]" mode = "semantics">
1592 <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1593 <xsl:with-param name="PARAM" select="$PARAM"/>
1594 <xsl:with-param name="PAREN" select="$PAREN"/>
1595 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1596 </xsl:apply-templates>
1597 <xsl:for-each select = "*[position()>2]">
1599 <!-- HELM: added -->
1600 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1601 <xsl:attribute name="m:xref">
1602 <xsl:value-of select="../m:or/@id"/>
1604 </xsl:if>∨</m:mo>
1605 <xsl:apply-templates select="." mode = "semantics">
1606 <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1607 <xsl:with-param name="PAREN" select="$PAREN"/>
1608 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1609 </xsl:apply-templates>
1613 <xsl:template match = "m:apply[m:xor[1]]">
1614 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1615 <xsl:param name="PAREN" select="$PAR_NO"/>
1616 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1618 <xsl:when test="$IN_PREC > $XOR_PREC">
1619 <m:mfenced separators="">
1620 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1621 <xsl:attribute name="m:xref">
1622 <xsl:value-of select="@id"/>
1625 <xsl:apply-templates select="." mode="xor">
1626 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1627 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1628 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1629 </xsl:apply-templates>
1632 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1633 and not($SEM_SW=$SEM_ALL)">
1634 <xsl:apply-templates select="." mode="xor">
1635 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1636 <xsl:with-param name="PAREN" select="$PAREN"/>
1637 </xsl:apply-templates>
1641 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1642 <xsl:attribute name="m:xref">
1643 <xsl:value-of select="@id"/>
1646 <xsl:apply-templates select="." mode="xor">
1647 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1648 <xsl:with-param name="PAREN" select="$PAREN"/>
1649 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1650 </xsl:apply-templates>
1656 <xsl:template match = "m:apply[m:xor[1]]" mode="xor">
1657 <xsl:param name="PARAM" select="$NO_PARAM"/>
1658 <xsl:param name="PAREN" select="$PAR_NO"/>
1659 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1660 <xsl:apply-templates select="*[2]" mode = "semantics">
1661 <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1662 <xsl:with-param name="PARAM" select="$PARAM"/>
1663 <xsl:with-param name="PAREN" select="$PAREN"/>
1664 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1665 </xsl:apply-templates>
1666 <xsl:for-each select = "*[position()>2]">
1668 <!-- HELM: added -->
1669 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1670 <xsl:attribute name="m:xref">
1671 <xsl:value-of select="../m:xor/@id"/>
1673 </xsl:if>⊻</m:mo>
1674 <xsl:apply-templates select="." mode = "semantics">
1675 <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1676 <xsl:with-param name="PAREN" select="$PAREN"/>
1677 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1678 </xsl:apply-templates>
1682 <xsl:template match = "m:apply[m:not[1]]">
1684 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1685 <xsl:attribute name="m:xref">
1686 <xsl:value-of select="@id"/>
1689 <!-- HELM: was <m:mo>not</m:mo> -->
1691 <!-- HELM: added -->
1692 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1693 <xsl:attribute name="m:xref">
1694 <xsl:value-of select="m:not/@id"/>
1696 </xsl:if>¬</m:mo>
1697 <xsl:apply-templates select = "*[2]" mode = "semantics">
1698 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1699 </xsl:apply-templates>
1703 <xsl:template match = "m:apply[m:forall[1]]">
1705 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1706 <xsl:attribute name="m:xref">
1707 <xsl:value-of select="@id"/>
1711 <!-- HELM: added -->
1712 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1713 <xsl:attribute name="m:xref">
1714 <xsl:value-of select="m:forall/@id"/>
1716 </xsl:if>for all</m:mo>
1717 <xsl:if test="count(m:bvar) > 1">
1718 <m:mfenced separators=",">
1719 <xsl:for-each select = "m:bvar">
1720 <xsl:apply-templates select = "." mode="semantics"/>
1724 <xsl:if test="count(m:bvar)=1">
1725 <xsl:apply-templates select = "m:bvar" mode="semantics"/>
1727 <xsl:if test="m:condition">
1729 <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1732 <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and
1733 not(self::m:condition)]" mode = "semantics"/>
1737 <xsl:template match = "m:apply[m:exists[1]]">
1739 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1740 <xsl:attribute name="m:xref">
1741 <xsl:value-of select="@id"/>
1745 <!-- HELM: added -->
1746 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1747 <xsl:attribute name="m:xref">
1748 <xsl:value-of select="m:exists/@id"/>
1750 </xsl:if>∃</m:mo>
1751 <xsl:if test="count(m:bvar) > 1">
1752 <m:mfenced separators=",">
1753 <xsl:for-each select = "m:bvar">
1754 <xsl:apply-templates select = "." mode="semantics"/>
1758 <xsl:if test="count(m:bvar)=1">
1759 <xsl:apply-templates select = "m:bvar" mode="semantics"/>
1761 <xsl:if test="m:condition">
1763 <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1765 <xsl:if test="*[position()>1 and not(self::m:bvar) and not(self::m:condition)]">
1767 <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and
1768 not(self::m:condition)]" mode = "semantics"/>
1773 <xsl:template match = "m:apply[m:abs[1]]">
1774 <xsl:if test="not(parent::m:apply[m:power[1]])">
1775 <m:mfenced open="|" close="|" separators="">
1776 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1777 <xsl:attribute name="m:xref">
1778 <xsl:value-of select="@id"/>
1781 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1784 <xsl:if test="parent::m:apply[m:power[1]]">
1786 <m:mfenced open="|" close="|" separators="">
1787 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1788 <xsl:attribute name="m:xref">
1789 <xsl:value-of select="@id"/>
1792 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1794 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1799 <xsl:template match = "m:apply[m:conjugate[1]]">
1801 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1802 <xsl:attribute name="m:xref">
1803 <xsl:value-of select="@id"/>
1807 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1810 <!-- HELM: added -->
1811 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1812 <xsl:attribute name="m:xref">
1813 <xsl:value-of select="m:conjugate/@id"/>
1815 </xsl:if>̲</m:mo>
1819 <xsl:template match = "m:apply[m:arg[1] | m:real[1] | m:imaginary[1]]">
1821 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1822 <xsl:attribute name="m:xref">
1823 <xsl:value-of select="@id"/>
1827 <xsl:if test="m:arg">
1828 <!-- HELM: added -->
1829 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1830 <xsl:attribute name="m:xref">
1831 <xsl:value-of select="m:arg/@id"/>
1834 <xsl:value-of select="'Arg'"/>
1836 <xsl:if test="m:real">
1837 <!-- HELM: added -->
1838 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1839 <xsl:attribute name="m:xref">
1840 <xsl:value-of select="m:real/@id"/>
1843 <xsl:value-of select="'Re'"/>
1845 <xsl:if test="m:imaginary">
1846 <!-- HELM: added -->
1847 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1848 <xsl:attribute name="m:xref">
1849 <xsl:value-of select="m:imaginary/@id"/>
1852 <xsl:value-of select="'Im'"/>
1855 <m:mfenced separators="">
1856 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1862 <!-- ***************** RELATIONS ***************** -->
1864 <xsl:template match = "m:apply[m:neq | m:approx | m:tendsto | m:implies
1865 | m:in | m:notin | m:notsubset | m:notprsubset
1866 | m:subset | m:prsubset | m:eq | m:gt | m:lt
1867 | m:geq | m:leq | m:equivalent]">
1869 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1870 <xsl:attribute name="m:xref">
1871 <xsl:value-of select="@id"/>
1874 <xsl:if test="*[1]=m:neq or *[1]=m:approx or *[1]=m:tendsto or
1875 *[1]=m:implies or *[1]=m:in or *[1]=m:notin or
1876 *[1]=m:notsubset or *[1]=m:notprsubset">
1877 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1879 <xsl:if test="*[1]=m:neq">
1880 <!-- HELM: added -->
1881 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1882 <xsl:attribute name="m:xref">
1883 <xsl:value-of select="m:neq/@id"/>
1888 <xsl:if test="*[1]=m:approx">
1889 <!-- HELM: added -->
1890 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1891 <xsl:attribute name="m:xref">
1892 <xsl:value-of select="m:approx/@id"/>
1897 <xsl:if test="*[1]=m:tendsto">
1898 <!-- HELM: added -->
1899 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1900 <xsl:attribute name="m:xref">
1901 <xsl:value-of select="m:tendsto/@id"/>
1906 <xsl:if test="*[1]=m:implies">
1907 <!-- HELM: added -->
1908 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1909 <xsl:attribute name="m:xref">
1910 <xsl:value-of select="m:implies/@id"/>
1915 <xsl:if test="*[1]=m:in">
1916 <!-- HELM: added -->
1917 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1918 <xsl:attribute name="m:xref">
1919 <xsl:value-of select="m:in/@id"/>
1924 <xsl:if test="*[1]=m:notin">
1925 <!-- HELM: added -->
1926 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1927 <xsl:attribute name="m:xref">
1928 <xsl:value-of select="m:notin/@id"/>
1933 <xsl:if test="*[1]=m:notsubset">
1934 <!-- HELM: added -->
1935 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1936 <xsl:attribute name="m:xref">
1937 <xsl:value-of select="m:notsubset/@id"/>
1942 <xsl:if test="*[1]=m:notprsubset">
1943 <!-- HELM: added -->
1944 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1945 <xsl:attribute name="m:xref">
1946 <xsl:value-of select="m:notprsubset/@id"/>
1952 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1953 <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='below']">
1955 <!-- HELM: added -->
1956 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1957 <xsl:attribute name="m:xref">
1958 <xsl:value-of select="m:tendsto/@id"/>
1962 <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='above']">
1964 <!-- HELM: added -->
1965 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1966 <xsl:attribute name="m:xref">
1967 <xsl:value-of select="m:tendsto/@id"/>
1972 <xsl:if test="*[1]=m:subset or *[1]=m:prsubset or *[1]=m:eq or *[1]=m:gt
1973 or *[1]=m:lt or *[1]=m:geq or *[1]=m:leq or *[1]=m:equivalent">
1974 <xsl:apply-templates select = "*[2]" mode="semantics"/>
1975 <xsl:for-each select = "*[position()>2]">
1977 <xsl:if test="../*[self::m:subset][1]">
1978 <!-- HELM: added -->
1979 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1980 <xsl:attribute name="m:xref">
1981 <xsl:value-of select="../m:subset/@id"/>
1986 <xsl:if test="../*[self::m:prsubset][1]">
1987 <!-- HELM: added -->
1988 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1989 <xsl:attribute name="m:xref">
1990 <xsl:value-of select="../m:prsubset/@id"/>
1995 <xsl:if test="../*[self::m:eq][1]">
1996 <!-- HELM: added -->
1997 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1998 <xsl:attribute name="m:xref">
1999 <xsl:value-of select="../m:eq/@id"/>
2002 <xsl:value-of select="'='"/>
2004 <xsl:if test="../*[self::m:gt][1]">
2005 <!-- HELM: added -->
2006 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2007 <xsl:attribute name="m:xref">
2008 <xsl:value-of select="../m:gt/@id"/>
2011 <xsl:value-of select="'>'"/>
2013 <xsl:if test="../*[self::m:lt][1]">
2014 <!-- HELM: added -->
2015 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2016 <xsl:attribute name="m:xref">
2017 <xsl:value-of select="../m:lt/@id"/>
2020 <xsl:value-of select="'<'"/>
2022 <xsl:if test="../*[self::m:geq][1]">
2023 <!-- HELM: added -->
2024 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2025 <xsl:attribute name="m:xref">
2026 <xsl:value-of select="../m:geq/@id"/>
2031 <xsl:if test="../*[self::m:leq][1]">
2032 <!-- HELM: added -->
2033 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2034 <xsl:attribute name="m:xref">
2035 <xsl:value-of select="../m:leq/@id"/>
2040 <xsl:if test="../*[self::m:equivalent][1]">
2041 <!-- HELM: added -->
2042 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2043 <xsl:attribute name="m:xref">
2044 <xsl:value-of select="../m:equivalent/@id"/>
2050 <xsl:apply-templates select = "." mode="semantics"/>
2057 <!-- ***************** CALCULUS ***************** -->
2059 <xsl:template match = "m:apply[*[1][self::m:ln]]">
2061 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2062 <xsl:attribute name="m:xref">
2063 <xsl:value-of select="@id"/>
2067 <xsl:when test="parent::m:apply[m:power[1]]">
2070 <!-- HELM: added -->
2071 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2072 <xsl:attribute name="m:xref">
2073 <xsl:value-of select="m:ln/@id"/>
2076 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
2081 <!-- HELM: added -->
2082 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2083 <xsl:attribute name="m:xref">
2084 <xsl:value-of select="m:ln/@id"/>
2089 <m:mo>⁡</m:mo>
2090 <xsl:apply-templates select = "*[2]" mode = "semantics">
2091 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
2092 </xsl:apply-templates>
2096 <xsl:template match = "m:apply[m:log[1]]">
2098 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2099 <xsl:attribute name="m:xref">
2100 <xsl:value-of select="@id"/>
2104 <xsl:when test="parent::m:apply[m:power[1]]">
2105 <xsl:if test="not(*[2]=m:logbase)">
2108 <!-- HELM: added -->
2109 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2110 <xsl:attribute name="m:xref">
2111 <xsl:value-of select="m:log/@id"/>
2114 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
2117 <xsl:if test="*[2]=m:logbase">
2120 <!-- HELM: added -->
2121 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2122 <xsl:attribute name="m:xref">
2123 <xsl:value-of select="m:log/@id"/>
2126 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
2127 <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
2132 <xsl:if test="not(*[2]=m:logbase)">
2135 <xsl:if test="*[2]=m:logbase">
2138 <!-- HELM: added -->
2139 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2140 <xsl:attribute name="m:xref">
2141 <xsl:value-of select="m:log/@id"/>
2144 <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
2149 <m:mo>⁡</m:mo>
2150 <xsl:if test="*[2]=m:logbase">
2151 <xsl:apply-templates select = "*[3]" mode = "semantics">
2152 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
2153 </xsl:apply-templates>
2155 <xsl:if test="not(*[2]=m:logbase)">
2156 <xsl:apply-templates select = "*[2]" mode = "semantics">
2157 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
2158 </xsl:apply-templates>
2163 <xsl:template match = "m:apply[m:diff[1]]">
2165 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2166 <xsl:attribute name="m:xref">
2167 <xsl:value-of select="@id"/>
2170 <xsl:if test="*[2]=m:bvar and m:bvar[*[2]=m:degree]">
2172 <!-- HELM: added -->
2173 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2174 <xsl:attribute name="m:xref">
2175 <xsl:value-of select="m:diff/@id"/>
2180 <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
2185 <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
2186 <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
2191 <xsl:if test="*[2]=m:bvar and not(m:bvar[*[2]=m:degree])">
2193 <!-- HELM: added -->
2194 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2195 <xsl:attribute name="m:xref">
2196 <xsl:value-of select="m:diff/@id"/>
2202 <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
2206 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
2210 <xsl:template match = "m:apply[m:partialdiff[1]]">
2212 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2213 <xsl:attribute name="m:xref">
2214 <xsl:value-of select="@id"/>
2217 <xsl:for-each select = "m:bvar">
2218 <xsl:if test="*[last()]=m:degree">
2220 <!-- HELM: added -->
2221 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2222 <xsl:attribute name="m:xref">
2223 <xsl:value-of select="m:partialdiff/@id"/>
2228 <xsl:apply-templates select = "m:degree" mode = "semantics"/>
2233 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
2234 <xsl:apply-templates select = "m:degree" mode = "semantics"/>
2239 <xsl:if test="not(*[last()]=m:degree)">
2241 <!-- HELM: added -->
2242 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2243 <xsl:attribute name="m:xref">
2244 <xsl:value-of select="m:partialdiff/@id"/>
2250 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
2255 <xsl:apply-templates select = "*[last()]" mode = "semantics"/>
2259 <xsl:template match = "m:lowlimit | m:uplimit | m:bvar | m:degree |
2261 <xsl:apply-templates select="*" mode = "semantics"/>
2264 <xsl:template match = "m:apply[m:divergence[1] | m:grad[1] | m:curl[1]]">
2266 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2267 <xsl:attribute name="m:xref">
2268 <xsl:value-of select="@id"/>
2272 <xsl:if test="*[1]=m:divergence">
2273 <!-- HELM: added -->
2274 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2275 <xsl:attribute name="m:xref">
2276 <xsl:value-of select="m:divergence/@id"/>
2279 <xsl:value-of select="'div'"/>
2281 <xsl:if test="*[1]=m:grad">
2282 <!-- HELM: added -->
2283 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2284 <xsl:attribute name="m:xref">
2285 <xsl:value-of select="m:grad/@id"/>
2288 <xsl:value-of select="'grad'"/>
2290 <xsl:if test="*[1]=m:curl">
2291 <!-- HELM: added -->
2292 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2293 <xsl:attribute name="m:xref">
2294 <xsl:value-of select="m:curl/@id"/>
2297 <xsl:value-of select="'curl'"/>
2301 <xsl:when test="*[2]=m:ci">
2302 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2305 <m:mfenced separators="">
2306 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2313 <xsl:template match = "m:apply[m:laplacian[1]]">
2315 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2316 <xsl:attribute name="m:xref">
2317 <xsl:value-of select="@id"/>
2321 <!-- HELM: added -->
2322 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2323 <xsl:attribute name="m:xref">
2324 <xsl:value-of select="m:laplacian/@id"/>
2327 <m:mo>Δ</m:mo>
2330 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2335 <!-- ***************** SET THEORY ***************** -->
2337 <xsl:template match = "m:set | m:list">
2338 <m:mfenced open="{{" close="}}" separators="">
2339 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2340 <xsl:attribute name="m:xref">
2341 <xsl:value-of select="@id"/>
2344 <xsl:if test="*[1]=m:bvar and *[2]=m:condition">
2345 <xsl:apply-templates select="m:bvar" mode = "semantics"/>
2347 <xsl:apply-templates select="m:condition" mode = "semantics"/>
2349 <xsl:if test="*[1]=m:condition and not(child::m:bvar)">
2350 <m:mfenced open="" close="" separators=",">
2351 <xsl:for-each select = "*[not(self::m:condition) and not(self::m:bvar)]">
2352 <xsl:apply-templates select = "." mode="semantics"/>
2356 <xsl:apply-templates select="m:condition" mode = "semantics"/>
2358 <xsl:if test="not(child::m:bvar) and not(child::m:condition)">
2359 <m:mfenced open="" close="" separators=",">
2360 <xsl:for-each select = "*">
2361 <xsl:apply-templates select = "." mode="semantics"/>
2368 <xsl:template match = "m:apply[m:union[1]]">
2369 <xsl:param name="IN_PREC" select="$NO_PREC"/>
2370 <xsl:param name="PARAM" select="$NO_PARAM"/>
2371 <xsl:param name="PAREN" select="$PAR_NO"/>
2372 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2374 <xsl:when test="$IN_PREC > $UNION_PREC or $IN_PREC=$UNION_PREC
2375 and $PARAM=$PAR_SAME">
2376 <m:mfenced separators="">
2377 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2378 <xsl:attribute name="m:xref">
2379 <xsl:value-of select="@id"/>
2382 <xsl:apply-templates select="." mode="union">
2383 <xsl:with-param name="PARAM" select="$PARAM"/>
2384 <xsl:with-param name="PAREN" select="$PAREN"/>
2385 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2386 </xsl:apply-templates>
2389 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
2390 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
2391 and not($SEM_SW=$SEM_XREF_EXT)">
2392 <xsl:apply-templates select="." mode="union">
2393 <xsl:with-param name="PARAM" select="$PARAM"/>
2394 <xsl:with-param name="PAREN" select="$PAREN"/>
2395 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2396 </xsl:apply-templates>
2400 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2401 <xsl:attribute name="m:xref">
2402 <xsl:value-of select="@id"/>
2405 <xsl:apply-templates select="." mode="union">
2406 <xsl:with-param name="PARAM" select="$PARAM"/>
2407 <xsl:with-param name="PAREN" select="$PAREN"/>
2408 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2409 </xsl:apply-templates>
2415 <xsl:template match = "m:apply[m:union[1]]" mode="union">
2416 <xsl:param name="PARAM" select="$NO_PARAM"/>
2417 <xsl:param name="PAREN" select="$PAR_NO"/>
2418 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2419 <xsl:apply-templates select = "*[2]" mode="semantics">
2420 <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
2421 <xsl:with-param name="PARAM" select="$PARAM"/>
2422 <xsl:with-param name="PAREN" select="$PAREN"/>
2423 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2424 </xsl:apply-templates>
2425 <xsl:for-each select = "*[position()>2]">
2427 <!-- HELM: added -->
2428 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2429 <xsl:attribute name="m:xref">
2430 <xsl:value-of select="../m:union/@id"/>
2432 </xsl:if>⋃</m:mo>
2433 <xsl:apply-templates select = "." mode="semantics">
2434 <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
2435 <xsl:with-param name="PAREN" select="$PAREN"/>
2436 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
2437 </xsl:apply-templates>
2441 <xsl:template match = "m:apply[m:intersect[1]]">
2442 <xsl:param name="IN_PREC" select="$NO_PREC"/>
2443 <xsl:param name="PARAM" select="$NO_PARAM"/>
2444 <xsl:param name="PAREN" select="$PAR_NO"/>
2445 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2447 <xsl:when test="$IN_PREC > $INTERSECT_PREC">
2448 <m:mfenced separators="">
2449 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2450 <xsl:attribute name="m:xref">
2451 <xsl:value-of select="@id"/>
2454 <xsl:apply-templates select="." mode="intersect">
2455 <xsl:with-param name="PARAM" select="$PARAM"/>
2456 <xsl:with-param name="PAREN" select="$PAREN"/>
2457 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2458 </xsl:apply-templates>
2461 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
2462 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
2463 and not($SEM_SW=$SEM_XREF_EXT)">
2464 <xsl:apply-templates select="." mode="intersect">
2465 <xsl:with-param name="PARAM" select="$PARAM"/>
2466 <xsl:with-param name="PAREN" select="$PAREN"/>
2467 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2468 </xsl:apply-templates>
2472 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2473 <xsl:attribute name="m:xref">
2474 <xsl:value-of select="@id"/>
2477 <xsl:apply-templates select="." mode="intersect">
2478 <xsl:with-param name="PARAM" select="$PARAM"/>
2479 <xsl:with-param name="PAREN" select="$PAREN"/>
2480 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2481 </xsl:apply-templates>
2487 <xsl:template match = "m:apply[m:intersect[1]]" mode="intersect">
2488 <xsl:param name="PARAM" select="$NO_PARAM"/>
2489 <xsl:param name="PAREN" select="$PAR_NO"/>
2490 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2491 <xsl:apply-templates select = "*[2]" mode="semantics">
2492 <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
2493 <xsl:with-param name="PARAM" select="$PARAM"/>
2494 <xsl:with-param name="PAREN" select="$PAREN"/>
2495 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2496 </xsl:apply-templates>
2497 <xsl:for-each select = "*[position()>2]">
2499 <!-- HELM: added -->
2500 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2501 <xsl:attribute name="m:xref">
2502 <xsl:value-of select="../m:intersect/@id"/>
2504 </xsl:if>⋂</m:mo>
2505 <xsl:apply-templates select = "." mode="semantics">
2506 <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
2507 <xsl:with-param name="PAREN" select="$PAREN"/>
2508 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
2509 </xsl:apply-templates>
2513 <xsl:template match = "m:apply[m:setdiff[1]]">
2514 <xsl:param name="IN_PREC" select="$NO_PREC"/>
2515 <xsl:param name="PARAM" select="$NO_PARAM"/>
2516 <xsl:param name="PAREN" select="$PAR_NO"/>
2517 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2519 <xsl:when test="$IN_PREC > $SETDIFF_PREC or $IN_PREC=$SETDIFF_PREC
2520 and $PARAM=$PAR_SAME">
2521 <m:mfenced separators="">
2522 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2523 <xsl:attribute name="m:xref">
2524 <xsl:value-of select="@id"/>
2527 <xsl:apply-templates select="." mode="setdiff">
2528 <xsl:with-param name="PARAM" select="$PARAM"/>
2529 <xsl:with-param name="PAREN" select="$PAREN"/>
2530 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2531 </xsl:apply-templates>
2534 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
2535 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
2536 and not($SEM_SW=$SEM_XREF_EXT)">
2537 <xsl:apply-templates select="." mode="setdiff">
2538 <xsl:with-param name="PARAM" select="$PARAM"/>
2539 <xsl:with-param name="PAREN" select="$PAREN"/>
2540 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2541 </xsl:apply-templates>
2545 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2546 <xsl:attribute name="m:xref">
2547 <xsl:value-of select="@id"/>
2550 <xsl:apply-templates select="." mode="setdiff">
2551 <xsl:with-param name="PARAM" select="$PARAM"/>
2552 <xsl:with-param name="PAREN" select="$PAREN"/>
2553 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2554 </xsl:apply-templates>
2560 <xsl:template match = "m:apply[m:setdiff[1]]" mode="setdiff">
2561 <xsl:param name="PARAM" select="$NO_PARAM"/>
2562 <xsl:param name="PAREN" select="$PAR_NO"/>
2563 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2564 <xsl:apply-templates select = "*[2]" mode = "semantics">
2565 <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
2566 <xsl:with-param name="PARAM" select="$PARAM"/>
2567 <xsl:with-param name="PAREN" select="$PAREN"/>
2568 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2569 </xsl:apply-templates>
2571 <!-- HELM: added -->
2572 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2573 <xsl:attribute name="m:xref">
2574 <xsl:value-of select="m:setdiff/@id"/>
2577 <xsl:apply-templates select = "*[3]" mode = "semantics">
2578 <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
2579 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
2580 <xsl:with-param name="PAREN" select="$PAREN"/>
2581 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
2582 </xsl:apply-templates>
2585 <xsl:template match = "m:apply[m:card[1]]">
2586 <m:mfenced open="|" close="|" separators=",">
2587 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2588 <xsl:attribute name="m:xref">
2589 <xsl:value-of select="@id"/>
2592 <xsl:for-each select = "*[position()>1]">
2593 <xsl:apply-templates select = "." mode="semantics"/>
2599 <!-- ***************** SEQUENCES AND SERIES ***************** -->
2601 <xsl:template match = "m:apply[m:sum[1] | m:product[1]]">
2603 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2604 <xsl:attribute name="m:xref">
2605 <xsl:value-of select="@id"/>
2609 <xsl:when test="*[2]=m:bvar and m:lowlimit and m:uplimit">
2612 <xsl:if test="*[1]=m:sum">
2613 <!-- HELM: added -->
2614 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2615 <xsl:attribute name="m:xref">
2616 <xsl:value-of select="m:sum/@id"/>
2621 <xsl:if test="*[1]=m:product">
2622 <!-- HELM: added -->
2623 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2624 <xsl:attribute name="m:xref">
2625 <xsl:value-of select="m:product/@id"/>
2632 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2634 <xsl:apply-templates select = "m:lowlimit" mode = "semantics"/>
2636 <xsl:apply-templates select = "m:uplimit" mode = "semantics"/>
2638 <xsl:apply-templates select = "*[5]" mode = "semantics"/>
2640 <xsl:when test="*[2]=m:bvar and *[3]=m:condition">
2643 <xsl:if test="*[1]=m:sum">
2644 <!-- HELM: added -->
2645 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2646 <xsl:attribute name="m:xref">
2647 <xsl:value-of select="m:sum/@id"/>
2652 <xsl:if test="*[1]=m:product">
2653 <!-- HELM: added -->
2654 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2655 <xsl:attribute name="m:xref">
2656 <xsl:value-of select="m:product/@id"/>
2662 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
2664 <xsl:apply-templates select = "*[4]" mode = "semantics"/>
2670 <xsl:template match = "m:apply[m:limit[1]]">
2672 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2673 <xsl:attribute name="m:xref">
2674 <xsl:value-of select="@id"/>
2679 <!-- HELM: added -->
2680 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2681 <xsl:attribute name="m:xref">
2682 <xsl:value-of select="m:lim/@id"/>
2686 <xsl:if test="*[2]=m:bvar and *[3]=m:lowlimit">
2687 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2688 <m:mo>→</m:mo>
2689 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
2691 <xsl:if test="*[2]=m:bvar and *[3]=m:condition">
2692 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
2696 <xsl:apply-templates select = "*[4]" mode = "semantics"/>
2701 <!-- ***************** TRIGONOMETRY ***************** -->
2703 <xsl:template match = "m:apply[*[1][self::m:sin | self::m:cos |
2704 self::m:tan | self::m:sec | self::m:csc |
2705 self::m:cot | self::m:sinh | self::m:cosh |
2706 self::m:tanh | self::m:sech | self::m:csch |
2707 self::m:coth | self::m:arcsin | self::m:arccos |
2710 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2711 <xsl:attribute name="m:xref">
2712 <xsl:value-of select="@id"/>
2715 <xsl:if test="not(parent::m:apply[m:power[1]])">
2716 <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
2718 <xsl:if test="parent::m:apply[m:power[1]]">
2720 <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
2721 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
2724 <m:mo>⁡</m:mo>
2725 <xsl:apply-templates select = "*[2]" mode = "semantics">
2726 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
2727 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
2728 </xsl:apply-templates>
2732 <xsl:template match = "*" mode="trigonometry">
2734 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2735 <xsl:attribute name="m:xref">
2736 <xsl:value-of select="@id"/>
2740 <xsl:when test="self::m:sin">
2741 <xsl:value-of select="'sin'"/>
2743 <xsl:when test="self::m:cos">
2744 <xsl:value-of select="'cos'"/>
2746 <xsl:when test="self::m:tan">
2747 <xsl:value-of select="'tan'"/>
2749 <xsl:when test="self::m:sec">
2750 <xsl:value-of select="'sec'"/>
2752 <xsl:when test="self::m:csc">
2753 <xsl:value-of select="'csc'"/>
2755 <xsl:when test="self::m:cot">
2756 <xsl:value-of select="'cot'"/>
2758 <xsl:when test="self::m:sinh">
2759 <xsl:value-of select="'sinh'"/>
2761 <xsl:when test="self::m:cosh">
2762 <xsl:value-of select="'cosh'"/>
2764 <xsl:when test="self::m:tanh">
2765 <xsl:value-of select="'tanh'"/>
2767 <xsl:when test="self::m:sech">
2768 <xsl:value-of select="'sech'"/>
2770 <xsl:when test="self::m:csch">
2771 <xsl:value-of select="'csch'"/>
2773 <xsl:when test="self::m:coth">
2774 <xsl:value-of select="'coth'"/>
2776 <xsl:when test="self::m:arcsin">
2777 <xsl:value-of select="'arcsin'"/>
2779 <xsl:when test="self::m:arccos">
2780 <xsl:value-of select="'arccos'"/>
2782 <xsl:when test="self::m:arctan">
2783 <xsl:value-of select="'arctan'"/>
2790 <!-- ***************** STATISTICS ***************** -->
2792 <xsl:template match = "m:apply[m:mean[1]]">
2793 <m:mfenced open="<" close=">" separators=",">
2794 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2795 <xsl:attribute name="m:xref">
2796 <xsl:value-of select="@id"/>
2799 <xsl:for-each select = "*[position()>1]">
2800 <xsl:apply-templates select = "." mode="semantics"/>
2805 <xsl:template match = "m:apply[m:sdev[1]]">
2807 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2808 <xsl:attribute name="m:xref">
2809 <xsl:value-of select="@id"/>
2813 <!-- HELM: added -->
2814 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2815 <xsl:attribute name="m:xref">
2816 <xsl:value-of select="m:sdev/@id"/>
2818 </xsl:if>σ</m:mo>
2819 <m:mfenced separators=",">
2820 <xsl:for-each select = "*[position()>1]">
2821 <xsl:apply-templates select = "." mode="semantics"/>
2827 <xsl:template match = "m:apply[m:variance[1]]">
2829 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2830 <xsl:attribute name="m:xref">
2831 <xsl:value-of select="@id"/>
2835 <!-- HELM: added -->
2836 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2837 <xsl:attribute name="m:xref">
2838 <xsl:value-of select="m:variance/@id"/>
2840 </xsl:if>σ</m:mo>
2842 <m:mfenced separators=",">
2843 <xsl:for-each select = "*[position()>1]">
2844 <xsl:apply-templates select = "." mode="semantics"/>
2852 <xsl:template match = "m:apply[m:median[1]]">
2854 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2855 <xsl:attribute name="m:xref">
2856 <xsl:value-of select="@id"/>
2860 <!-- HELM: added -->
2861 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2862 <xsl:attribute name="m:xref">
2863 <xsl:value-of select="m:median/@id"/>
2865 </xsl:if>median</m:mo>
2866 <m:mfenced separators=",">
2867 <xsl:for-each select = "*[position()>1]">
2868 <xsl:apply-templates select = "." mode="semantics"/>
2874 <xsl:template match = "m:apply[m:mode[1]]">
2876 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2877 <xsl:attribute name="m:xref">
2878 <xsl:value-of select="@id"/>
2882 <!-- HELM: added -->
2883 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2884 <xsl:attribute name="m:xref">
2885 <xsl:value-of select="m:mode/@id"/>
2887 </xsl:if>mode</m:mo>
2888 <m:mfenced separators=",">
2889 <xsl:for-each select = "*[position()>1]">
2890 <xsl:apply-templates select = "." mode="semantics"/>
2896 <xsl:template match = "m:apply[m:moment[1]]">
2897 <m:mfenced open="<" close=">" separators="">
2898 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2899 <xsl:attribute name="m:xref">
2900 <xsl:value-of select="@id"/>
2903 <xsl:if test="*[2]=m:degree">
2905 <xsl:apply-templates select="*[3]" mode = "semantics"/>
2906 <xsl:apply-templates select="*[2]" mode = "semantics"/>
2909 <xsl:if test="not(*[2]=m:degree)">
2910 <xsl:for-each select = "*[position()>1]">
2911 <xsl:apply-templates select = "." mode="semantics"/>
2918 <!-- ***************** LINEAR ALGEBRA ***************** -->
2920 <xsl:template match="m:vector">
2921 <m:mfenced separators="">
2922 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2923 <xsl:attribute name="m:xref">
2924 <xsl:value-of select="@id"/>
2928 <xsl:for-each select="*">
2930 <xsl:apply-templates select="." mode = "semantics"/>
2937 <xsl:template match = "m:matrix">
2938 <m:mfenced separators="">
2939 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2940 <xsl:attribute name="m:xref">
2941 <xsl:value-of select="@id"/>
2945 <xsl:apply-templates select="*" mode = "semantics"/>
2950 <xsl:template match = "m:matrixrow">
2952 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2953 <xsl:attribute name="m:xref">
2954 <xsl:value-of select="@id"/>
2957 <xsl:for-each select="*">
2959 <xsl:apply-templates select="." mode = "semantics"/>
2965 <xsl:template match = "m:apply[m:determinant[1]]">
2967 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2968 <xsl:attribute name="m:xref">
2969 <xsl:value-of select="@id"/>
2973 <!-- HELM: added -->
2974 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2975 <xsl:attribute name="m:xref">
2976 <xsl:value-of select="m:determinant/@id"/>
2979 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2983 <xsl:template match = "m:apply[m:transpose[1]]">
2985 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2986 <xsl:attribute name="m:xref">
2987 <xsl:value-of select="@id"/>
2990 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2992 <!-- HELM: added -->
2993 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2994 <xsl:attribute name="m:xref">
2995 <xsl:value-of select="m:transpose/@id"/>
3001 <xsl:template match = "m:apply[m:selector[1]]">
3002 <xsl:if test="*[2]=m:matrix and *[3]=m:cn">
3003 <xsl:variable name="m" select = "*[3]"/>
3005 <xsl:when test="*[4]=m:cn">
3006 <xsl:variable name="n" select = "*[4]"/>
3007 <xsl:copy-of select = "m:matrix/*[position()=$m]/*[position()=$n]"/>
3010 <xsl:copy-of select = "m:matrix/*[position()=$m]"/>
3014 <xsl:if test="(*[2]=m:vector or *[2]=m:list) and *[3]=m:cn">
3015 <xsl:variable name="m" select = "*[3]"/>
3016 <xsl:copy-of select = "*[2]/*[position()=$m]"/>
3020 <xsl:template match = "m:apply[m:vectorproduct[1] |
3021 m:scalarproduct[1] | m:outerproduct[1]]">
3023 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3024 <xsl:attribute name="m:xref">
3025 <xsl:value-of select="@id"/>
3028 <xsl:apply-templates select="*[2]" mode = "semantics"/>
3030 <xsl:if test="m:vectorproduct[1]">
3031 <!-- HELM: added -->
3032 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3033 <xsl:attribute name="m:xref">
3034 <xsl:value-of select="m:vectorproduct/@id"/>
3039 <xsl:if test="m:scalarproduct[1] | m:outerproduct[1]">
3040 <!-- HELM: added -->
3041 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3042 <xsl:attribute name="m:xref">
3043 <xsl:value-of select="*[1]/@id"/>
3046 <xsl:value-of select="'.'"/>
3049 <xsl:apply-templates select="*[3]" mode = "semantics"/>