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 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" -->
41 <xsl:output method="xml" indent="yes"/>
43 <xsl:output method="xml"/>
46 <xsl:strip-space elements="apply semantics annotation-xml
47 csymbol fn cn ci interval matrix matrixrow vector
48 lambda bvar condition logbase degree set list
52 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
53 <!-- Parameters, variables and constants -->
54 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
56 <!-- ~~~~~~~~ Semantics related *constants*: ~~~~~~~~ -->
58 <!-- Strip off semantics -->
59 <xsl:variable name="SEM_STRIP" select="-1"/>
61 <!-- Pass semantics "as is" -->
62 <xsl:variable name="SEM_PASS" select="0"/>
64 <!-- Add semantics at top level only -->
65 <xsl:variable name="SEM_TOP" select="1"/>
67 <!-- Add semantics at all levels -->
68 <xsl:variable name="SEM_ALL" select="2"/>
70 <!-- Semantics at top level only, with id refs -->
71 <!-- NOTE: ids have to be already present in the
72 input for this feature to work. -->
73 <xsl:variable name="SEM_XREF" select="3"/>
75 <!-- No semantics at top level, with id refs -->
76 <!-- NOTE: ids have to be already present in the
77 input for this feature to work. -->
78 <xsl:variable name="SEM_XREF_EXT" select="4"/>
81 <!-- ~~~~~~~~~~ Stylesheet *parameter*: SEM_SW ~~~~~~~~~~~~~~ -->
82 <!-- Assumes one of the above values; SEM_PASS is the default -->
83 <!-- The default can be overridden by specifying different -->
84 <!-- value on the command line when the stylesheet is invoked -->
86 <!-- HELM: $SEM_SW was SEM_PASS (error!) -->
87 <xsl:param name="SEM_SW" select="$SEM_XREF"/>
89 <!-- ~~~~~~ Operator precedence definitions ~~~~~~ -->
91 <xsl:variable name="NO_PREC" select="0"/>
92 <xsl:variable name="UNION_PREC" select="1"/>
93 <xsl:variable name="SETDIFF_PREC" select="1"/>
94 <xsl:variable name="INTERSECT_PREC" select="3"/>
95 <xsl:variable name="OR_PREC" select="5"/>
96 <xsl:variable name="XOR_PREC" select="5"/>
97 <xsl:variable name="AND_PREC" select="7"/>
98 <xsl:variable name="PLUS_PREC" select="9"/>
99 <xsl:variable name="MINUS_PREC" select="9"/>
100 <xsl:variable name="MUL_PREC" select="11"/>
101 <xsl:variable name="DIV_PREC" select="11"/>
102 <xsl:variable name="NEG_PREC" select="13"/>
103 <xsl:variable name="FUNCTION_PREC" select="99"/>
105 <!-- ~~~~~ Miscellaneous constant definitions ~~~~~ -->
107 <xsl:variable name="YES" select="1"/>
108 <xsl:variable name="NO" select="0"/>
109 <xsl:variable name="NO_PARAM" select="-1"/>
110 <xsl:variable name="PAR_SAME" select="-3"/>
111 <xsl:variable name="PAR_YES" select="-5"/>
112 <xsl:variable name="PAR_NO" select="-7"/>
115 <!-- +++++++++++++++++ INDEX OF TEMPLATES +++++++++++++++++++ -->
117 <!-- All templates are subdivided into the following categories
118 (listed in the order of appearance in the stylesheet):
120 THE TOPMOST ELEMENT: MATH
126 BASIC CONTAINER ELEMENTS
129 BASIC CONTENT ELEMENTS
130 fn, interval, inverse, sep, condition, declare, lambda, compose, ident
132 ARITHMETIC, ALGEBRA & LOGIC
133 quotient, exp, factorial, max, min, minus, plus, power, rem, divide,
134 times, root, gcd, and, or, xor, not, forall, exists, abs, conjugate,
138 neq, approx, tendsto, implies, in, notin, notsubset, notprsubset,
139 subset, prsubset, eq, gt, lt, geq, leq, equivalent
142 ln, log, diff, partialdiff, lowlimit, uplimit, bvar, degree,
143 logbase, divergence, grad, curl, laplacian
146 set, list, union, intersect, setdiff, card
152 sin, cos, tan, sec, csc, cot, sinh, cosh, tanh, sech, csch, coth,
153 arcsin, arccos, arctan
156 mean, sdev, variance, median, mode, moment
159 vector, matrix, matrixrow, determinant, transpose, selector,
160 vectorproduct, scalarproduct, outerproduct
164 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
165 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ TEMPLATES ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
166 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
169 <!-- ***************** THE TOPMOST ELEMENT: MATH ***************** -->
171 <xsl:template match = "m:math">
173 <xsl:when test="$SEM_SW=$SEM_TOP or $SEM_SW=$SEM_ALL and *[2] or
177 <xsl:apply-templates mode = "semantics"/>
179 <m:annotation-xml encoding="MathML">
180 <xsl:copy-of select="*"/>
186 <xsl:apply-templates mode = "semantics"/>
193 <!-- ***************** SEMANTICS HANDLING ***************** -->
195 <!-- This template is called recursively. At each level -->
196 <!-- in the source tree it decides whether to strip off, -->
197 <!-- pass or add semantics at that level (depending on the -->
198 <!-- value of SEM_SW parameter). Then the actual template -->
199 <!-- is applied to the node. -->
201 <xsl:template match = "m:*" mode = "semantics">
202 <xsl:param name="IN_PREC" select="$NO_PREC"/>
203 <xsl:param name="PARAM" select="$NO_PARAM"/>
204 <xsl:param name="PAREN" select="$PAR_NO"/>
205 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
207 <xsl:when test="$SEM_SW=$SEM_STRIP and self::m:semantics">
208 <xsl:apply-templates select="m:annotation-xml[@encoding='MathML']">
209 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
210 <xsl:with-param name="PARAM" select="$PARAM"/>
211 <xsl:with-param name="PAREN" select="$PAREN"/>
212 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
213 </xsl:apply-templates>
215 <xsl:when test="($SEM_SW=$SEM_PASS or $SEM_SW=$SEM_TOP) and self::m:semantics">
217 <xsl:apply-templates select="*[1]">
218 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
219 <xsl:with-param name="PARAM" select="$PARAM"/>
220 <xsl:with-param name="PAREN" select="$PAREN"/>
221 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
222 </xsl:apply-templates>
223 <xsl:copy-of select="m:annotation-xml"/>
226 <xsl:when test="$SEM_SW=$SEM_ALL">
229 <xsl:when test="self::m:semantics">
230 <xsl:apply-templates select="*[1]">
231 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
232 <xsl:with-param name="PARAM" select="$PARAM"/>
233 <xsl:with-param name="PAREN" select="$PAREN"/>
234 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
235 </xsl:apply-templates>
236 <xsl:copy-of select="m:annotation-xml"/>
239 <xsl:apply-templates select=".">
240 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
241 <xsl:with-param name="PARAM" select="$PARAM"/>
242 <xsl:with-param name="PAREN" select="$PAREN"/>
243 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
244 </xsl:apply-templates>
245 <m:annotation-xml encoding="MathML">
246 <xsl:copy-of select="."/>
252 <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
254 <!-- HELM: syntax error: sematics -->
255 <xsl:when test="self::m:semantics">
257 <xsl:copy-of select="@*"/>
258 <xsl:attribute name="xref">
259 <xsl:value-of select="@id"/>
261 <xsl:copy-of select="*[1]"/>
262 <xsl:copy-of select="m:annotation-xml"/>
266 <xsl:apply-templates select=".">
267 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
268 <xsl:with-param name="PARAM" select="$PARAM"/>
269 <xsl:with-param name="PAREN" select="$PAREN"/>
270 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
271 </xsl:apply-templates>
277 <xsl:when test="self::m:semantics">
278 <xsl:copy-of select="."/>
281 <xsl:apply-templates select=".">
282 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
283 <xsl:with-param name="PARAM" select="$PARAM"/>
284 <xsl:with-param name="PAREN" select="$PAREN"/>
285 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
286 </xsl:apply-templates>
293 <xsl:template match = "m:semantics">
294 <xsl:apply-templates select="." mode = "semantics"/>
298 <!-- ***************** BASIC CONTAINER ELEMENTS ***************** -->
300 <!-- HELM: cn could not contain MAthML presentation -->
301 <xsl:template match = "m:cn">
302 <xsl:param name="IN_PREC" select="$NO_PREC"/>
303 <xsl:param name="PAREN" select="$PAR_NO"/>
304 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
308 <xsl:when test="child::text()">
312 <xsl:when test=". < 0 and $IN_PREC > $NO_PREC and $PAREN=$PAR_NO
313 and $PAR_NO_IGNORE=$NO">
314 <m:mfenced separators="">
315 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
316 <xsl:attribute name="xref">
317 <xsl:value-of select="@id"/>
320 <xsl:apply-templates select="." mode="cn"/>
325 <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
326 <xsl:apply-templates select="." mode="cnid"/>
329 <xsl:apply-templates select="." mode="cn"/>
339 <xsl:attribute name="xref">
340 <xsl:value-of select="@id"/>
342 <xsl:copy-of select="*"/>
350 <xsl:template match = "m:cn" mode="cn">
352 <xsl:when test="@base and (not(@type) or @type='integer' or @type='real')">
354 <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
355 <m:mn> <xsl:value-of select="@base"/> </m:mn>
358 <xsl:when test="@type='complex' and not(@base) and child::m:sep[1]">
359 <m:mfenced separators="">
360 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
361 <xsl:if test="text()[2] < 0">
363 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
365 <xsl:if test="not(text()[2] < 0)">
367 <m:mn> <xsl:value-of select="text()[2]"/> </m:mn>
369 <m:mo>⁢</m:mo>
373 <xsl:when test="@type='complex' and @base and child::m:sep[1]">
375 <m:mfenced separators="">
376 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
377 <xsl:if test="text()[2] < 0">
379 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
381 <xsl:if test="not(text()[2] < 0)">
383 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
385 <m:mo>⁢</m:mo>
388 <m:mn> <xsl:value-of select="@base"/> </m:mn>
391 <xsl:when test="@type='rational' and not(@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 <xsl:when test="@type='rational' and @base and child::m:sep[1]">
401 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
402 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
405 <m:mn> <xsl:value-of select="@base"/> </m:mn>
408 <xsl:when test="@type='polar' and not(@base) and child::m:sep[1]">
411 <m:mo>⁢</m:mo>
412 <m:mfenced separators=",">
413 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
414 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
418 <xsl:when test="@type='polar' and @base and child::m:sep[1]">
422 <m:mo>⁢</m:mo>
423 <m:mfenced separators=",">
424 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
425 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
428 <m:mn> <xsl:value-of select="@base"/> </m:mn>
433 <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
436 <xsl:when test="child::text() and not(*[1])">
437 <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
441 <xsl:when test="not(*[2])">
442 <xsl:copy-of select="*[1]"/>
446 <xsl:copy-of select="*|text()"/>
457 <xsl:template match = "m:cn" mode="cnid">
459 <xsl:when test="@base and (not(@type) or @type='integer' or @type='real')">
460 <m:msub xref="{@id}">
461 <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
462 <m:mn> <xsl:value-of select="@base"/> </m:mn>
465 <xsl:when test="@type='complex' and not(@base) and child::m:sep[1]">
466 <m:mfenced separators="" xref="{@id}">
467 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
468 <xsl:if test="text()[2] < 0">
470 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
472 <xsl:if test="not(text()[2] < 0)">
474 <m:mn> <xsl:value-of select="text()[2]"/> </m:mn>
476 <m:mo>⁢</m:mo>
480 <xsl:when test="@type='complex' and @base and child::m:sep[1]">
481 <m:msub xref="{@id}">
482 <m:mfenced separators="">
483 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
484 <xsl:if test="text()[2] < 0">
486 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
488 <xsl:if test="not(text()[2] < 0)">
490 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
492 <m:mo>⁢</m:mo>
495 <m:mn> <xsl:value-of select="@base"/> </m:mn>
498 <xsl:when test="@type='rational' and not(@base) and child::m:sep[1]">
499 <m:mfrac xref="{@id}">
500 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
501 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
504 <xsl:when test="@type='rational' and @base and child::m:sep[1]">
505 <m:msub xref="{@id}">
508 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
509 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
512 <m:mn> <xsl:value-of select="@base"/> </m:mn>
515 <xsl:when test="@type='polar' and not(@base) and child::m:sep[1]">
516 <m:mrow xref="{@id}">
518 <m:mo>⁢</m:mo>
519 <m:mfenced separators=",">
520 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
521 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
525 <xsl:when test="@type='polar' and @base and child::m:sep[1]">
526 <m:msub xref="{@id}">
529 <m:mo>⁢</m:mo>
530 <m:mfenced separators=",">
531 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
532 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
535 <m:mn> <xsl:value-of select="@base"/> </m:mn>
540 <xsl:when test="child::text() and not(*[1])">
541 <m:mn xref="{@id}"> <xsl:apply-templates mode = "semantics"/> </m:mn>
544 <xsl:variable name="id" select="@id"/>
546 <xsl:when test="not(*[2])">
547 <xsl:for-each select="*[1]">
549 <xsl:attribute name="xref">
550 <xsl:value-of select="$id"/>
552 <xsl:copy-of select="@*|*"/>
557 <m:mrow xref="{$id}">
558 <xsl:copy-of select="*|text()"/>
568 <!-- HELM: ci could not contain MAthML presentation -->
569 <xsl:template match = "m:ci">
572 <xsl:when test="@type='vector' or @type=matrix or @type=set">
573 <m:mi fontweight="bold">
574 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
575 <xsl:attribute name="xref">
576 <xsl:value-of select="@id"/>
579 <xsl:apply-templates mode = "semantics"/>
582 <xsl:when test="child::text() and not(child::*[1])">
584 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
585 <xsl:attribute name="xref">
586 <xsl:value-of select="@id"/>
589 <!-- HELM: added mode=semantics -->
590 <xsl:apply-templates mode = "semantics"/>
593 <xsl:when test="child::text() and *[1] and not(*[1]=m:sep)">
595 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
596 <xsl:attribute name="xref">
597 <xsl:value-of select="@id"/>
600 <!-- HELM: added mode=semantics -->
601 <xsl:apply-templates mode = "semantics"/>
607 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
608 <xsl:attribute name="xref">
609 <xsl:value-of select="@id"/>
612 <xsl:apply-templates select="*"/>
615 <xsl:if test="not(*[2])">
617 <xsl:apply-templates select="*[1]"/>
619 <xsl:variable name="id" select="@id"/>
620 <xsl:for-each select="*[1]">
622 <xsl:attribute name="xref">
623 <xsl:value-of select="$id"/>
625 <xsl:copy-of select="@*|*"/>
635 <xsl:template match = "m:ci/m:*[not(self::m:sep)]">
636 <xsl:copy-of select = "."/>
639 <!-- HELM: previous Version x.xx from Feb. 18, 2000 -->
640 <xsl:template match = "m:csymbol">
643 <xsl:attribute name="xref">
644 <xsl:value-of select="@id"/>
648 <xsl:when test="*[1]">
649 <xsl:copy-of select = "*"/>
653 <xsl:apply-templates mode = "semantics"/>
661 <!-- HELM: csymbol cannot contain ci or cn elements, but only text or
662 presentation elements. PCDATA should render as if it were wrapped in
663 an mo. Mixed content: mrow which contains mo + presentation elements -->
664 <!--<xsl:template match = "m:csymbol/m:*">
666 <xsl:when test="self::m:cn or self::m:ci">
667 <xsl:apply-templates mode = "semantics"/>
670 <xsl:copy-of select = "."/>
675 <xsl:template match = "m:csymbol/text()">
677 <xsl:when test=". < 0 or . = 0 or . > 0">
678 <mn> <xsl:copy-of select = "."/> </mn>
681 <mi> <xsl:copy-of select = "."/> </mi>
687 <!-- ***************** BASIC CONTENT ELEMENTS ***************** -->
689 <xsl:template match = "m:apply[m:*[1][self::m:fn]]">
691 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
692 <xsl:attribute name="xref">
693 <xsl:value-of select="@id"/>
696 <xsl:apply-templates select = "m:fn[1]" mode = "semantics"/>
699 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
700 <xsl:attribute name="xref">
701 <xsl:value-of select="m:fn/@id"/>
703 </xsl:if>⁡</m:mo>
704 <m:mfenced separators=",">
705 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
710 <xsl:template match = "m:fn">
711 <xsl:apply-templates select = "*[1]" mode = "semantics">
712 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
713 </xsl:apply-templates>
716 <xsl:template match = "m:interval">
717 <m:mfenced separators=",">
718 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
719 <xsl:attribute name="xref">
720 <xsl:value-of select="@id"/>
723 <xsl:if test="@closure='closed' or @closure='closed-open'">
724 <xsl:attribute name="open">[</xsl:attribute>
726 <xsl:if test="@closure='closed' or @closure='open-closed'">
727 <xsl:attribute name="close">]</xsl:attribute>
729 <xsl:apply-templates select="*" mode = "semantics"/>
733 <xsl:template match = "m:apply[m:*[1][self::m:apply[m:inverse[1]]]]">
735 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
736 <xsl:attribute name="xref">
737 <xsl:value-of select="@id"/>
740 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
741 <m:mo>⁡</m:mo>
742 <m:mfenced separators=",">
743 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
748 <xsl:template match = "m:apply[*[1][self::m:inverse]]">
750 <xsl:when test="*[2]=m:exp or *[2]=m:ln or *[2]=m:sin or *[2]=m:cos or
751 *[2]=m:tan or *[2]=m:sec or *[2]=m:csc or *[2]=m:cot or
752 *[2]=m:sinh or *[2]=m:cosh or *[2]=m:tanh or *[2]=m:sech or
753 *[2]=m:csch or *[2]=m:coth or *[2]=m:arcsin or
754 *[2]=m:arccos or *[2]=m:arctan">
756 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
757 <xsl:attribute name="xref">
758 <xsl:value-of select="@id"/>
761 <xsl:apply-templates select="*[2]" mode="inverse"/>
766 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
767 <xsl:attribute name="xref">
768 <xsl:value-of select="@id"/>
771 <xsl:apply-templates select = "*[2]"/>
780 <xsl:template match = "*" mode="inverse">
782 <xsl:when test="self::m:exp">
783 <xsl:value-of select="'ln'"/>
785 <xsl:when test="self::m:ln">
786 <xsl:value-of select="'exp'"/>
788 <xsl:when test="self::m:sin">
789 <xsl:value-of select="'arcsin'"/>
791 <xsl:when test="self::m:cos">
792 <xsl:value-of select="'arccos'"/>
794 <xsl:when test="self::m:tan">
795 <xsl:value-of select="'arctan'"/>
797 <xsl:when test="self::m:sec">
798 <xsl:value-of select="'arcsec'"/>
800 <xsl:when test="self::m:csc">
801 <xsl:value-of select="'arccsc'"/>
803 <xsl:when test="self::m:cot">
804 <xsl:value-of select="'arccot'"/>
806 <xsl:when test="self::m:sinh">
807 <xsl:value-of select="'arcsinh'"/>
809 <xsl:when test="self::m:cosh">
810 <xsl:value-of select="'arccosh'"/>
812 <xsl:when test="self::m:tanh">
813 <xsl:value-of select="'arctanh'"/>
815 <xsl:when test="self::m:sech">
816 <xsl:value-of select="'arcsech'"/>
818 <xsl:when test="self::m:csch">
819 <xsl:value-of select="'arccsch'"/>
821 <xsl:when test="self::m:coth">
822 <xsl:value-of select="'arccoth'"/>
824 <xsl:when test="self::m:arcsin">
825 <xsl:value-of select="'sin'"/>
827 <xsl:when test="self::m:arccos">
828 <xsl:value-of select="'cos'"/>
830 <xsl:when test="self::m:arctan">
831 <xsl:value-of select="'tan'"/>
836 <xsl:template match = "m:sep"/>
838 <xsl:template match = "m:condition">
840 <xsl:when test="parent::m:apply[m:forall[1]]"/>
843 <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
844 <m:mrow xref="{@id}">
845 <xsl:apply-templates select="*" mode = "semantics"/>
849 <xsl:if test="not(*[2])">
850 <xsl:apply-templates select="*" mode = "semantics"/>
854 <xsl:apply-templates select="*" mode = "semantics"/>
863 <xsl:template match = "m:declare"/>
865 <xsl:template match = "m:lambda">
867 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
868 <xsl:attribute name="xref">
869 <xsl:value-of select="@id"/>
872 <m:mo>Λ</m:mo>
873 <m:mo>⁡</m:mo>
874 <m:mfenced separators=",">
875 <xsl:for-each select = "*">
877 <xsl:when test="self::m:ci or self::m:cn">
878 <xsl:apply-templates select = "." mode="semantics"/>
882 <xsl:apply-templates select = "." mode="semantics"/>
891 <xsl:template match = "m:apply[*[1][self::m:apply[m:compose[1]]]]">
893 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
894 <xsl:attribute name="xref">
895 <xsl:value-of select="@id"/>
898 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
899 <m:mo>⁡</m:mo>
900 <m:mfenced separators=",">
901 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
906 <xsl:template match = "m:apply[*[1][self::m:compose]]">
907 <m:mfenced separators="">
908 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
909 <xsl:attribute name="xref">
910 <xsl:value-of select="@id"/>
913 <xsl:apply-templates select = "m:*[2][self::m:ci[@type='fn'] |
914 self::m:fn]" mode="semantics"/>
915 <xsl:for-each select = "m:*[position()>2][self::m:ci[@type='fn'] |
919 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
920 <xsl:attribute name="xref">
921 <xsl:value-of select="../m:compose/@id"/>
923 </xsl:if>∘</m:mo>
924 <xsl:apply-templates select = "." mode="semantics"/>
929 <xsl:template match = "m:ident">
931 <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
932 <m:mo xref="{@id}">id</m:mo>
941 <!-- ***************** ARITHMETIC, ALGEBRA & LOGIC ***************** -->
943 <xsl:template match = "m:apply[m:quotient[1]]">
945 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
946 <xsl:attribute name="xref">
947 <xsl:value-of select="@id"/>
950 <m:mo form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em">⌊</m:mo>
953 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
954 <xsl:attribute name="xref">
955 <xsl:value-of select="m:quotient/@id"/>
959 <xsl:apply-templates select="*[2]" mode = "semantics">
960 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
961 </xsl:apply-templates>
964 <xsl:apply-templates select="*[3]" mode = "semantics">
965 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
966 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
967 </xsl:apply-templates>
970 <m:mo form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em">⌊</m:mo>
974 <xsl:template match = "m:apply[*[1][self::m:exp]]">
976 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
977 <xsl:attribute name="xref">
978 <xsl:value-of select="@id"/>
983 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
984 <xsl:attribute name="xref">
985 <xsl:value-of select="m:exp/@id"/>
988 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
992 <xsl:template match = "m:apply[m:factorial[1]]">
994 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
995 <xsl:attribute name="xref">
996 <xsl:value-of select="@id"/>
999 <xsl:apply-templates select = "*[2]" mode = "semantics">
1000 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1001 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1002 </xsl:apply-templates>
1004 <!-- HELM: added -->
1005 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1006 <xsl:attribute name="xref">
1007 <xsl:value-of select="m:factorial/@id"/>
1013 <xsl:template match = "m:apply[m:max[1] | m:min[1]]">
1015 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1016 <xsl:attribute name="xref">
1017 <xsl:value-of select="@id"/>
1020 <xsl:if test="*[2]=m:bvar">
1022 <xsl:if test="*[1]=m:max">
1024 <!-- HELM: added -->
1025 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1026 <xsl:attribute name="xref">
1027 <xsl:value-of select="m:max/@id"/>
1031 <xsl:if test="*[1]=m:min">
1033 <!-- HELM: added -->
1034 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1035 <xsl:attribute name="xref">
1036 <xsl:value-of select="m:min/@id"/>
1040 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1042 <xsl:if test="*[3]=m:condition">
1043 <m:mfenced open="{{" close="}}" separators="">
1044 <m:mfenced open="" close="" separators=",">
1045 <xsl:for-each select = "*[position()>3]">
1046 <xsl:apply-templates select = "." mode="semantics"/>
1050 <xsl:apply-templates select="*[3]" mode = "semantics"/>
1053 <xsl:if test="not(*[3]=m:condition)">
1054 <m:mfenced open="{{" close="}}" separators=",">
1055 <xsl:for-each select = "*[position()>2]">
1056 <xsl:apply-templates select = "." mode="semantics"/>
1061 <xsl:if test="*[2]=m:condition">
1062 <xsl:if test="*[1]=m:max">
1065 <xsl:if test="*[1]=m:min">
1068 <m:mfenced open="{{" close="}}" separators="">
1069 <xsl:if test="*[3]">
1070 <m:mfenced open="" close="" separators=",">
1071 <xsl:for-each select = "*[position()>2]">
1072 <xsl:apply-templates select = "." mode="semantics"/>
1077 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1080 <xsl:if test="not(*[2]=m:condition) and not(*[2]=m:bvar)">
1081 <xsl:if test="*[1]=m:max">
1084 <xsl:if test="*[1]=m:min">
1087 <m:mfenced open="{{" close="}}" separators=",">
1088 <xsl:for-each select = "*[position()>1]">
1089 <xsl:apply-templates select = "." mode="semantics"/>
1096 <xsl:template match = "m:apply[m:minus[1]]">
1097 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1098 <xsl:param name="PARAM" select="$NO_PARAM"/>
1099 <xsl:param name="PAREN" select="$PAR_NO"/>
1100 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1102 <xsl:when test="$IN_PREC > $MINUS_PREC or $IN_PREC=$MINUS_PREC and
1104 <m:mfenced separators="">
1105 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1106 <xsl:attribute name="xref">
1107 <xsl:value-of select="@id"/>
1110 <xsl:apply-templates select="." mode="minus">
1111 <xsl:with-param name="PARAM" select="$PARAM"/>
1112 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1113 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1114 </xsl:apply-templates>
1117 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1118 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1119 and not($SEM_SW=$SEM_XREF_EXT)">
1120 <xsl:apply-templates select="." mode="minus">
1121 <xsl:with-param name="PARAM" select="$PARAM"/>
1122 <xsl:with-param name="PAREN" select="$PAREN"/>
1123 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1124 </xsl:apply-templates>
1128 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1129 <xsl:attribute name="xref">
1130 <xsl:value-of select="@id"/>
1133 <xsl:apply-templates select="." mode="minus">
1134 <xsl:with-param name="PARAM" select="$PARAM"/>
1135 <xsl:with-param name="PAREN" select="$PAREN"/>
1136 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1137 </xsl:apply-templates>
1143 <xsl:template match = "m:apply[m:minus[1]]" mode="minus">
1144 <xsl:param name="PARAM" select="$NO_PARAM"/>
1145 <xsl:param name="PAREN" select="$PAR_NO"/>
1146 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1147 <xsl:if test="not(*[3])">
1149 <!-- HELM: added -->
1150 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1151 <xsl:attribute name="xref">
1152 <xsl:value-of select="m:minus/@id"/>
1155 <xsl:apply-templates select="*[2]" mode = "semantics">
1156 <xsl:with-param name="IN_PREC" select="$NEG_PREC"/>
1157 <xsl:with-param name="PAREN" select="$PAREN"/>
1158 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1159 </xsl:apply-templates>
1161 <xsl:if test="*[3]">
1162 <xsl:apply-templates select="*[2]" mode = "semantics">
1163 <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
1164 <xsl:with-param name="PARAM" select="$PARAM"/>
1165 <xsl:with-param name="PAREN" select="$PAREN"/>
1166 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1167 </xsl:apply-templates>
1169 <!-- HELM: added -->
1170 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1171 <xsl:attribute name="xref">
1172 <xsl:value-of select="m:minus/@id"/>
1175 <xsl:apply-templates select="*[3]" mode = "semantics">
1176 <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
1177 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
1178 <xsl:with-param name="PAREN" select="$PAREN"/>
1179 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1180 </xsl:apply-templates>
1184 <xsl:template match = "m:apply[m:plus[1]]">
1185 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1186 <xsl:param name="PARAM" select="$NO_PARAM"/>
1187 <xsl:param name="PAREN" select="$PAR_NO"/>
1188 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1190 <xsl:when test="$IN_PREC > $PLUS_PREC or $IN_PREC=$PLUS_PREC and
1192 <m:mfenced separators="">
1193 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1194 <xsl:attribute name="xref">
1195 <xsl:value-of select="@id"/>
1198 <xsl:apply-templates select="." mode="plus">
1199 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1200 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1201 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1202 </xsl:apply-templates>
1205 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1206 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1207 and not($SEM_SW=$SEM_XREF_EXT)">
1208 <xsl:apply-templates select="." mode="plus">
1209 <xsl:with-param name="PARAM" select="$PARAM"/>
1210 <xsl:with-param name="PAREN" select="$PAREN"/>
1211 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1212 </xsl:apply-templates>
1216 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1217 <xsl:attribute name="xref">
1218 <xsl:value-of select="@id"/>
1221 <xsl:apply-templates select="." mode="plus">
1222 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1223 <xsl:with-param name="PAREN" select="$PAREN"/>
1224 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1225 </xsl:apply-templates>
1231 <xsl:template match = "m:apply[m:plus[1]]" mode="plus">
1232 <xsl:param name="PARAM" select="$NO_PARAM"/>
1233 <xsl:param name="PAREN" select="$PAR_NO"/>
1234 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1235 <xsl:if test="*[2]">
1236 <xsl:apply-templates select="*[2]" mode = "semantics">
1237 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
1238 <xsl:with-param name="PARAM" select="$PARAM"/>
1239 <xsl:with-param name="PAREN" select="$PAREN"/>
1240 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1241 </xsl:apply-templates>
1242 <xsl:for-each select = "*[position()>2]">
1244 <xsl:when test=". < 0">
1246 <m:mn> <xsl:value-of select="-."/> </m:mn>
1248 <xsl:when test="self::m:apply[m:minus[1]] and not(*[3])">
1249 <xsl:apply-templates select="." mode = "semantics">
1250 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
1251 <xsl:with-param name="PAREN" select="$PAREN"/>
1252 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1253 </xsl:apply-templates>
1257 <!-- HELM: added -->
1258 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1259 <xsl:attribute name="xref">
1260 <xsl:value-of select="../m:plus/@id"/>
1263 <xsl:apply-templates select="." mode = "semantics">
1264 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
1265 <xsl:with-param name="PAREN" select="$PAREN"/>
1266 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1267 </xsl:apply-templates>
1274 <xsl:template match = "m:apply[m:power[1]]">
1276 <xsl:when test="*[2]=m:apply[m:ln[1] | m:log[1] | m:abs[1] |
1277 m:gcd[1] | m:sin[1] | m:cos[1] | m:tan[1] |
1278 m:sec[1] | m:csc[1] | m:cot[1] | m:sinh[1] |
1279 m:cosh[1] | m:tanh[1] | m:sech[1] | m:csch[1] |
1280 m:coth[1] | m:arcsin[1] | m:arccos[1] |
1282 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1286 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1287 <xsl:attribute name="xref">
1288 <xsl:value-of select="@id"/>
1291 <xsl:apply-templates select = "*[2]" mode = "semantics">
1292 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1293 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1294 </xsl:apply-templates>
1295 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1301 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]">
1302 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1303 <xsl:param name="PARAM" select="$NO_PARAM"/>
1304 <xsl:param name="PAREN" select="$PAR_NO"/>
1305 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1307 <xsl:when test="$IN_PREC > $DIV_PREC or $IN_PREC=$DIV_PREC and
1309 <m:mfenced separators="">
1310 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1311 <xsl:attribute name="xref">
1312 <xsl:value-of select="@id"/>
1315 <xsl:apply-templates select="." mode="remdiv">
1316 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1317 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1318 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1319 </xsl:apply-templates>
1322 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1323 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1324 and not($SEM_SW=$SEM_XREF_EXT)">
1325 <xsl:apply-templates select="." mode="remdiv">
1326 <xsl:with-param name="PARAM" select="$PARAM"/>
1327 <xsl:with-param name="PAREN" select="$PAREN"/>
1328 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1329 </xsl:apply-templates>
1333 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1334 <xsl:attribute name="xref">
1335 <xsl:value-of select="@id"/>
1338 <xsl:apply-templates select="." mode="remdiv">
1339 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1340 <xsl:with-param name="PAREN" select="$PAREN"/>
1341 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1342 </xsl:apply-templates>
1348 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]" mode="remdiv">
1349 <xsl:param name="PARAM" select="$NO_PARAM"/>
1350 <xsl:param name="PAREN" select="$PAR_NO"/>
1351 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1352 <xsl:apply-templates select = "*[2]" mode = "semantics">
1353 <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
1354 <xsl:with-param name="PARAM" select="$PARAM"/>
1355 <xsl:with-param name="PAREN" select="$PAREN"/>
1356 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1357 </xsl:apply-templates>
1359 <xsl:if test="m:rem">
1360 <!-- HELM: added -->
1361 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1362 <xsl:attribute name="xref">
1363 <xsl:value-of select="m:rem/@id"/>
1366 <xsl:value-of select="'%'"/>
1368 <xsl:if test="m:divide">
1369 <!-- HELM: added -->
1370 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1371 <xsl:attribute name="xref">
1372 <xsl:value-of select="m:divide/@id"/>
1375 <xsl:value-of select="'/'"/>
1378 <xsl:apply-templates select = "*[3]" mode = "semantics">
1379 <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
1380 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
1381 <xsl:with-param name="PAREN" select="$PAREN"/>
1382 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1383 </xsl:apply-templates>
1386 <xsl:template match = "m:apply[m:times[1]]">
1387 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1388 <xsl:param name="PARAM" select="$NO_PARAM"/>
1389 <xsl:param name="PAREN" select="$PAR_NO"/>
1390 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1392 <xsl:when test="$IN_PREC > $MUL_PREC or $IN_PREC=$MUL_PREC and
1394 <m:mfenced separators="">
1395 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1396 <xsl:attribute name="xref">
1397 <xsl:value-of select="@id"/>
1400 <xsl:apply-templates select="." mode="times">
1401 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1402 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1403 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1404 </xsl:apply-templates>
1407 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1408 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1409 and not($SEM_SW=$SEM_XREF_EXT)">
1410 <xsl:apply-templates select="." mode="times">
1411 <xsl:with-param name="PARAM" select="$PARAM"/>
1412 <xsl:with-param name="PAREN" select="$PAREN"/>
1413 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1414 </xsl:apply-templates>
1418 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1419 <xsl:attribute name="xref">
1420 <xsl:value-of select="@id"/>
1423 <xsl:apply-templates select="." mode="times">
1424 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1425 <xsl:with-param name="PAREN" select="$PAREN"/>
1426 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1427 </xsl:apply-templates>
1433 <xsl:template match = "m:apply[m:times[1]]" mode="times">
1434 <xsl:param name="PARAM" select="$NO_PARAM"/>
1435 <xsl:param name="PAREN" select="$PAR_NO"/>
1436 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1437 <xsl:apply-templates select="*[2]" mode = "semantics">
1438 <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
1439 <xsl:with-param name="PARAM" select="$PARAM"/>
1440 <xsl:with-param name="PAREN" select="$PAREN"/>
1441 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1442 </xsl:apply-templates>
1443 <xsl:if test="*[3]">
1444 <xsl:for-each select = "*[position()>2]">
1445 <!-- HELM: to distinguish between * and the application -->
1446 <!-- <m:mo>⁢</m:mo> -->
1448 <!-- HELM: added -->
1449 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1450 <xsl:attribute name="xref">
1451 <xsl:value-of select="../m:times/@id"/>
1454 <xsl:apply-templates select="." mode = "semantics">
1455 <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
1456 <xsl:with-param name="PAREN" select="$PAREN"/>
1457 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1458 </xsl:apply-templates>
1463 <xsl:template match = "m:apply[m:root[1]]">
1465 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1466 <xsl:attribute name="xref">
1467 <xsl:value-of select="@id"/>
1470 <xsl:if test="*[2]=m:degree">
1471 <xsl:apply-templates select="*[3]" mode = "semantics">
1472 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1473 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1474 </xsl:apply-templates>
1475 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1477 <xsl:if test="not(*[2]=m:degree)">
1478 <xsl:apply-templates select="*[2]" mode = "semantics">
1479 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1480 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1481 </xsl:apply-templates>
1487 <xsl:template match = "m:apply[m:gcd[1]]">
1489 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1490 <xsl:attribute name="xref">
1491 <xsl:value-of select="@id"/>
1494 <xsl:if test="not(parent::m:apply[m:power[1]])">
1496 <!-- HELM: added -->
1497 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1498 <xsl:attribute name="xref">
1499 <xsl:value-of select="m:gcd/@id"/>
1503 <xsl:if test="parent::m:apply[m:power[1]]">
1506 <!-- HELM: added -->
1507 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1508 <xsl:attribute name="xref">
1509 <xsl:value-of select="m:gcd/@id"/>
1512 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1515 <m:mfenced separators=",">
1516 <xsl:for-each select = "*[position()>1]">
1517 <xsl:apply-templates select = "." mode="semantics"/>
1523 <xsl:template match = "m:apply[m:and[1]]">
1524 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1525 <xsl:param name="PAREN" select="$PAR_NO"/>
1526 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1528 <xsl:when test="$IN_PREC > $AND_PREC">
1529 <m:mfenced separators="">
1530 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1531 <xsl:attribute name="xref">
1532 <xsl:value-of select="@id"/>
1535 <xsl:apply-templates select="." mode="and">
1536 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1537 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1538 </xsl:apply-templates>
1541 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1542 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1543 and not($SEM_SW=$SEM_XREF_EXT)">
1544 <xsl:apply-templates select="." mode="and">
1545 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1546 <xsl:with-param name="PAREN" select="$PAREN"/>
1547 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1548 </xsl:apply-templates>
1552 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1553 <xsl:attribute name="xref">
1554 <xsl:value-of select="@id"/>
1557 <xsl:apply-templates select="." mode="and">
1558 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1559 <xsl:with-param name="PAREN" select="$PAREN"/>
1560 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1561 </xsl:apply-templates>
1567 <xsl:template match = "m:apply[m:and[1]]" mode="and">
1568 <xsl:param name="PARAM" select="$NO_PARAM"/>
1569 <xsl:param name="PAREN" select="$PAR_NO"/>
1570 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1571 <xsl:apply-templates select="*[2]" mode = "semantics">
1572 <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
1573 <xsl:with-param name="PARAM" select="$PARAM"/>
1574 <xsl:with-param name="PAREN" select="$PAREN"/>
1575 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1576 </xsl:apply-templates>
1577 <xsl:for-each select = "*[position()>2]">
1579 <!-- HELM: added -->
1580 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1581 <xsl:attribute name="xref">
1582 <xsl:value-of select="../m:and/@id"/>
1584 </xsl:if>∧</m:mo>
1585 <xsl:apply-templates select="." mode = "semantics">
1586 <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
1587 <xsl:with-param name="PAREN" select="$PAREN"/>
1588 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1589 </xsl:apply-templates>
1593 <xsl:template match = "m:apply[m:or[1]]">
1594 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1595 <xsl:param name="PAREN" select="$PAR_NO"/>
1596 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1598 <xsl:when test="$IN_PREC > $OR_PREC">
1599 <m:mfenced separators="">
1600 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1601 <xsl:attribute name="xref">
1602 <xsl:value-of select="@id"/>
1605 <xsl:apply-templates select="." mode="or">
1606 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1607 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1608 </xsl:apply-templates>
1611 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1612 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1613 and not($SEM_SW=$SEM_XREF_EXT)">
1614 <xsl:apply-templates select="." mode="or">
1615 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1616 <xsl:with-param name="PAREN" select="$PAREN"/>
1617 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1618 </xsl:apply-templates>
1622 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1623 <xsl:attribute name="xref">
1624 <xsl:value-of select="@id"/>
1627 <xsl:apply-templates select="." mode="or">
1628 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1629 <xsl:with-param name="PAREN" select="$PAREN"/>
1630 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1631 </xsl:apply-templates>
1637 <xsl:template match = "m:apply[m:or[1]]" mode="or">
1638 <xsl:param name="PARAM" select="$NO_PARAM"/>
1639 <xsl:param name="PAREN" select="$PAR_NO"/>
1640 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1641 <xsl:apply-templates select="*[2]" mode = "semantics">
1642 <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1643 <xsl:with-param name="PARAM" select="$PARAM"/>
1644 <xsl:with-param name="PAREN" select="$PAREN"/>
1645 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1646 </xsl:apply-templates>
1647 <xsl:for-each select = "*[position()>2]">
1649 <!-- HELM: added -->
1650 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1651 <xsl:attribute name="xref">
1652 <xsl:value-of select="../m:or/@id"/>
1654 </xsl:if>∨</m:mo>
1655 <xsl:apply-templates select="." mode = "semantics">
1656 <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1657 <xsl:with-param name="PAREN" select="$PAREN"/>
1658 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1659 </xsl:apply-templates>
1663 <xsl:template match = "m:apply[m:xor[1]]">
1664 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1665 <xsl:param name="PAREN" select="$PAR_NO"/>
1666 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1668 <xsl:when test="$IN_PREC > $XOR_PREC">
1669 <m:mfenced separators="">
1670 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1671 <xsl:attribute name="xref">
1672 <xsl:value-of select="@id"/>
1675 <xsl:apply-templates select="." mode="xor">
1676 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1677 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1678 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1679 </xsl:apply-templates>
1682 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1683 and not($SEM_SW=$SEM_ALL)">
1684 <xsl:apply-templates select="." mode="xor">
1685 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1686 <xsl:with-param name="PAREN" select="$PAREN"/>
1687 </xsl:apply-templates>
1691 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1692 <xsl:attribute name="xref">
1693 <xsl:value-of select="@id"/>
1696 <xsl:apply-templates select="." mode="xor">
1697 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1698 <xsl:with-param name="PAREN" select="$PAREN"/>
1699 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1700 </xsl:apply-templates>
1706 <xsl:template match = "m:apply[m:xor[1]]" mode="xor">
1707 <xsl:param name="PARAM" select="$NO_PARAM"/>
1708 <xsl:param name="PAREN" select="$PAR_NO"/>
1709 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1710 <xsl:apply-templates select="*[2]" mode = "semantics">
1711 <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1712 <xsl:with-param name="PARAM" select="$PARAM"/>
1713 <xsl:with-param name="PAREN" select="$PAREN"/>
1714 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1715 </xsl:apply-templates>
1716 <xsl:for-each select = "*[position()>2]">
1718 <!-- HELM: added -->
1719 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1720 <xsl:attribute name="xref">
1721 <xsl:value-of select="../m:xor/@id"/>
1723 </xsl:if>⊻</m:mo>
1724 <xsl:apply-templates select="." mode = "semantics">
1725 <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1726 <xsl:with-param name="PAREN" select="$PAREN"/>
1727 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1728 </xsl:apply-templates>
1732 <xsl:template match = "m:apply[m:not[1]]">
1734 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1735 <xsl:attribute name="xref">
1736 <xsl:value-of select="@id"/>
1739 <!-- HELM: was <m:mo>not</m:mo> -->
1741 <!-- HELM: added -->
1742 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1743 <xsl:attribute name="xref">
1744 <xsl:value-of select="m:not/@id"/>
1746 </xsl:if>¬</m:mo>
1747 <xsl:apply-templates select = "*[2]" mode = "semantics">
1748 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1749 </xsl:apply-templates>
1753 <xsl:template match = "m:apply[m:forall[1]]">
1755 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1756 <xsl:attribute name="xref">
1757 <xsl:value-of select="@id"/>
1761 <!-- HELM: added -->
1762 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1763 <xsl:attribute name="xref">
1764 <xsl:value-of select="m:forall/@id"/>
1766 </xsl:if>for all</m:mo>
1767 <xsl:if test="count(m:bvar) > 1">
1768 <m:mfenced separators=",">
1769 <xsl:for-each select = "m:bvar">
1770 <xsl:apply-templates select = "." mode="semantics"/>
1774 <xsl:if test="count(m:bvar)=1">
1775 <xsl:apply-templates select = "m:bvar" mode="semantics"/>
1777 <xsl:if test="m:condition">
1779 <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1782 <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and
1783 not(self::m:condition)]" mode = "semantics"/>
1787 <xsl:template match = "m:apply[m:exists[1]]">
1789 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1790 <xsl:attribute name="xref">
1791 <xsl:value-of select="@id"/>
1795 <!-- HELM: added -->
1796 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1797 <xsl:attribute name="xref">
1798 <xsl:value-of select="m:exists/@id"/>
1800 </xsl:if>∃</m:mo>
1801 <xsl:if test="count(m:bvar) > 1">
1802 <m:mfenced separators=",">
1803 <xsl:for-each select = "m:bvar">
1804 <xsl:apply-templates select = "." mode="semantics"/>
1808 <xsl:if test="count(m:bvar)=1">
1809 <xsl:apply-templates select = "m:bvar" mode="semantics"/>
1811 <xsl:if test="m:condition">
1813 <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1815 <xsl:if test="*[position()>1 and not(self::m:bvar) and not(self::m:condition)]">
1817 <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and
1818 not(self::m:condition)]" mode = "semantics"/>
1823 <xsl:template match = "m:apply[m:abs[1]]">
1824 <xsl:if test="not(parent::m:apply[m:power[1]])">
1825 <m:mfenced open="|" close="|" separators="">
1826 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1827 <xsl:attribute name="xref">
1828 <xsl:value-of select="@id"/>
1831 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1834 <xsl:if test="parent::m:apply[m:power[1]]">
1836 <m:mfenced open="|" close="|" separators="">
1837 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1838 <xsl:attribute name="xref">
1839 <xsl:value-of select="@id"/>
1842 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1844 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1849 <xsl:template match = "m:apply[m:conjugate[1]]">
1851 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1852 <xsl:attribute name="xref">
1853 <xsl:value-of select="@id"/>
1857 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1860 <!-- HELM: added -->
1861 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1862 <xsl:attribute name="xref">
1863 <xsl:value-of select="m:conjugate/@id"/>
1865 </xsl:if>̲</m:mo>
1869 <xsl:template match = "m:apply[m:arg[1] | m:real[1] | m:imaginary[1]]">
1871 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1872 <xsl:attribute name="xref">
1873 <xsl:value-of select="@id"/>
1877 <xsl:if test="m:arg">
1878 <!-- HELM: added -->
1879 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1880 <xsl:attribute name="xref">
1881 <xsl:value-of select="m:arg/@id"/>
1884 <xsl:value-of select="'Arg'"/>
1886 <xsl:if test="m:real">
1887 <!-- HELM: added -->
1888 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1889 <xsl:attribute name="xref">
1890 <xsl:value-of select="m:real/@id"/>
1893 <xsl:value-of select="'Re'"/>
1895 <xsl:if test="m:imaginary">
1896 <!-- HELM: added -->
1897 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1898 <xsl:attribute name="xref">
1899 <xsl:value-of select="m:imaginary/@id"/>
1902 <xsl:value-of select="'Im'"/>
1905 <m:mfenced separators="">
1906 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1912 <!-- ***************** RELATIONS ***************** -->
1914 <xsl:template match = "m:apply[m:neq | m:approx | m:tendsto | m:implies
1915 | m:in | m:notin | m:notsubset | m:notprsubset
1916 | m:subset | m:prsubset | m:eq | m:gt | m:lt
1917 | m:geq | m:leq | m:equivalent]">
1919 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1920 <xsl:attribute name="xref">
1921 <xsl:value-of select="@id"/>
1924 <xsl:if test="*[1]=m:neq or *[1]=m:approx or *[1]=m:tendsto or
1925 *[1]=m:implies or *[1]=m:in or *[1]=m:notin or
1926 *[1]=m:notsubset or *[1]=m:notprsubset">
1927 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1929 <xsl:if test="*[1]=m:neq">
1930 <!-- HELM: added -->
1931 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1932 <xsl:attribute name="xref">
1933 <xsl:value-of select="m:neq/@id"/>
1938 <xsl:if test="*[1]=m:approx">
1939 <!-- HELM: added -->
1940 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1941 <xsl:attribute name="xref">
1942 <xsl:value-of select="m:approx/@id"/>
1947 <xsl:if test="*[1]=m:tendsto">
1948 <!-- HELM: added -->
1949 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1950 <xsl:attribute name="xref">
1951 <xsl:value-of select="m:tendsto/@id"/>
1956 <xsl:if test="*[1]=m:implies">
1957 <!-- HELM: added -->
1958 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1959 <xsl:attribute name="xref">
1960 <xsl:value-of select="m:implies/@id"/>
1965 <xsl:if test="*[1]=m:in">
1966 <!-- HELM: added -->
1967 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1968 <xsl:attribute name="xref">
1969 <xsl:value-of select="m:in/@id"/>
1974 <xsl:if test="*[1]=m:notin">
1975 <!-- HELM: added -->
1976 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1977 <xsl:attribute name="xref">
1978 <xsl:value-of select="m:notin/@id"/>
1983 <xsl:if test="*[1]=m:notsubset">
1984 <!-- HELM: added -->
1985 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1986 <xsl:attribute name="xref">
1987 <xsl:value-of select="m:notsubset/@id"/>
1992 <xsl:if test="*[1]=m:notprsubset">
1993 <!-- HELM: added -->
1994 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1995 <xsl:attribute name="xref">
1996 <xsl:value-of select="m:notprsubset/@id"/>
2002 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
2003 <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='below']">
2005 <!-- HELM: added -->
2006 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2007 <xsl:attribute name="xref">
2008 <xsl:value-of select="m:tendsto/@id"/>
2012 <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='above']">
2014 <!-- HELM: added -->
2015 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2016 <xsl:attribute name="xref">
2017 <xsl:value-of select="m:tendsto/@id"/>
2022 <xsl:if test="*[1]=m:subset or *[1]=m:prsubset or *[1]=m:eq or *[1]=m:gt
2023 or *[1]=m:lt or *[1]=m:geq or *[1]=m:leq or *[1]=m:equivalent">
2024 <xsl:apply-templates select = "*[2]" mode="semantics"/>
2025 <xsl:for-each select = "*[position()>2]">
2027 <xsl:if test="../*[self::m:subset][1]">
2028 <!-- HELM: added -->
2029 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2030 <xsl:attribute name="xref">
2031 <xsl:value-of select="../m:subset/@id"/>
2036 <xsl:if test="../*[self::m:prsubset][1]">
2037 <!-- HELM: added -->
2038 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2039 <xsl:attribute name="xref">
2040 <xsl:value-of select="../m:prsubset/@id"/>
2045 <xsl:if test="../*[self::m:eq][1]">
2046 <!-- HELM: added -->
2047 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2048 <xsl:attribute name="xref">
2049 <xsl:value-of select="../m:eq/@id"/>
2052 <xsl:value-of select="'='"/>
2054 <xsl:if test="../*[self::m:gt][1]">
2055 <!-- HELM: added -->
2056 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2057 <xsl:attribute name="xref">
2058 <xsl:value-of select="../m:gt/@id"/>
2061 <xsl:value-of select="'>'"/>
2063 <xsl:if test="../*[self::m:lt][1]">
2064 <!-- HELM: added -->
2065 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2066 <xsl:attribute name="xref">
2067 <xsl:value-of select="../m:lt/@id"/>
2070 <xsl:value-of select="'<'"/>
2072 <xsl:if test="../*[self::m:geq][1]">
2073 <!-- HELM: added -->
2074 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2075 <xsl:attribute name="xref">
2076 <xsl:value-of select="../m:geq/@id"/>
2081 <xsl:if test="../*[self::m:leq][1]">
2082 <!-- HELM: added -->
2083 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2084 <xsl:attribute name="xref">
2085 <xsl:value-of select="../m:leq/@id"/>
2090 <xsl:if test="../*[self::m:equivalent][1]">
2091 <!-- HELM: added -->
2092 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2093 <xsl:attribute name="xref">
2094 <xsl:value-of select="../m:equivalent/@id"/>
2100 <xsl:apply-templates select = "." mode="semantics"/>
2107 <!-- ***************** CALCULUS ***************** -->
2109 <xsl:template match = "m:apply[*[1][self::m:ln]]">
2111 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2112 <xsl:attribute name="xref">
2113 <xsl:value-of select="@id"/>
2117 <xsl:when test="parent::m:apply[m:power[1]]">
2120 <!-- HELM: added -->
2121 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2122 <xsl:attribute name="xref">
2123 <xsl:value-of select="m:ln/@id"/>
2126 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
2131 <!-- HELM: added -->
2132 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2133 <xsl:attribute name="xref">
2134 <xsl:value-of select="m:ln/@id"/>
2139 <m:mo>⁡</m:mo>
2140 <xsl:apply-templates select = "*[2]" mode = "semantics">
2141 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
2142 </xsl:apply-templates>
2146 <xsl:template match = "m:apply[m:log[1]]">
2148 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2149 <xsl:attribute name="xref">
2150 <xsl:value-of select="@id"/>
2154 <xsl:when test="parent::m:apply[m:power[1]]">
2155 <xsl:if test="not(*[2]=m:logbase)">
2158 <!-- HELM: added -->
2159 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2160 <xsl:attribute name="xref">
2161 <xsl:value-of select="m:log/@id"/>
2164 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
2167 <xsl:if test="*[2]=m:logbase">
2170 <!-- HELM: added -->
2171 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2172 <xsl:attribute name="xref">
2173 <xsl:value-of select="m:log/@id"/>
2176 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
2177 <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
2182 <xsl:if test="not(*[2]=m:logbase)">
2185 <xsl:if test="*[2]=m:logbase">
2188 <!-- HELM: added -->
2189 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2190 <xsl:attribute name="xref">
2191 <xsl:value-of select="m:log/@id"/>
2194 <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
2199 <m:mo>⁡</m:mo>
2200 <xsl:if test="*[2]=m:logbase">
2201 <xsl:apply-templates select = "*[3]" mode = "semantics">
2202 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
2203 </xsl:apply-templates>
2205 <xsl:if test="not(*[2]=m:logbase)">
2206 <xsl:apply-templates select = "*[2]" mode = "semantics">
2207 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
2208 </xsl:apply-templates>
2213 <xsl:template match = "m:apply[m:diff[1]]">
2215 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2216 <xsl:attribute name="xref">
2217 <xsl:value-of select="@id"/>
2220 <xsl:if test="*[2]=m:bvar and m:bvar[*[2]=m:degree]">
2222 <!-- HELM: added -->
2223 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2224 <xsl:attribute name="xref">
2225 <xsl:value-of select="m:diff/@id"/>
2230 <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
2235 <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
2236 <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
2241 <xsl:if test="*[2]=m:bvar and not(m:bvar[*[2]=m:degree])">
2243 <!-- HELM: added -->
2244 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2245 <xsl:attribute name="xref">
2246 <xsl:value-of select="m:diff/@id"/>
2252 <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
2256 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
2260 <xsl:template match = "m:apply[m:partialdiff[1]]">
2262 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2263 <xsl:attribute name="xref">
2264 <xsl:value-of select="@id"/>
2267 <xsl:for-each select = "m:bvar">
2268 <xsl:if test="*[last()]=m:degree">
2270 <!-- HELM: added -->
2271 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2272 <xsl:attribute name="xref">
2273 <xsl:value-of select="m:partialdiff/@id"/>
2278 <xsl:apply-templates select = "m:degree" mode = "semantics"/>
2283 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
2284 <xsl:apply-templates select = "m:degree" mode = "semantics"/>
2289 <xsl:if test="not(*[last()]=m:degree)">
2291 <!-- HELM: added -->
2292 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2293 <xsl:attribute name="xref">
2294 <xsl:value-of select="m:partialdiff/@id"/>
2300 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
2305 <xsl:apply-templates select = "*[last()]" mode = "semantics"/>
2309 <xsl:template match = "m:lowlimit | m:uplimit | m:bvar | m:degree |
2311 <xsl:apply-templates select="*" mode = "semantics"/>
2314 <xsl:template match = "m:apply[m:divergence[1] | m:grad[1] | m:curl[1]]">
2316 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2317 <xsl:attribute name="xref">
2318 <xsl:value-of select="@id"/>
2322 <xsl:if test="*[1]=m:divergence">
2323 <!-- HELM: added -->
2324 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2325 <xsl:attribute name="xref">
2326 <xsl:value-of select="m:divergence/@id"/>
2329 <xsl:value-of select="'div'"/>
2331 <xsl:if test="*[1]=m:grad">
2332 <!-- HELM: added -->
2333 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2334 <xsl:attribute name="xref">
2335 <xsl:value-of select="m:grad/@id"/>
2338 <xsl:value-of select="'grad'"/>
2340 <xsl:if test="*[1]=m:curl">
2341 <!-- HELM: added -->
2342 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2343 <xsl:attribute name="xref">
2344 <xsl:value-of select="m:curl/@id"/>
2347 <xsl:value-of select="'curl'"/>
2351 <xsl:when test="*[2]=m:ci">
2352 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2355 <m:mfenced separators="">
2356 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2363 <xsl:template match = "m:apply[m:laplacian[1]]">
2365 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2366 <xsl:attribute name="xref">
2367 <xsl:value-of select="@id"/>
2371 <!-- HELM: added -->
2372 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2373 <xsl:attribute name="xref">
2374 <xsl:value-of select="m:laplacian/@id"/>
2377 <m:mo>Δ</m:mo>
2380 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2385 <!-- ***************** SET THEORY ***************** -->
2387 <xsl:template match = "m:set | m:list">
2388 <m:mfenced open="{{" close="}}" separators="">
2389 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2390 <xsl:attribute name="xref">
2391 <xsl:value-of select="@id"/>
2394 <xsl:if test="*[1]=m:bvar and *[2]=m:condition">
2395 <xsl:apply-templates select="m:bvar" mode = "semantics"/>
2397 <xsl:apply-templates select="m:condition" mode = "semantics"/>
2399 <xsl:if test="*[1]=m:condition and not(child::m:bvar)">
2400 <m:mfenced open="" close="" separators=",">
2401 <xsl:for-each select = "*[not(self::m:condition) and not(self::m:bvar)]">
2402 <xsl:apply-templates select = "." mode="semantics"/>
2406 <xsl:apply-templates select="m:condition" mode = "semantics"/>
2408 <xsl:if test="not(child::m:bvar) and not(child::m:condition)">
2409 <m:mfenced open="" close="" separators=",">
2410 <xsl:for-each select = "*">
2411 <xsl:apply-templates select = "." mode="semantics"/>
2418 <xsl:template match = "m:apply[m:union[1]]">
2419 <xsl:param name="IN_PREC" select="$NO_PREC"/>
2420 <xsl:param name="PARAM" select="$NO_PARAM"/>
2421 <xsl:param name="PAREN" select="$PAR_NO"/>
2422 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2424 <xsl:when test="$IN_PREC > $UNION_PREC or $IN_PREC=$UNION_PREC
2425 and $PARAM=$PAR_SAME">
2426 <m:mfenced separators="">
2427 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2428 <xsl:attribute name="xref">
2429 <xsl:value-of select="@id"/>
2432 <xsl:apply-templates select="." mode="union">
2433 <xsl:with-param name="PARAM" select="$PARAM"/>
2434 <xsl:with-param name="PAREN" select="$PAREN"/>
2435 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2436 </xsl:apply-templates>
2439 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
2440 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
2441 and not($SEM_SW=$SEM_XREF_EXT)">
2442 <xsl:apply-templates select="." mode="union">
2443 <xsl:with-param name="PARAM" select="$PARAM"/>
2444 <xsl:with-param name="PAREN" select="$PAREN"/>
2445 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2446 </xsl:apply-templates>
2450 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2451 <xsl:attribute name="xref">
2452 <xsl:value-of select="@id"/>
2455 <xsl:apply-templates select="." mode="union">
2456 <xsl:with-param name="PARAM" select="$PARAM"/>
2457 <xsl:with-param name="PAREN" select="$PAREN"/>
2458 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2459 </xsl:apply-templates>
2465 <xsl:template match = "m:apply[m:union[1]]" mode="union">
2466 <xsl:param name="PARAM" select="$NO_PARAM"/>
2467 <xsl:param name="PAREN" select="$PAR_NO"/>
2468 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2469 <xsl:apply-templates select = "*[2]" mode="semantics">
2470 <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
2471 <xsl:with-param name="PARAM" select="$PARAM"/>
2472 <xsl:with-param name="PAREN" select="$PAREN"/>
2473 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2474 </xsl:apply-templates>
2475 <xsl:for-each select = "*[position()>2]">
2477 <!-- HELM: added -->
2478 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2479 <xsl:attribute name="xref">
2480 <xsl:value-of select="../m:union/@id"/>
2482 </xsl:if>⋃</m:mo>
2483 <xsl:apply-templates select = "." mode="semantics">
2484 <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
2485 <xsl:with-param name="PAREN" select="$PAREN"/>
2486 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
2487 </xsl:apply-templates>
2491 <xsl:template match = "m:apply[m:intersect[1]]">
2492 <xsl:param name="IN_PREC" select="$NO_PREC"/>
2493 <xsl:param name="PARAM" select="$NO_PARAM"/>
2494 <xsl:param name="PAREN" select="$PAR_NO"/>
2495 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2497 <xsl:when test="$IN_PREC > $INTERSECT_PREC">
2498 <m:mfenced separators="">
2499 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2500 <xsl:attribute name="xref">
2501 <xsl:value-of select="@id"/>
2504 <xsl:apply-templates select="." mode="intersect">
2505 <xsl:with-param name="PARAM" select="$PARAM"/>
2506 <xsl:with-param name="PAREN" select="$PAREN"/>
2507 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2508 </xsl:apply-templates>
2511 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
2512 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
2513 and not($SEM_SW=$SEM_XREF_EXT)">
2514 <xsl:apply-templates select="." mode="intersect">
2515 <xsl:with-param name="PARAM" select="$PARAM"/>
2516 <xsl:with-param name="PAREN" select="$PAREN"/>
2517 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2518 </xsl:apply-templates>
2522 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2523 <xsl:attribute name="xref">
2524 <xsl:value-of select="@id"/>
2527 <xsl:apply-templates select="." mode="intersect">
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>
2537 <xsl:template match = "m:apply[m:intersect[1]]" mode="intersect">
2538 <xsl:param name="PARAM" select="$NO_PARAM"/>
2539 <xsl:param name="PAREN" select="$PAR_NO"/>
2540 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2541 <xsl:apply-templates select = "*[2]" mode="semantics">
2542 <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
2543 <xsl:with-param name="PARAM" select="$PARAM"/>
2544 <xsl:with-param name="PAREN" select="$PAREN"/>
2545 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2546 </xsl:apply-templates>
2547 <xsl:for-each select = "*[position()>2]">
2549 <!-- HELM: added -->
2550 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2551 <xsl:attribute name="xref">
2552 <xsl:value-of select="../m:intersect/@id"/>
2554 </xsl:if>⋂</m:mo>
2555 <xsl:apply-templates select = "." mode="semantics">
2556 <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
2557 <xsl:with-param name="PAREN" select="$PAREN"/>
2558 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
2559 </xsl:apply-templates>
2563 <xsl:template match = "m:apply[m:setdiff[1]]">
2564 <xsl:param name="IN_PREC" select="$NO_PREC"/>
2565 <xsl:param name="PARAM" select="$NO_PARAM"/>
2566 <xsl:param name="PAREN" select="$PAR_NO"/>
2567 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2569 <xsl:when test="$IN_PREC > $SETDIFF_PREC or $IN_PREC=$SETDIFF_PREC
2570 and $PARAM=$PAR_SAME">
2571 <m:mfenced separators="">
2572 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2573 <xsl:attribute name="xref">
2574 <xsl:value-of select="@id"/>
2577 <xsl:apply-templates select="." mode="setdiff">
2578 <xsl:with-param name="PARAM" select="$PARAM"/>
2579 <xsl:with-param name="PAREN" select="$PAREN"/>
2580 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2581 </xsl:apply-templates>
2584 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
2585 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
2586 and not($SEM_SW=$SEM_XREF_EXT)">
2587 <xsl:apply-templates select="." mode="setdiff">
2588 <xsl:with-param name="PARAM" select="$PARAM"/>
2589 <xsl:with-param name="PAREN" select="$PAREN"/>
2590 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2591 </xsl:apply-templates>
2595 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2596 <xsl:attribute name="xref">
2597 <xsl:value-of select="@id"/>
2600 <xsl:apply-templates select="." mode="setdiff">
2601 <xsl:with-param name="PARAM" select="$PARAM"/>
2602 <xsl:with-param name="PAREN" select="$PAREN"/>
2603 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2604 </xsl:apply-templates>
2610 <xsl:template match = "m:apply[m:setdiff[1]]" mode="setdiff">
2611 <xsl:param name="PARAM" select="$NO_PARAM"/>
2612 <xsl:param name="PAREN" select="$PAR_NO"/>
2613 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2614 <xsl:apply-templates select = "*[2]" mode = "semantics">
2615 <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
2616 <xsl:with-param name="PARAM" select="$PARAM"/>
2617 <xsl:with-param name="PAREN" select="$PAREN"/>
2618 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2619 </xsl:apply-templates>
2621 <!-- HELM: added -->
2622 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2623 <xsl:attribute name="xref">
2624 <xsl:value-of select="m:setdiff/@id"/>
2627 <xsl:apply-templates select = "*[3]" mode = "semantics">
2628 <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
2629 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
2630 <xsl:with-param name="PAREN" select="$PAREN"/>
2631 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
2632 </xsl:apply-templates>
2635 <xsl:template match = "m:apply[m:card[1]]">
2636 <m:mfenced open="|" close="|" separators=",">
2637 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2638 <xsl:attribute name="xref">
2639 <xsl:value-of select="@id"/>
2642 <xsl:for-each select = "*[position()>1]">
2643 <xsl:apply-templates select = "." mode="semantics"/>
2649 <!-- ***************** SEQUENCES AND SERIES ***************** -->
2651 <xsl:template match = "m:apply[m:sum[1] | m:product[1]]">
2653 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2654 <xsl:attribute name="xref">
2655 <xsl:value-of select="@id"/>
2659 <xsl:when test="*[2]=m:bvar and m:lowlimit and m:uplimit">
2662 <xsl:if test="*[1]=m:sum">
2663 <!-- HELM: added -->
2664 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2665 <xsl:attribute name="xref">
2666 <xsl:value-of select="m:sum/@id"/>
2671 <xsl:if test="*[1]=m:product">
2672 <!-- HELM: added -->
2673 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2674 <xsl:attribute name="xref">
2675 <xsl:value-of select="m:product/@id"/>
2682 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2684 <xsl:apply-templates select = "m:lowlimit" mode = "semantics"/>
2686 <xsl:apply-templates select = "m:uplimit" mode = "semantics"/>
2688 <xsl:apply-templates select = "*[5]" mode = "semantics"/>
2690 <xsl:when test="*[2]=m:bvar and *[3]=m:condition">
2693 <xsl:if test="*[1]=m:sum">
2694 <!-- HELM: added -->
2695 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2696 <xsl:attribute name="xref">
2697 <xsl:value-of select="m:sum/@id"/>
2702 <xsl:if test="*[1]=m:product">
2703 <!-- HELM: added -->
2704 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2705 <xsl:attribute name="xref">
2706 <xsl:value-of select="m:product/@id"/>
2712 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
2714 <xsl:apply-templates select = "*[4]" mode = "semantics"/>
2720 <xsl:template match = "m:apply[m:limit[1]]">
2722 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2723 <xsl:attribute name="xref">
2724 <xsl:value-of select="@id"/>
2729 <!-- HELM: added -->
2730 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2731 <xsl:attribute name="xref">
2732 <xsl:value-of select="m:lim/@id"/>
2736 <xsl:if test="*[2]=m:bvar and *[3]=m:lowlimit">
2737 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2738 <m:mo>→</m:mo>
2739 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
2741 <xsl:if test="*[2]=m:bvar and *[3]=m:condition">
2742 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
2746 <xsl:apply-templates select = "*[4]" mode = "semantics"/>
2751 <!-- ***************** TRIGONOMETRY ***************** -->
2753 <xsl:template match = "m:apply[*[1][self::m:sin | self::m:cos |
2754 self::m:tan | self::m:sec | self::m:csc |
2755 self::m:cot | self::m:sinh | self::m:cosh |
2756 self::m:tanh | self::m:sech | self::m:csch |
2757 self::m:coth | self::m:arcsin | self::m:arccos |
2760 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2761 <xsl:attribute name="xref">
2762 <xsl:value-of select="@id"/>
2765 <xsl:if test="not(parent::m:apply[m:power[1]])">
2766 <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
2768 <xsl:if test="parent::m:apply[m:power[1]]">
2770 <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
2771 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
2774 <m:mo>⁡</m:mo>
2775 <xsl:apply-templates select = "*[2]" mode = "semantics">
2776 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
2777 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
2778 </xsl:apply-templates>
2782 <xsl:template match = "*" mode="trigonometry">
2784 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2785 <xsl:attribute name="xref">
2786 <xsl:value-of select="@id"/>
2790 <xsl:when test="self::m:sin">
2791 <xsl:value-of select="'sin'"/>
2793 <xsl:when test="self::m:cos">
2794 <xsl:value-of select="'cos'"/>
2796 <xsl:when test="self::m:tan">
2797 <xsl:value-of select="'tan'"/>
2799 <xsl:when test="self::m:sec">
2800 <xsl:value-of select="'sec'"/>
2802 <xsl:when test="self::m:csc">
2803 <xsl:value-of select="'csc'"/>
2805 <xsl:when test="self::m:cot">
2806 <xsl:value-of select="'cot'"/>
2808 <xsl:when test="self::m:sinh">
2809 <xsl:value-of select="'sinh'"/>
2811 <xsl:when test="self::m:cosh">
2812 <xsl:value-of select="'cosh'"/>
2814 <xsl:when test="self::m:tanh">
2815 <xsl:value-of select="'tanh'"/>
2817 <xsl:when test="self::m:sech">
2818 <xsl:value-of select="'sech'"/>
2820 <xsl:when test="self::m:csch">
2821 <xsl:value-of select="'csch'"/>
2823 <xsl:when test="self::m:coth">
2824 <xsl:value-of select="'coth'"/>
2826 <xsl:when test="self::m:arcsin">
2827 <xsl:value-of select="'arcsin'"/>
2829 <xsl:when test="self::m:arccos">
2830 <xsl:value-of select="'arccos'"/>
2832 <xsl:when test="self::m:arctan">
2833 <xsl:value-of select="'arctan'"/>
2840 <!-- ***************** STATISTICS ***************** -->
2842 <xsl:template match = "m:apply[m:mean[1]]">
2843 <m:mfenced open="<" close=">" separators=",">
2844 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2845 <xsl:attribute name="xref">
2846 <xsl:value-of select="@id"/>
2849 <xsl:for-each select = "*[position()>1]">
2850 <xsl:apply-templates select = "." mode="semantics"/>
2855 <xsl:template match = "m:apply[m:sdev[1]]">
2857 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2858 <xsl:attribute name="xref">
2859 <xsl:value-of select="@id"/>
2863 <!-- HELM: added -->
2864 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2865 <xsl:attribute name="xref">
2866 <xsl:value-of select="m:sdev/@id"/>
2868 </xsl:if>σ</m:mo>
2869 <m:mfenced separators=",">
2870 <xsl:for-each select = "*[position()>1]">
2871 <xsl:apply-templates select = "." mode="semantics"/>
2877 <xsl:template match = "m:apply[m:variance[1]]">
2879 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2880 <xsl:attribute name="xref">
2881 <xsl:value-of select="@id"/>
2885 <!-- HELM: added -->
2886 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2887 <xsl:attribute name="xref">
2888 <xsl:value-of select="m:variance/@id"/>
2890 </xsl:if>σ</m:mo>
2892 <m:mfenced separators=",">
2893 <xsl:for-each select = "*[position()>1]">
2894 <xsl:apply-templates select = "." mode="semantics"/>
2902 <xsl:template match = "m:apply[m:median[1]]">
2904 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2905 <xsl:attribute name="xref">
2906 <xsl:value-of select="@id"/>
2910 <!-- HELM: added -->
2911 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2912 <xsl:attribute name="xref">
2913 <xsl:value-of select="m:median/@id"/>
2915 </xsl:if>median</m:mo>
2916 <m:mfenced separators=",">
2917 <xsl:for-each select = "*[position()>1]">
2918 <xsl:apply-templates select = "." mode="semantics"/>
2924 <xsl:template match = "m:apply[m:mode[1]]">
2926 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2927 <xsl:attribute name="xref">
2928 <xsl:value-of select="@id"/>
2932 <!-- HELM: added -->
2933 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2934 <xsl:attribute name="xref">
2935 <xsl:value-of select="m:mode/@id"/>
2937 </xsl:if>mode</m:mo>
2938 <m:mfenced separators=",">
2939 <xsl:for-each select = "*[position()>1]">
2940 <xsl:apply-templates select = "." mode="semantics"/>
2946 <xsl:template match = "m:apply[m:moment[1]]">
2947 <m:mfenced open="<" close=">" separators="">
2948 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2949 <xsl:attribute name="xref">
2950 <xsl:value-of select="@id"/>
2953 <xsl:if test="*[2]=m:degree">
2955 <xsl:apply-templates select="*[3]" mode = "semantics"/>
2956 <xsl:apply-templates select="*[2]" mode = "semantics"/>
2959 <xsl:if test="not(*[2]=m:degree)">
2960 <xsl:for-each select = "*[position()>1]">
2961 <xsl:apply-templates select = "." mode="semantics"/>
2968 <!-- ***************** LINEAR ALGEBRA ***************** -->
2970 <xsl:template match="m:vector">
2971 <m:mfenced separators="">
2972 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2973 <xsl:attribute name="xref">
2974 <xsl:value-of select="@id"/>
2978 <xsl:for-each select="*">
2980 <xsl:apply-templates select="." mode = "semantics"/>
2987 <xsl:template match = "m:matrix">
2988 <m:mfenced separators="">
2989 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2990 <xsl:attribute name="xref">
2991 <xsl:value-of select="@id"/>
2995 <xsl:apply-templates select="*" mode = "semantics"/>
3000 <xsl:template match = "m:matrixrow">
3002 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3003 <xsl:attribute name="xref">
3004 <xsl:value-of select="@id"/>
3007 <xsl:for-each select="*">
3009 <xsl:apply-templates select="." mode = "semantics"/>
3015 <xsl:template match = "m:apply[m:determinant[1]]">
3017 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3018 <xsl:attribute name="xref">
3019 <xsl:value-of select="@id"/>
3023 <!-- HELM: added -->
3024 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3025 <xsl:attribute name="xref">
3026 <xsl:value-of select="m:determinant/@id"/>
3029 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
3033 <xsl:template match = "m:apply[m:transpose[1]]">
3035 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3036 <xsl:attribute name="xref">
3037 <xsl:value-of select="@id"/>
3040 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
3042 <!-- HELM: added -->
3043 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3044 <xsl:attribute name="xref">
3045 <xsl:value-of select="m:transpose/@id"/>
3051 <xsl:template match = "m:apply[m:selector[1]]">
3052 <xsl:if test="*[2]=m:matrix and *[3]=m:cn">
3053 <xsl:variable name="m" select = "*[3]"/>
3055 <xsl:when test="*[4]=m:cn">
3056 <xsl:variable name="n" select = "*[4]"/>
3057 <xsl:copy-of select = "m:matrix/*[position()=$m]/*[position()=$n]"/>
3060 <xsl:copy-of select = "m:matrix/*[position()=$m]"/>
3064 <xsl:if test="(*[2]=m:vector or *[2]=m:list) and *[3]=m:cn">
3065 <xsl:variable name="m" select = "*[3]"/>
3066 <xsl:copy-of select = "*[2]/*[position()=$m]"/>
3070 <xsl:template match = "m:apply[m:vectorproduct[1] |
3071 m:scalarproduct[1] | m:outerproduct[1]]">
3073 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3074 <xsl:attribute name="xref">
3075 <xsl:value-of select="@id"/>
3078 <xsl:apply-templates select="*[2]" mode = "semantics"/>
3080 <xsl:if test="m:vectorproduct[1]">
3081 <!-- HELM: added -->
3082 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3083 <xsl:attribute name="xref">
3084 <xsl:value-of select="m:vectorproduct/@id"/>
3089 <xsl:if test="m:scalarproduct[1] | m:outerproduct[1]">
3090 <!-- HELM: added -->
3091 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3092 <xsl:attribute name="xref">
3093 <xsl:value-of select="*[1]/@id"/>
3096 <xsl:value-of select="'.'"/>
3099 <xsl:apply-templates select="*[3]" mode = "semantics"/>