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 <!-- First draft: April 27 2001, Irene Schena -->
24 <!-- ====================================================== -->
26 <!-- Mostly complies with the W3C MathML 2.0 Candidate Recommenation
27 of November 13, 2000. The main difference is the use of <mchar>
28 which was removed from MathML 2.0 in the last working draft.
31 <xsl:stylesheet id="mmlctop.xsl"
33 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
34 xmlns:m="http://www.w3.org/1998/Math/MathML">
36 <!-- HELM: we don't have a default namespace.
37 Removed xmlns="http://www.w3.org/1998/Math/MathML" -->
39 <xsl:output method="xml" indent="yes"/>
41 <xsl:strip-space elements="apply semantics annotation-xml
42 csymbol fn cn ci interval matrix matrixrow vector
43 lambda bvar condition logbase degree set list
47 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
48 <!-- Parameters, variables and constants -->
49 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
51 <!-- ~~~~~~~~ Semantics related *constants*: ~~~~~~~~ -->
53 <!-- Strip off semantics -->
54 <xsl:variable name="SEM_STRIP" select="-1"/>
56 <!-- Pass semantics "as is" -->
57 <xsl:variable name="SEM_PASS" select="0"/>
59 <!-- Add semantics at top level only -->
60 <xsl:variable name="SEM_TOP" select="1"/>
62 <!-- Add semantics at all levels -->
63 <xsl:variable name="SEM_ALL" select="2"/>
65 <!-- Semantics at top level only, with id refs -->
66 <!-- NOTE: ids have to be already present in the
67 input for this feature to work. -->
68 <xsl:variable name="SEM_XREF" select="3"/>
70 <!-- No semantics at top level, 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_EXT" select="4"/>
76 <!-- ~~~~~~~~~~ Stylesheet *parameter*: SEM_SW ~~~~~~~~~~~~~~ -->
77 <!-- Assumes one of the above values; SEM_PASS is the default -->
78 <!-- The default can be overridden by specifying different -->
79 <!-- value on the command line when the stylesheet is invoked -->
81 <!-- HELM: $SEM_SW was SEM_PASS (error!) -->
82 <xsl:param name="SEM_SW" select="$SEM_XREF"/>
84 <!-- ~~~~~~ Operator precedence definitions ~~~~~~ -->
86 <xsl:variable name="NO_PREC" select="0"/>
87 <xsl:variable name="UNION_PREC" select="1"/>
88 <xsl:variable name="SETDIFF_PREC" select="1"/>
89 <xsl:variable name="INTERSECT_PREC" select="3"/>
90 <xsl:variable name="OR_PREC" select="5"/>
91 <xsl:variable name="XOR_PREC" select="5"/>
92 <xsl:variable name="AND_PREC" select="7"/>
93 <xsl:variable name="PLUS_PREC" select="9"/>
94 <xsl:variable name="MINUS_PREC" select="9"/>
95 <xsl:variable name="MUL_PREC" select="11"/>
96 <xsl:variable name="DIV_PREC" select="11"/>
97 <xsl:variable name="NEG_PREC" select="13"/>
98 <xsl:variable name="FUNCTION_PREC" select="99"/>
100 <!-- ~~~~~ Miscellaneous constant definitions ~~~~~ -->
102 <xsl:variable name="YES" select="1"/>
103 <xsl:variable name="NO" select="0"/>
104 <xsl:variable name="NO_PARAM" select="-1"/>
105 <xsl:variable name="PAR_SAME" select="-3"/>
106 <xsl:variable name="PAR_YES" select="-5"/>
107 <xsl:variable name="PAR_NO" select="-7"/>
110 <!-- +++++++++++++++++ INDEX OF TEMPLATES +++++++++++++++++++ -->
112 <!-- All templates are subdivided into the following categories
113 (listed in the order of appearance in the stylesheet):
115 THE TOPMOST ELEMENT: MATH
121 BASIC CONTAINER ELEMENTS
124 BASIC CONTENT ELEMENTS
125 fn, interval, inverse, sep, condition, declare, lambda, compose, ident
127 ARITHMETIC, ALGEBRA & LOGIC
128 quotient, exp, factorial, max, min, minus, plus, power, rem, divide,
129 times, root, gcd, and, or, xor, not, forall, exists, abs, conjugate,
133 neq, approx, tendsto, implies, in, notin, notsubset, notprsubset,
134 subset, prsubset, eq, gt, lt, geq, leq, equivalent
137 ln, log, diff, partialdiff, lowlimit, uplimit, bvar, degree,
138 logbase, divergence, grad, curl, laplacian
141 set, list, union, intersect, setdiff, card
147 sin, cos, tan, sec, csc, cot, sinh, cosh, tanh, sech, csch, coth,
148 arcsin, arccos, arctan
151 mean, sdev, variance, median, mode, moment
154 vector, matrix, matrixrow, determinant, transpose, selector,
155 vectorproduct, scalarproduct, outerproduct
159 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
160 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ TEMPLATES ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
161 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
164 <!-- ***************** THE TOPMOST ELEMENT: MATH ***************** -->
166 <xsl:template match = "m:math">
168 <xsl:when test="$SEM_SW=$SEM_TOP or $SEM_SW=$SEM_ALL and *[2] or
172 <xsl:apply-templates mode = "semantics"/>
174 <m:annotation-xml encoding="MathML">
175 <xsl:copy-of select="*"/>
181 <xsl:apply-templates mode = "semantics"/>
188 <!-- ***************** SEMANTICS HANDLING ***************** -->
190 <!-- This template is called recursively. At each level -->
191 <!-- in the source tree it decides whether to strip off, -->
192 <!-- pass or add semantics at that level (depending on the -->
193 <!-- value of SEM_SW parameter). Then the actual template -->
194 <!-- is applied to the node. -->
196 <xsl:template match = "m:*" mode = "semantics">
197 <xsl:param name="IN_PREC" select="$NO_PREC"/>
198 <xsl:param name="PARAM" select="$NO_PARAM"/>
199 <xsl:param name="PAREN" select="$PAR_NO"/>
200 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
202 <xsl:when test="$SEM_SW=$SEM_STRIP and self::m:semantics">
203 <xsl:apply-templates select="m:annotation-xml[@encoding='MathML']">
204 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
205 <xsl:with-param name="PARAM" select="$PARAM"/>
206 <xsl:with-param name="PAREN" select="$PAREN"/>
207 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
208 </xsl:apply-templates>
210 <xsl:when test="($SEM_SW=$SEM_PASS or $SEM_SW=$SEM_TOP) and self::m:semantics">
212 <xsl:apply-templates select="*[1]">
213 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
214 <xsl:with-param name="PARAM" select="$PARAM"/>
215 <xsl:with-param name="PAREN" select="$PAREN"/>
216 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
217 </xsl:apply-templates>
218 <xsl:copy-of select="m:annotation-xml"/>
221 <xsl:when test="$SEM_SW=$SEM_ALL">
224 <xsl:when test="self::m:semantics">
225 <xsl:apply-templates select="*[1]">
226 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
227 <xsl:with-param name="PARAM" select="$PARAM"/>
228 <xsl:with-param name="PAREN" select="$PAREN"/>
229 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
230 </xsl:apply-templates>
231 <xsl:copy-of select="m:annotation-xml"/>
234 <xsl:apply-templates select=".">
235 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
236 <xsl:with-param name="PARAM" select="$PARAM"/>
237 <xsl:with-param name="PAREN" select="$PAREN"/>
238 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
239 </xsl:apply-templates>
240 <m:annotation-xml encoding="MathML">
241 <xsl:copy-of select="."/>
247 <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
249 <!-- HELM: syntax error: sematics -->
250 <xsl:when test="self::m:semantics">
252 <xsl:copy-of select="@*"/>
253 <xsl:attribute name="m:xref">
254 <xsl:value-of select="@id"/>
256 <xsl:copy-of select="*[1]"/>
257 <xsl:copy-of select="m:annotation-xml"/>
261 <xsl:apply-templates select=".">
262 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
263 <xsl:with-param name="PARAM" select="$PARAM"/>
264 <xsl:with-param name="PAREN" select="$PAREN"/>
265 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
266 </xsl:apply-templates>
272 <xsl:when test="self::m:semantics">
273 <xsl:copy-of select="."/>
276 <xsl:apply-templates select=".">
277 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
278 <xsl:with-param name="PARAM" select="$PARAM"/>
279 <xsl:with-param name="PAREN" select="$PAREN"/>
280 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
281 </xsl:apply-templates>
288 <xsl:template match = "m:semantics">
289 <xsl:apply-templates select="." mode = "semantics"/>
293 <!-- ***************** BASIC CONTAINER ELEMENTS ***************** -->
295 <!-- HELM: cn could not contain MAthML presentation -->
296 <xsl:template match = "m:cn">
297 <xsl:param name="IN_PREC" select="$NO_PREC"/>
298 <xsl:param name="PAREN" select="$PAR_NO"/>
299 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
302 <xsl:when test="child::text()">
305 <xsl:when test=". < 0 and $IN_PREC > $NO_PREC and $PAREN=$PAR_NO
306 and $PAR_NO_IGNORE=$NO">
307 <m:mfenced separators="">
308 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
309 <xsl:attribute name="m:xref">
310 <xsl:value-of select="@id"/>
313 <xsl:apply-templates select="." mode="cn"/>
318 <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
319 <xsl:apply-templates select="." mode="cnid"/>
322 <xsl:apply-templates select="." mode="cn"/>
331 <xsl:attribute name="m:xref">
332 <xsl:value-of select="@id"/>
334 <xsl:copy-of select="*"/>
341 <xsl:template match = "m:cn" mode="cn">
343 <xsl:when test="@base and (not(@type) or @type='integer' or @type='real')">
345 <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
346 <m:mn> <xsl:value-of select="@base"/> </m:mn>
349 <xsl:when test="@type='complex' and not(@base) and child::m:sep[1]">
350 <m:mfenced separators="">
351 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
352 <xsl:if test="text()[2] < 0">
354 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
356 <xsl:if test="not(text()[2] < 0)">
358 <m:mn> <xsl:value-of select="text()[2]"/> </m:mn>
360 <m:mo> <m:mchar name="InvisibleTimes"/> </m:mo>
364 <xsl:when test="@type='complex' and @base and child::m:sep[1]">
366 <m:mfenced separators="">
367 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
368 <xsl:if test="text()[2] < 0">
370 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
372 <xsl:if test="not(text()[2] < 0)">
374 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
376 <m:mo> <m:mchar name="InvisibleTimes"/> </m:mo>
379 <m:mn> <xsl:value-of select="@base"/> </m:mn>
382 <xsl:when test="@type='rational' and not(@base) and child::m:sep[1]">
384 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
385 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
388 <xsl:when test="@type='rational' and @base and child::m:sep[1]">
392 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
393 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
396 <m:mn> <xsl:value-of select="@base"/> </m:mn>
399 <xsl:when test="@type='polar' and not(@base) and child::m:sep[1]">
402 <m:mo> <m:mchar name="InvisibleTimes"/> </m:mo>
403 <m:mfenced separators=",">
404 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
405 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
409 <xsl:when test="@type='polar' and @base and child::m:sep[1]">
413 <m:mo> <m:mchar name="InvisibleTimes"/> </m:mo>
414 <m:mfenced separators=",">
415 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
416 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
419 <m:mn> <xsl:value-of select="@base"/> </m:mn>
423 <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
428 <xsl:template match = "m:cn" mode="cnid">
430 <xsl:when test="@base and (not(@type) or @type='integer' or @type='real')">
431 <m:msub m:xref="{@id}">
432 <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
433 <m:mn> <xsl:value-of select="@base"/> </m:mn>
436 <xsl:when test="@type='complex' and not(@base) and child::m:sep[1]">
437 <m:mfenced separators="" m:xref="{@id}">
438 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
439 <xsl:if test="text()[2] < 0">
441 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
443 <xsl:if test="not(text()[2] < 0)">
445 <m:mn> <xsl:value-of select="text()[2]"/> </m:mn>
447 <m:mo> <m:mchar name="InvisibleTimes"/> </m:mo>
451 <xsl:when test="@type='complex' and @base and child::m:sep[1]">
452 <m:msub m:xref="{@id}">
453 <m:mfenced separators="">
454 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
455 <xsl:if test="text()[2] < 0">
457 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
459 <xsl:if test="not(text()[2] < 0)">
461 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
463 <m:mo> <m:mchar name="InvisibleTimes"/> </m:mo>
466 <m:mn> <xsl:value-of select="@base"/> </m:mn>
469 <xsl:when test="@type='rational' and not(@base) and child::m:sep[1]">
470 <m:mfrac m:xref="{@id}">
471 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
472 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
475 <xsl:when test="@type='rational' and @base and child::m:sep[1]">
476 <m:msub m:xref="{@id}">
479 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
480 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
483 <m:mn> <xsl:value-of select="@base"/> </m:mn>
486 <xsl:when test="@type='polar' and not(@base) and child::m:sep[1]">
487 <m:mrow m:xref="{@id}">
489 <m:mo> <m:mchar name="InvisibleTimes"/> </m:mo>
490 <m:mfenced separators=",">
491 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
492 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
496 <xsl:when test="@type='polar' and @base and child::m:sep[1]">
497 <m:msub m:xref="{@id}">
500 <m:mo> <m:mchar name="InvisibleTimes"/> </m:mo>
501 <m:mfenced separators=",">
502 <m:mn> <xsl:apply-templates select="text()[1]"/> </m:mn>
503 <m:mn> <xsl:apply-templates select="text()[2]"/> </m:mn>
506 <m:mn> <xsl:value-of select="@base"/> </m:mn>
510 <m:mn m:xref="{@id}"> <xsl:apply-templates mode = "semantics"/> </m:mn>
515 <!-- HELM: ci could not contain MAthML presentation -->
516 <xsl:template match = "m:ci">
519 <xsl:when test="child::text()">
522 <xsl:when test="@type='vector' or @type=matrix or @type=set">
523 <m:mi fontweight="bold">
524 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
525 <xsl:attribute name="m:xref">
526 <xsl:value-of select="@id"/>
529 <xsl:apply-templates mode = "semantics"/>
532 <xsl:when test="child::text() and not(child::*[1])">
534 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
535 <xsl:attribute name="m:xref">
536 <xsl:value-of select="@id"/>
539 <!-- HELM: added mode=semantics -->
540 <xsl:apply-templates mode = "semantics"/>
543 <xsl:when test="child::text() and *[1] and not(*[1]=m:sep)">
545 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
546 <xsl:attribute name="m:xref">
547 <xsl:value-of select="@id"/>
550 <!-- HELM: added mode=semantics -->
551 <xsl:apply-templates mode = "semantics"/>
557 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
558 <xsl:attribute name="m:xref">
559 <xsl:value-of select="@id"/>
562 <xsl:apply-templates select="*"/>
565 <xsl:if test="not(*[2])">
566 <xsl:apply-templates select="*[1]"/>
574 <xsl:copy-of select="*"/>
575 <xsl:attribute name="m:xref">
576 <xsl:value-of select="@id"/>
584 <xsl:template match = "m:ci/m:*[not(self::m:sep)]">
585 <xsl:copy-of select = "."/>
588 <!-- HELM: previous Version x.xx from Feb. 18, 2000 -->
589 <xsl:template match = "m:csymbol">
592 <xsl:attribute name="m:xref">
593 <xsl:value-of select="@id"/>
597 <xsl:when test="*[1]">
598 <xsl:copy-of select = "*"/>
602 <xsl:apply-templates mode = "semantics"/>
610 <!-- HELM: csymbol cannot contain ci or cn elements, but only text or
611 presentation elements. PCDATA should render as if it were wrapped in
612 an mo. Mixed content: mrow which contains mo + presentation elements -->
613 <!--<xsl:template match = "m:csymbol/m:*">
615 <xsl:when test="self::m:cn or self::m:ci">
616 <xsl:apply-templates mode = "semantics"/>
619 <xsl:copy-of select = "."/>
624 <xsl:template match = "m:csymbol/text()">
626 <xsl:when test=". < 0 or . = 0 or . > 0">
627 <mn> <xsl:copy-of select = "."/> </mn>
630 <mi> <xsl:copy-of select = "."/> </mi>
636 <!-- ***************** BASIC CONTENT ELEMENTS ***************** -->
638 <xsl:template match = "m:apply[m:*[1][self::m:fn]]">
640 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
641 <xsl:attribute name="m:xref">
642 <xsl:value-of select="@id"/>
645 <xsl:apply-templates select = "m:fn[1]" mode = "semantics"/>
648 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
649 <xsl:attribute name="m:xref">
650 <xsl:value-of select="m:fn/@id"/>
653 <m:mchar name='ApplyFunction'/> </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:mchar name='ApplyFunction'/> </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:mchar name='Lambda'/> </m:mo>
823 <m:mo> <m:mchar name='ApplyFunction'/> </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:mchar name='ApplyFunction'/> </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"/>
874 <m:mchar name="SmallCircle"/> </m:mo>
875 <xsl:apply-templates select = "." mode="semantics"/>
880 <xsl:template match = "m:ident">
882 <xsl:when test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
883 <m:mo m:xref="{@id}">id</m:mo>
892 <!-- ***************** ARITHMETIC, ALGEBRA & LOGIC ***************** -->
894 <xsl:template match = "m:apply[m:quotient[1]]">
896 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
897 <xsl:attribute name="m:xref">
898 <xsl:value-of select="@id"/>
901 <m:mo form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em">
902 <m:mchar name="LeftFloor"/>
906 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
907 <xsl:attribute name="m:xref">
908 <xsl:value-of select="m:quotient/@id"/>
912 <xsl:apply-templates select="*[2]" mode = "semantics">
913 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
914 </xsl:apply-templates>
917 <xsl:apply-templates select="*[3]" mode = "semantics">
918 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
919 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
920 </xsl:apply-templates>
923 <m:mo form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em">
924 <m:mchar name="LeftFloor"/>
929 <xsl:template match = "m:apply[*[1][self::m:exp]]">
931 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
932 <xsl:attribute name="m:xref">
933 <xsl:value-of select="@id"/>
938 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
939 <xsl:attribute name="m:xref">
940 <xsl:value-of select="m:exp/@id"/>
943 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
947 <xsl:template match = "m:apply[m:factorial[1]]">
949 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
950 <xsl:attribute name="m:xref">
951 <xsl:value-of select="@id"/>
954 <xsl:apply-templates select = "*[2]" mode = "semantics">
955 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
956 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
957 </xsl:apply-templates>
960 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
961 <xsl:attribute name="m:xref">
962 <xsl:value-of select="m:factorial/@id"/>
968 <xsl:template match = "m:apply[m:max[1] | m:min[1]]">
970 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
971 <xsl:attribute name="m:xref">
972 <xsl:value-of select="@id"/>
975 <xsl:if test="*[2]=m:bvar">
977 <xsl:if test="*[1]=m:max">
980 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
981 <xsl:attribute name="m:xref">
982 <xsl:value-of select="m:max/@id"/>
986 <xsl:if test="*[1]=m:min">
989 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
990 <xsl:attribute name="m:xref">
991 <xsl:value-of select="m:min/@id"/>
995 <xsl:apply-templates select="*[2]" mode = "semantics"/>
997 <xsl:if test="*[3]=m:condition">
998 <m:mfenced open="{{" close="}}" separators="">
999 <m:mfenced open="" close="" separators=",">
1000 <xsl:for-each select = "*[position()>3]">
1001 <xsl:apply-templates select = "." mode="semantics"/>
1005 <xsl:apply-templates select="*[3]" mode = "semantics"/>
1008 <xsl:if test="not(*[3]=m:condition)">
1009 <m:mfenced open="{{" close="}}" separators=",">
1010 <xsl:for-each select = "*[position()>2]">
1011 <xsl:apply-templates select = "." mode="semantics"/>
1016 <xsl:if test="*[2]=m:condition">
1017 <xsl:if test="*[1]=m:max">
1020 <xsl:if test="*[1]=m:min">
1023 <m:mfenced open="{{" close="}}" separators="">
1024 <xsl:if test="*[3]">
1025 <m:mfenced open="" close="" separators=",">
1026 <xsl:for-each select = "*[position()>2]">
1027 <xsl:apply-templates select = "." mode="semantics"/>
1032 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1035 <xsl:if test="not(*[2]=m:condition) and not(*[2]=m:bvar)">
1036 <xsl:if test="*[1]=m:max">
1039 <xsl:if test="*[1]=m:min">
1042 <m:mfenced open="{{" close="}}" separators=",">
1043 <xsl:for-each select = "*[position()>1]">
1044 <xsl:apply-templates select = "." mode="semantics"/>
1051 <xsl:template match = "m:apply[m:minus[1]]">
1052 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1053 <xsl:param name="PARAM" select="$NO_PARAM"/>
1054 <xsl:param name="PAREN" select="$PAR_NO"/>
1055 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1057 <xsl:when test="$IN_PREC > $MINUS_PREC or $IN_PREC=$MINUS_PREC and
1059 <m:mfenced separators="">
1060 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1061 <xsl:attribute name="m:xref">
1062 <xsl:value-of select="@id"/>
1065 <xsl:apply-templates select="." mode="minus">
1066 <xsl:with-param name="PARAM" select="$PARAM"/>
1067 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1068 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1069 </xsl:apply-templates>
1072 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1073 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1074 and not($SEM_SW=$SEM_XREF_EXT)">
1075 <xsl:apply-templates select="." mode="minus">
1076 <xsl:with-param name="PARAM" select="$PARAM"/>
1077 <xsl:with-param name="PAREN" select="$PAREN"/>
1078 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1079 </xsl:apply-templates>
1083 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1084 <xsl:attribute name="m:xref">
1085 <xsl:value-of select="@id"/>
1088 <xsl:apply-templates select="." mode="minus">
1089 <xsl:with-param name="PARAM" select="$PARAM"/>
1090 <xsl:with-param name="PAREN" select="$PAREN"/>
1091 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1092 </xsl:apply-templates>
1098 <xsl:template match = "m:apply[m:minus[1]]" mode="minus">
1099 <xsl:param name="PARAM" select="$NO_PARAM"/>
1100 <xsl:param name="PAREN" select="$PAR_NO"/>
1101 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1102 <xsl:if test="not(*[3])">
1104 <!-- HELM: added -->
1105 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1106 <xsl:attribute name="m:xref">
1107 <xsl:value-of select="m:minus/@id"/>
1110 <xsl:apply-templates select="*[2]" mode = "semantics">
1111 <xsl:with-param name="IN_PREC" select="$NEG_PREC"/>
1112 <xsl:with-param name="PAREN" select="$PAREN"/>
1113 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1114 </xsl:apply-templates>
1116 <xsl:if test="*[3]">
1117 <xsl:apply-templates select="*[2]" mode = "semantics">
1118 <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
1119 <xsl:with-param name="PARAM" select="$PARAM"/>
1120 <xsl:with-param name="PAREN" select="$PAREN"/>
1121 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1122 </xsl:apply-templates>
1124 <!-- HELM: added -->
1125 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1126 <xsl:attribute name="m:xref">
1127 <xsl:value-of select="m:minus/@id"/>
1130 <xsl:apply-templates select="*[3]" mode = "semantics">
1131 <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
1132 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
1133 <xsl:with-param name="PAREN" select="$PAREN"/>
1134 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1135 </xsl:apply-templates>
1139 <xsl:template match = "m:apply[m:plus[1]]">
1140 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1141 <xsl:param name="PARAM" select="$NO_PARAM"/>
1142 <xsl:param name="PAREN" select="$PAR_NO"/>
1143 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1145 <xsl:when test="$IN_PREC > $PLUS_PREC or $IN_PREC=$PLUS_PREC and
1147 <m:mfenced separators="">
1148 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1149 <xsl:attribute name="m:xref">
1150 <xsl:value-of select="@id"/>
1153 <xsl:apply-templates select="." mode="plus">
1154 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1155 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1156 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1157 </xsl:apply-templates>
1160 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1161 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1162 and not($SEM_SW=$SEM_XREF_EXT)">
1163 <xsl:apply-templates select="." mode="plus">
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>
1171 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1172 <xsl:attribute name="m:xref">
1173 <xsl:value-of select="@id"/>
1176 <xsl:apply-templates select="." mode="plus">
1177 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1178 <xsl:with-param name="PAREN" select="$PAREN"/>
1179 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1180 </xsl:apply-templates>
1186 <xsl:template match = "m:apply[m:plus[1]]" mode="plus">
1187 <xsl:param name="PARAM" select="$NO_PARAM"/>
1188 <xsl:param name="PAREN" select="$PAR_NO"/>
1189 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1190 <xsl:if test="*[2]">
1191 <xsl:apply-templates select="*[2]" mode = "semantics">
1192 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
1193 <xsl:with-param name="PARAM" select="$PARAM"/>
1194 <xsl:with-param name="PAREN" select="$PAREN"/>
1195 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1196 </xsl:apply-templates>
1197 <xsl:for-each select = "*[position()>2]">
1199 <xsl:when test=". < 0">
1201 <m:mn> <xsl:value-of select="-."/> </m:mn>
1203 <xsl:when test="self::m:apply[m:minus[1]] and not(*[3])">
1204 <xsl:apply-templates select="." mode = "semantics">
1205 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
1206 <xsl:with-param name="PAREN" select="$PAREN"/>
1207 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1208 </xsl:apply-templates>
1212 <!-- HELM: added -->
1213 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1214 <xsl:attribute name="m:xref">
1215 <xsl:value-of select="../m:plus/@id"/>
1218 <xsl:apply-templates select="." mode = "semantics">
1219 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
1220 <xsl:with-param name="PAREN" select="$PAREN"/>
1221 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1222 </xsl:apply-templates>
1229 <xsl:template match = "m:apply[m:power[1]]">
1231 <xsl:when test="*[2]=m:apply[m:ln[1] | m:log[1] | m:abs[1] |
1232 m:gcd[1] | m:sin[1] | m:cos[1] | m:tan[1] |
1233 m:sec[1] | m:csc[1] | m:cot[1] | m:sinh[1] |
1234 m:cosh[1] | m:tanh[1] | m:sech[1] | m:csch[1] |
1235 m:coth[1] | m:arcsin[1] | m:arccos[1] |
1237 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1241 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1242 <xsl:attribute name="m:xref">
1243 <xsl:value-of select="@id"/>
1246 <xsl:apply-templates select = "*[2]" mode = "semantics">
1247 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1248 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1249 </xsl:apply-templates>
1250 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1256 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]">
1257 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1258 <xsl:param name="PARAM" select="$NO_PARAM"/>
1259 <xsl:param name="PAREN" select="$PAR_NO"/>
1260 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1262 <xsl:when test="$IN_PREC > $DIV_PREC or $IN_PREC=$DIV_PREC and
1264 <m:mfenced separators="">
1265 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1266 <xsl:attribute name="m:xref">
1267 <xsl:value-of select="@id"/>
1270 <xsl:apply-templates select="." mode="remdiv">
1271 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1272 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1273 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1274 </xsl:apply-templates>
1277 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1278 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1279 and not($SEM_SW=$SEM_XREF_EXT)">
1280 <xsl:apply-templates select="." mode="remdiv">
1281 <xsl:with-param name="PARAM" select="$PARAM"/>
1282 <xsl:with-param name="PAREN" select="$PAREN"/>
1283 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1284 </xsl:apply-templates>
1288 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1289 <xsl:attribute name="m:xref">
1290 <xsl:value-of select="@id"/>
1293 <xsl:apply-templates select="." mode="remdiv">
1294 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1295 <xsl:with-param name="PAREN" select="$PAREN"/>
1296 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1297 </xsl:apply-templates>
1303 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]" mode="remdiv">
1304 <xsl:param name="PARAM" select="$NO_PARAM"/>
1305 <xsl:param name="PAREN" select="$PAR_NO"/>
1306 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1307 <xsl:apply-templates select = "*[2]" mode = "semantics">
1308 <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
1309 <xsl:with-param name="PARAM" select="$PARAM"/>
1310 <xsl:with-param name="PAREN" select="$PAREN"/>
1311 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1312 </xsl:apply-templates>
1314 <xsl:if test="m:rem">
1315 <!-- HELM: added -->
1316 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1317 <xsl:attribute name="m:xref">
1318 <xsl:value-of select="m:rem/@id"/>
1321 <xsl:value-of select="'%'"/>
1323 <xsl:if test="m:divide">
1324 <!-- HELM: added -->
1325 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1326 <xsl:attribute name="m:xref">
1327 <xsl:value-of select="m:divide/@id"/>
1330 <xsl:value-of select="'/'"/>
1333 <xsl:apply-templates select = "*[3]" mode = "semantics">
1334 <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
1335 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
1336 <xsl:with-param name="PAREN" select="$PAREN"/>
1337 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1338 </xsl:apply-templates>
1341 <xsl:template match = "m:apply[m:times[1]]">
1342 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1343 <xsl:param name="PARAM" select="$NO_PARAM"/>
1344 <xsl:param name="PAREN" select="$PAR_NO"/>
1345 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1347 <xsl:when test="$IN_PREC > $MUL_PREC or $IN_PREC=$MUL_PREC and
1349 <m:mfenced separators="">
1350 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1351 <xsl:attribute name="m:xref">
1352 <xsl:value-of select="@id"/>
1355 <xsl:apply-templates select="." mode="times">
1356 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1357 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1358 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1359 </xsl:apply-templates>
1362 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1363 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1364 and not($SEM_SW=$SEM_XREF_EXT)">
1365 <xsl:apply-templates select="." mode="times">
1366 <xsl:with-param name="PARAM" select="$PARAM"/>
1367 <xsl:with-param name="PAREN" select="$PAREN"/>
1368 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1369 </xsl:apply-templates>
1373 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1374 <xsl:attribute name="m:xref">
1375 <xsl:value-of select="@id"/>
1378 <xsl:apply-templates select="." mode="times">
1379 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1380 <xsl:with-param name="PAREN" select="$PAREN"/>
1381 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1382 </xsl:apply-templates>
1388 <xsl:template match = "m:apply[m:times[1]]" mode="times">
1389 <xsl:param name="PARAM" select="$NO_PARAM"/>
1390 <xsl:param name="PAREN" select="$PAR_NO"/>
1391 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1392 <xsl:apply-templates select="*[2]" mode = "semantics">
1393 <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
1394 <xsl:with-param name="PARAM" select="$PARAM"/>
1395 <xsl:with-param name="PAREN" select="$PAREN"/>
1396 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1397 </xsl:apply-templates>
1398 <xsl:if test="*[3]">
1399 <xsl:for-each select = "*[position()>2]">
1400 <!-- HELM: to distinguish between * and the application -->
1401 <!-- <m:mo> <mchar name="InvisibleTimes"/> </m:mo> -->
1403 <!-- HELM: added -->
1404 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1405 <xsl:attribute name="m:xref">
1406 <xsl:value-of select="../m:times/@id"/>
1409 <xsl:apply-templates select="." mode = "semantics">
1410 <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
1411 <xsl:with-param name="PAREN" select="$PAREN"/>
1412 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1413 </xsl:apply-templates>
1418 <xsl:template match = "m:apply[m:root[1]]">
1420 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1421 <xsl:attribute name="m:xref">
1422 <xsl:value-of select="@id"/>
1425 <xsl:if test="*[2]=m:degree">
1426 <xsl:apply-templates select="*[3]" mode = "semantics">
1427 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1428 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1429 </xsl:apply-templates>
1430 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1432 <xsl:if test="not(*[2]=m:degree)">
1433 <xsl:apply-templates select="*[2]" mode = "semantics">
1434 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1435 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1436 </xsl:apply-templates>
1442 <xsl:template match = "m:apply[m:gcd[1]]">
1444 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1445 <xsl:attribute name="m:xref">
1446 <xsl:value-of select="@id"/>
1449 <xsl:if test="not(parent::m:apply[m:power[1]])">
1451 <!-- HELM: added -->
1452 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1453 <xsl:attribute name="m:xref">
1454 <xsl:value-of select="m:gcd/@id"/>
1458 <xsl:if test="parent::m:apply[m:power[1]]">
1461 <!-- HELM: added -->
1462 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1463 <xsl:attribute name="m:xref">
1464 <xsl:value-of select="m:gcd/@id"/>
1467 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1470 <m:mfenced separators=",">
1471 <xsl:for-each select = "*[position()>1]">
1472 <xsl:apply-templates select = "." mode="semantics"/>
1478 <xsl:template match = "m:apply[m:and[1]]">
1479 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1480 <xsl:param name="PAREN" select="$PAR_NO"/>
1481 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1483 <xsl:when test="$IN_PREC > $AND_PREC">
1484 <m:mfenced separators="">
1485 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1486 <xsl:attribute name="m:xref">
1487 <xsl:value-of select="@id"/>
1490 <xsl:apply-templates select="." mode="and">
1491 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1492 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1493 </xsl:apply-templates>
1496 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1497 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1498 and not($SEM_SW=$SEM_XREF_EXT)">
1499 <xsl:apply-templates select="." mode="and">
1500 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1501 <xsl:with-param name="PAREN" select="$PAREN"/>
1502 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1503 </xsl:apply-templates>
1507 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1508 <xsl:attribute name="m:xref">
1509 <xsl:value-of select="@id"/>
1512 <xsl:apply-templates select="." mode="and">
1513 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1514 <xsl:with-param name="PAREN" select="$PAREN"/>
1515 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1516 </xsl:apply-templates>
1522 <xsl:template match = "m:apply[m:and[1]]" mode="and">
1523 <xsl:param name="PARAM" select="$NO_PARAM"/>
1524 <xsl:param name="PAREN" select="$PAR_NO"/>
1525 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1526 <xsl:apply-templates select="*[2]" mode = "semantics">
1527 <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
1528 <xsl:with-param name="PARAM" select="$PARAM"/>
1529 <xsl:with-param name="PAREN" select="$PAREN"/>
1530 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1531 </xsl:apply-templates>
1532 <xsl:for-each select = "*[position()>2]">
1534 <!-- HELM: added -->
1535 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1536 <xsl:attribute name="m:xref">
1537 <xsl:value-of select="../m:and/@id"/>
1540 <m:mchar name="wedge"/></m:mo>
1541 <xsl:apply-templates select="." mode = "semantics">
1542 <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
1543 <xsl:with-param name="PAREN" select="$PAREN"/>
1544 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1545 </xsl:apply-templates>
1549 <xsl:template match = "m:apply[m:or[1]]">
1550 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1551 <xsl:param name="PAREN" select="$PAR_NO"/>
1552 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1554 <xsl:when test="$IN_PREC > $OR_PREC">
1555 <m:mfenced separators="">
1556 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1557 <xsl:attribute name="m:xref">
1558 <xsl:value-of select="@id"/>
1561 <xsl:apply-templates select="." mode="or">
1562 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1563 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1564 </xsl:apply-templates>
1567 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1568 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
1569 and not($SEM_SW=$SEM_XREF_EXT)">
1570 <xsl:apply-templates select="." mode="or">
1571 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1572 <xsl:with-param name="PAREN" select="$PAREN"/>
1573 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1574 </xsl:apply-templates>
1578 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1579 <xsl:attribute name="m:xref">
1580 <xsl:value-of select="@id"/>
1583 <xsl:apply-templates select="." mode="or">
1584 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1585 <xsl:with-param name="PAREN" select="$PAREN"/>
1586 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1587 </xsl:apply-templates>
1593 <xsl:template match = "m:apply[m:or[1]]" mode="or">
1594 <xsl:param name="PARAM" select="$NO_PARAM"/>
1595 <xsl:param name="PAREN" select="$PAR_NO"/>
1596 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1597 <xsl:apply-templates select="*[2]" mode = "semantics">
1598 <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1599 <xsl:with-param name="PARAM" select="$PARAM"/>
1600 <xsl:with-param name="PAREN" select="$PAREN"/>
1601 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1602 </xsl:apply-templates>
1603 <xsl:for-each select = "*[position()>2]">
1605 <!-- HELM: added -->
1606 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1607 <xsl:attribute name="m:xref">
1608 <xsl:value-of select="../m:or/@id"/>
1611 <m:mchar name="vee"/> </m:mo>
1612 <xsl:apply-templates select="." mode = "semantics">
1613 <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1614 <xsl:with-param name="PAREN" select="$PAREN"/>
1615 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1616 </xsl:apply-templates>
1620 <xsl:template match = "m:apply[m:xor[1]]">
1621 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1622 <xsl:param name="PAREN" select="$PAR_NO"/>
1623 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1625 <xsl:when test="$IN_PREC > $XOR_PREC">
1626 <m:mfenced separators="">
1627 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1628 <xsl:attribute name="m:xref">
1629 <xsl:value-of select="@id"/>
1632 <xsl:apply-templates select="." mode="xor">
1633 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1634 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1635 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1636 </xsl:apply-templates>
1639 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
1640 and not($SEM_SW=$SEM_ALL)">
1641 <xsl:apply-templates select="." mode="xor">
1642 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1643 <xsl:with-param name="PAREN" select="$PAREN"/>
1644 </xsl:apply-templates>
1648 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1649 <xsl:attribute name="m:xref">
1650 <xsl:value-of select="@id"/>
1653 <xsl:apply-templates select="." mode="xor">
1654 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1655 <xsl:with-param name="PAREN" select="$PAREN"/>
1656 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1657 </xsl:apply-templates>
1663 <xsl:template match = "m:apply[m:xor[1]]" mode="xor">
1664 <xsl:param name="PARAM" select="$NO_PARAM"/>
1665 <xsl:param name="PAREN" select="$PAR_NO"/>
1666 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1667 <xsl:apply-templates select="*[2]" mode = "semantics">
1668 <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1669 <xsl:with-param name="PARAM" select="$PARAM"/>
1670 <xsl:with-param name="PAREN" select="$PAREN"/>
1671 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1672 </xsl:apply-templates>
1673 <xsl:for-each select = "*[position()>2]">
1675 <!-- HELM: added -->
1676 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1677 <xsl:attribute name="m:xref">
1678 <xsl:value-of select="../m:xor/@id"/>
1681 <m:mchar name="xor"/> </m:mo>
1682 <xsl:apply-templates select="." mode = "semantics">
1683 <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1684 <xsl:with-param name="PAREN" select="$PAREN"/>
1685 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1686 </xsl:apply-templates>
1690 <xsl:template match = "m:apply[m:not[1]]">
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="@id"/>
1697 <!-- HELM: was <m:mo>not</m:mo> -->
1699 <!-- HELM: added -->
1700 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1701 <xsl:attribute name="m:xref">
1702 <xsl:value-of select="m:not/@id"/>
1704 </xsl:if><m:mchar name="not"/></m:mo>
1705 <xsl:apply-templates select = "*[2]" mode = "semantics">
1706 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1707 </xsl:apply-templates>
1711 <xsl:template match = "m:apply[m:forall[1]]">
1713 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1714 <xsl:attribute name="m:xref">
1715 <xsl:value-of select="@id"/>
1719 <!-- HELM: added -->
1720 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1721 <xsl:attribute name="m:xref">
1722 <xsl:value-of select="m:forall/@id"/>
1724 </xsl:if>for all</m:mo>
1725 <xsl:if test="count(m:bvar) > 1">
1726 <m:mfenced separators=",">
1727 <xsl:for-each select = "m:bvar">
1728 <xsl:apply-templates select = "." mode="semantics"/>
1732 <xsl:if test="count(m:bvar)=1">
1733 <xsl:apply-templates select = "m:bvar" mode="semantics"/>
1735 <xsl:if test="m:condition">
1737 <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1740 <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and
1741 not(self::m:condition)]" mode = "semantics"/>
1745 <xsl:template match = "m:apply[m:exists[1]]">
1747 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1748 <xsl:attribute name="m:xref">
1749 <xsl:value-of select="@id"/>
1753 <!-- HELM: added -->
1754 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1755 <xsl:attribute name="m:xref">
1756 <xsl:value-of select="m:exists/@id"/>
1759 <m:mchar name="Exists"/> </m:mo>
1760 <xsl:if test="count(m:bvar) > 1">
1761 <m:mfenced separators=",">
1762 <xsl:for-each select = "m:bvar">
1763 <xsl:apply-templates select = "." mode="semantics"/>
1767 <xsl:if test="count(m:bvar)=1">
1768 <xsl:apply-templates select = "m:bvar" mode="semantics"/>
1770 <xsl:if test="m:condition">
1772 <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1774 <xsl:if test="*[position()>1 and not(self::m:bvar) and not(self::m:condition)]">
1776 <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and
1777 not(self::m:condition)]" mode = "semantics"/>
1782 <xsl:template match = "m:apply[m:abs[1]]">
1783 <xsl:if test="not(parent::m:apply[m:power[1]])">
1784 <m:mfenced open="|" close="|" separators="">
1785 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1786 <xsl:attribute name="m:xref">
1787 <xsl:value-of select="@id"/>
1790 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1793 <xsl:if test="parent::m:apply[m:power[1]]">
1795 <m:mfenced open="|" close="|" separators="">
1796 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1797 <xsl:attribute name="m:xref">
1798 <xsl:value-of select="@id"/>
1801 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1803 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1808 <xsl:template match = "m:apply[m:conjugate[1]]">
1810 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1811 <xsl:attribute name="m:xref">
1812 <xsl:value-of select="@id"/>
1816 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1819 <!-- HELM: added -->
1820 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1821 <xsl:attribute name="m:xref">
1822 <xsl:value-of select="m:conjugate/@id"/>
1825 <m:mchar name="UnderBar"/> </m:mo>
1829 <xsl:template match = "m:apply[m:arg[1] | m:real[1] | m:imaginary[1]]">
1831 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1832 <xsl:attribute name="m:xref">
1833 <xsl:value-of select="@id"/>
1837 <xsl:if test="m:arg">
1838 <!-- HELM: added -->
1839 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1840 <xsl:attribute name="m:xref">
1841 <xsl:value-of select="m:arg/@id"/>
1844 <xsl:value-of select="'Arg'"/>
1846 <xsl:if test="m:real">
1847 <!-- HELM: added -->
1848 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1849 <xsl:attribute name="m:xref">
1850 <xsl:value-of select="m:real/@id"/>
1853 <xsl:value-of select="'Re'"/>
1855 <xsl:if test="m:imaginary">
1856 <!-- HELM: added -->
1857 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1858 <xsl:attribute name="m:xref">
1859 <xsl:value-of select="m:imaginary/@id"/>
1862 <xsl:value-of select="'Im'"/>
1865 <m:mfenced separators="">
1866 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1872 <!-- ***************** RELATIONS ***************** -->
1874 <xsl:template match = "m:apply[m:neq | m:approx | m:tendsto | m:implies
1875 | m:in | m:notin | m:notsubset | m:notprsubset
1876 | m:subset | m:prsubset | m:eq | m:gt | m:lt
1877 | m:geq | m:leq | m:equivalent]">
1879 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1880 <xsl:attribute name="m:xref">
1881 <xsl:value-of select="@id"/>
1884 <xsl:if test="*[1]=m:neq or *[1]=m:approx or *[1]=m:tendsto or
1885 *[1]=m:implies or *[1]=m:in or *[1]=m:notin or
1886 *[1]=m:notsubset or *[1]=m:notprsubset">
1887 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1889 <xsl:if test="*[1]=m:neq">
1890 <!-- HELM: added -->
1891 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1892 <xsl:attribute name="m:xref">
1893 <xsl:value-of select="m:neq/@id"/>
1896 <m:mchar name="NotEqual"/>
1898 <xsl:if test="*[1]=m:approx">
1899 <!-- HELM: added -->
1900 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1901 <xsl:attribute name="m:xref">
1902 <xsl:value-of select="m:approx/@id"/>
1905 <m:mchar name="approxeq"/>
1907 <xsl:if test="*[1]=m:tendsto">
1908 <!-- HELM: added -->
1909 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1910 <xsl:attribute name="m:xref">
1911 <xsl:value-of select="m:tendsto/@id"/>
1914 <m:mchar name="RightArrow"/>
1916 <xsl:if test="*[1]=m:implies">
1917 <!-- HELM: added -->
1918 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1919 <xsl:attribute name="m:xref">
1920 <xsl:value-of select="m:implies/@id"/>
1923 <m:mchar name="DoubleRightArrow"/>
1925 <xsl:if test="*[1]=m:in">
1926 <!-- HELM: added -->
1927 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1928 <xsl:attribute name="m:xref">
1929 <xsl:value-of select="m:in/@id"/>
1932 <m:mchar name="Element"/>
1934 <xsl:if test="*[1]=m:notin">
1935 <!-- HELM: added -->
1936 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1937 <xsl:attribute name="m:xref">
1938 <xsl:value-of select="m:notin/@id"/>
1941 <m:mchar name="NotElement"/>
1943 <xsl:if test="*[1]=m:notsubset">
1944 <!-- HELM: added -->
1945 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1946 <xsl:attribute name="m:xref">
1947 <xsl:value-of select="m:notsubset/@id"/>
1950 <m:mchar name="NotSubset"/>
1952 <xsl:if test="*[1]=m:notprsubset">
1953 <!-- HELM: added -->
1954 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1955 <xsl:attribute name="m:xref">
1956 <xsl:value-of select="m:notprsubset/@id"/>
1959 <m:mchar name="NotSubsetEqual"/>
1962 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1963 <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='below']">
1965 <!-- HELM: added -->
1966 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1967 <xsl:attribute name="m:xref">
1968 <xsl:value-of select="m:tendsto/@id"/>
1972 <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='above']">
1974 <!-- HELM: added -->
1975 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1976 <xsl:attribute name="m:xref">
1977 <xsl:value-of select="m:tendsto/@id"/>
1982 <xsl:if test="*[1]=m:subset or *[1]=m:prsubset or *[1]=m:eq or *[1]=m:gt
1983 or *[1]=m:lt or *[1]=m:geq or *[1]=m:leq or *[1]=m:equivalent">
1984 <xsl:apply-templates select = "*[2]" mode="semantics"/>
1985 <xsl:for-each select = "*[position()>2]">
1987 <xsl:if test="../*[self::m:subset][1]">
1988 <!-- HELM: added -->
1989 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1990 <xsl:attribute name="m:xref">
1991 <xsl:value-of select="../m:subset/@id"/>
1994 <m:mchar name="SubsetEqual"/>
1996 <xsl:if test="../*[self::m:prsubset][1]">
1997 <!-- HELM: added -->
1998 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
1999 <xsl:attribute name="m:xref">
2000 <xsl:value-of select="../m:prsubset/@id"/>
2003 <m:mchar name="subset"/>
2005 <xsl:if test="../*[self::m:eq][1]">
2006 <!-- HELM: added -->
2007 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2008 <xsl:attribute name="m:xref">
2009 <xsl:value-of select="../m:eq/@id"/>
2012 <xsl:value-of select="'='"/>
2014 <xsl:if test="../*[self::m:gt][1]">
2015 <!-- HELM: added -->
2016 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2017 <xsl:attribute name="m:xref">
2018 <xsl:value-of select="../m:gt/@id"/>
2021 <xsl:value-of select="'>'"/>
2023 <xsl:if test="../*[self::m:lt][1]">
2024 <!-- HELM: added -->
2025 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2026 <xsl:attribute name="m:xref">
2027 <xsl:value-of select="../m:lt/@id"/>
2030 <xsl:value-of select="'<'"/>
2032 <xsl:if test="../*[self::m:geq][1]">
2033 <!-- HELM: added -->
2034 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2035 <xsl:attribute name="m:xref">
2036 <xsl:value-of select="../m:geq/@id"/>
2039 <m:mchar name="geq"/>
2041 <xsl:if test="../*[self::m:leq][1]">
2042 <!-- HELM: added -->
2043 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2044 <xsl:attribute name="m:xref">
2045 <xsl:value-of select="../m:leq/@id"/>
2048 <m:mchar name="leq"/>
2050 <xsl:if test="../*[self::m:equivalent][1]">
2051 <!-- HELM: added -->
2052 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2053 <xsl:attribute name="m:xref">
2054 <xsl:value-of select="../m:equivalent/@id"/>
2057 <m:mchar name="Congruent"/>
2060 <xsl:apply-templates select = "." mode="semantics"/>
2067 <!-- ***************** CALCULUS ***************** -->
2069 <xsl:template match = "m:apply[*[1][self::m:ln]]">
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="@id"/>
2077 <xsl:when test="parent::m:apply[m:power[1]]">
2080 <!-- HELM: added -->
2081 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2082 <xsl:attribute name="m:xref">
2083 <xsl:value-of select="m:ln/@id"/>
2086 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
2091 <!-- HELM: added -->
2092 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2093 <xsl:attribute name="m:xref">
2094 <xsl:value-of select="m:ln/@id"/>
2099 <m:mo> <m:mchar name='ApplyFunction'/> </m:mo>
2100 <xsl:apply-templates select = "*[2]" mode = "semantics">
2101 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
2102 </xsl:apply-templates>
2106 <xsl:template match = "m:apply[m:log[1]]">
2108 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2109 <xsl:attribute name="m:xref">
2110 <xsl:value-of select="@id"/>
2114 <xsl:when test="parent::m:apply[m:power[1]]">
2115 <xsl:if test="not(*[2]=m:logbase)">
2118 <!-- HELM: added -->
2119 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2120 <xsl:attribute name="m:xref">
2121 <xsl:value-of select="m:log/@id"/>
2124 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
2127 <xsl:if test="*[2]=m:logbase">
2130 <!-- HELM: added -->
2131 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2132 <xsl:attribute name="m:xref">
2133 <xsl:value-of select="m:log/@id"/>
2136 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
2137 <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
2142 <xsl:if test="not(*[2]=m:logbase)">
2145 <xsl:if test="*[2]=m:logbase">
2148 <!-- HELM: added -->
2149 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2150 <xsl:attribute name="m:xref">
2151 <xsl:value-of select="m:log/@id"/>
2154 <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
2159 <m:mo> <m:mchar name='ApplyFunction'/> </m:mo>
2160 <xsl:if test="*[2]=m:logbase">
2161 <xsl:apply-templates select = "*[3]" mode = "semantics">
2162 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
2163 </xsl:apply-templates>
2165 <xsl:if test="not(*[2]=m:logbase)">
2166 <xsl:apply-templates select = "*[2]" mode = "semantics">
2167 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
2168 </xsl:apply-templates>
2173 <xsl:template match = "m:apply[m:diff[1]]">
2175 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2176 <xsl:attribute name="m:xref">
2177 <xsl:value-of select="@id"/>
2180 <xsl:if test="*[2]=m:bvar and m:bvar[*[2]=m:degree]">
2182 <!-- HELM: added -->
2183 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2184 <xsl:attribute name="m:xref">
2185 <xsl:value-of select="m:diff/@id"/>
2190 <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
2195 <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
2196 <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
2201 <xsl:if test="*[2]=m:bvar and not(m:bvar[*[2]=m:degree])">
2203 <!-- HELM: added -->
2204 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2205 <xsl:attribute name="m:xref">
2206 <xsl:value-of select="m:diff/@id"/>
2212 <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
2216 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
2220 <xsl:template match = "m:apply[m:partialdiff[1]]">
2222 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2223 <xsl:attribute name="m:xref">
2224 <xsl:value-of select="@id"/>
2227 <xsl:for-each select = "m:bvar">
2228 <xsl:if test="*[last()]=m:degree">
2230 <!-- HELM: added -->
2231 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2232 <xsl:attribute name="m:xref">
2233 <xsl:value-of select="m:partialdiff/@id"/>
2238 <xsl:apply-templates select = "m:degree" mode = "semantics"/>
2243 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
2244 <xsl:apply-templates select = "m:degree" mode = "semantics"/>
2249 <xsl:if test="not(*[last()]=m:degree)">
2251 <!-- HELM: added -->
2252 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2253 <xsl:attribute name="m:xref">
2254 <xsl:value-of select="m:partialdiff/@id"/>
2260 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
2265 <xsl:apply-templates select = "*[last()]" mode = "semantics"/>
2269 <xsl:template match = "m:lowlimit | m:uplimit | m:bvar | m:degree |
2271 <xsl:apply-templates select="*" mode = "semantics"/>
2274 <xsl:template match = "m:apply[m:divergence[1] | m:grad[1] | m:curl[1]]">
2276 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2277 <xsl:attribute name="m:xref">
2278 <xsl:value-of select="@id"/>
2282 <xsl:if test="*[1]=m:divergence">
2283 <!-- HELM: added -->
2284 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2285 <xsl:attribute name="m:xref">
2286 <xsl:value-of select="m:divergence/@id"/>
2289 <xsl:value-of select="'div'"/>
2291 <xsl:if test="*[1]=m:grad">
2292 <!-- HELM: added -->
2293 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2294 <xsl:attribute name="m:xref">
2295 <xsl:value-of select="m:grad/@id"/>
2298 <xsl:value-of select="'grad'"/>
2300 <xsl:if test="*[1]=m:curl">
2301 <!-- HELM: added -->
2302 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2303 <xsl:attribute name="m:xref">
2304 <xsl:value-of select="m:curl/@id"/>
2307 <xsl:value-of select="'curl'"/>
2311 <xsl:when test="*[2]=m:ci">
2312 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2315 <m:mfenced separators="">
2316 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2323 <xsl:template match = "m:apply[m:laplacian[1]]">
2325 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2326 <xsl:attribute name="m:xref">
2327 <xsl:value-of select="@id"/>
2331 <!-- HELM: added -->
2332 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2333 <xsl:attribute name="m:xref">
2334 <xsl:value-of select="m:laplacian/@id"/>
2337 <m:mo> <m:mchar name="Delta"/> </m:mo>
2340 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2345 <!-- ***************** SET THEORY ***************** -->
2347 <xsl:template match = "m:set | m:list">
2348 <m:mfenced open="{{" close="}}" separators="">
2349 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2350 <xsl:attribute name="m:xref">
2351 <xsl:value-of select="@id"/>
2354 <xsl:if test="*[1]=m:bvar and *[2]=m:condition">
2355 <xsl:apply-templates select="m:bvar" mode = "semantics"/>
2357 <xsl:apply-templates select="m:condition" mode = "semantics"/>
2359 <xsl:if test="*[1]=m:condition and not(child::m:bvar)">
2360 <m:mfenced open="" close="" separators=",">
2361 <xsl:for-each select = "*[not(self::m:condition) and not(self::m:bvar)]">
2362 <xsl:apply-templates select = "." mode="semantics"/>
2366 <xsl:apply-templates select="m:condition" mode = "semantics"/>
2368 <xsl:if test="not(child::m:bvar) and not(child::m:condition)">
2369 <m:mfenced open="" close="" separators=",">
2370 <xsl:for-each select = "*">
2371 <xsl:apply-templates select = "." mode="semantics"/>
2378 <xsl:template match = "m:apply[m:union[1]]">
2379 <xsl:param name="IN_PREC" select="$NO_PREC"/>
2380 <xsl:param name="PARAM" select="$NO_PARAM"/>
2381 <xsl:param name="PAREN" select="$PAR_NO"/>
2382 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2384 <xsl:when test="$IN_PREC > $UNION_PREC or $IN_PREC=$UNION_PREC
2385 and $PARAM=$PAR_SAME">
2386 <m:mfenced separators="">
2387 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2388 <xsl:attribute name="m:xref">
2389 <xsl:value-of select="@id"/>
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>
2399 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
2400 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
2401 and not($SEM_SW=$SEM_XREF_EXT)">
2402 <xsl:apply-templates select="." mode="union">
2403 <xsl:with-param name="PARAM" select="$PARAM"/>
2404 <xsl:with-param name="PAREN" select="$PAREN"/>
2405 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2406 </xsl:apply-templates>
2410 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2411 <xsl:attribute name="m:xref">
2412 <xsl:value-of select="@id"/>
2415 <xsl:apply-templates select="." mode="union">
2416 <xsl:with-param name="PARAM" select="$PARAM"/>
2417 <xsl:with-param name="PAREN" select="$PAREN"/>
2418 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2419 </xsl:apply-templates>
2425 <xsl:template match = "m:apply[m:union[1]]" mode="union">
2426 <xsl:param name="PARAM" select="$NO_PARAM"/>
2427 <xsl:param name="PAREN" select="$PAR_NO"/>
2428 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2429 <xsl:apply-templates select = "*[2]" mode="semantics">
2430 <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
2431 <xsl:with-param name="PARAM" select="$PARAM"/>
2432 <xsl:with-param name="PAREN" select="$PAREN"/>
2433 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2434 </xsl:apply-templates>
2435 <xsl:for-each select = "*[position()>2]">
2437 <!-- HELM: added -->
2438 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2439 <xsl:attribute name="m:xref">
2440 <xsl:value-of select="../m:union/@id"/>
2443 <m:mchar name="Union"/> </m:mo>
2444 <xsl:apply-templates select = "." mode="semantics">
2445 <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
2446 <xsl:with-param name="PAREN" select="$PAREN"/>
2447 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
2448 </xsl:apply-templates>
2452 <xsl:template match = "m:apply[m:intersect[1]]">
2453 <xsl:param name="IN_PREC" select="$NO_PREC"/>
2454 <xsl:param name="PARAM" select="$NO_PARAM"/>
2455 <xsl:param name="PAREN" select="$PAR_NO"/>
2456 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2458 <xsl:when test="$IN_PREC > $INTERSECT_PREC">
2459 <m:mfenced separators="">
2460 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2461 <xsl:attribute name="m:xref">
2462 <xsl:value-of select="@id"/>
2465 <xsl:apply-templates select="." mode="intersect">
2466 <xsl:with-param name="PARAM" select="$PARAM"/>
2467 <xsl:with-param name="PAREN" select="$PAREN"/>
2468 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2469 </xsl:apply-templates>
2472 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
2473 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
2474 and not($SEM_SW=$SEM_XREF_EXT)">
2475 <xsl:apply-templates select="." mode="intersect">
2476 <xsl:with-param name="PARAM" select="$PARAM"/>
2477 <xsl:with-param name="PAREN" select="$PAREN"/>
2478 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2479 </xsl:apply-templates>
2483 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2484 <xsl:attribute name="m:xref">
2485 <xsl:value-of select="@id"/>
2488 <xsl:apply-templates select="." mode="intersect">
2489 <xsl:with-param name="PARAM" select="$PARAM"/>
2490 <xsl:with-param name="PAREN" select="$PAREN"/>
2491 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2492 </xsl:apply-templates>
2498 <xsl:template match = "m:apply[m:intersect[1]]" mode="intersect">
2499 <xsl:param name="PARAM" select="$NO_PARAM"/>
2500 <xsl:param name="PAREN" select="$PAR_NO"/>
2501 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2502 <xsl:apply-templates select = "*[2]" mode="semantics">
2503 <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
2504 <xsl:with-param name="PARAM" select="$PARAM"/>
2505 <xsl:with-param name="PAREN" select="$PAREN"/>
2506 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2507 </xsl:apply-templates>
2508 <xsl:for-each select = "*[position()>2]">
2510 <!-- HELM: added -->
2511 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2512 <xsl:attribute name="m:xref">
2513 <xsl:value-of select="../m:intersect/@id"/>
2516 <m:mchar name="Intersection"/> </m:mo>
2517 <xsl:apply-templates select = "." mode="semantics">
2518 <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
2519 <xsl:with-param name="PAREN" select="$PAREN"/>
2520 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
2521 </xsl:apply-templates>
2525 <xsl:template match = "m:apply[m:setdiff[1]]">
2526 <xsl:param name="IN_PREC" select="$NO_PREC"/>
2527 <xsl:param name="PARAM" select="$NO_PARAM"/>
2528 <xsl:param name="PAREN" select="$PAR_NO"/>
2529 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2531 <xsl:when test="$IN_PREC > $SETDIFF_PREC or $IN_PREC=$SETDIFF_PREC
2532 and $PARAM=$PAR_SAME">
2533 <m:mfenced separators="">
2534 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2535 <xsl:attribute name="m:xref">
2536 <xsl:value-of select="@id"/>
2539 <xsl:apply-templates select="." mode="setdiff">
2540 <xsl:with-param name="PARAM" select="$PARAM"/>
2541 <xsl:with-param name="PAREN" select="$PAREN"/>
2542 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2543 </xsl:apply-templates>
2546 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC
2547 and not($SEM_SW=$SEM_ALL) and not($SEM_SW=$SEM_XREF)
2548 and not($SEM_SW=$SEM_XREF_EXT)">
2549 <xsl:apply-templates select="." mode="setdiff">
2550 <xsl:with-param name="PARAM" select="$PARAM"/>
2551 <xsl:with-param name="PAREN" select="$PAREN"/>
2552 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2553 </xsl:apply-templates>
2557 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2558 <xsl:attribute name="m:xref">
2559 <xsl:value-of select="@id"/>
2562 <xsl:apply-templates select="." mode="setdiff">
2563 <xsl:with-param name="PARAM" select="$PARAM"/>
2564 <xsl:with-param name="PAREN" select="$PAREN"/>
2565 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
2566 </xsl:apply-templates>
2572 <xsl:template match = "m:apply[m:setdiff[1]]" mode="setdiff">
2573 <xsl:param name="PARAM" select="$NO_PARAM"/>
2574 <xsl:param name="PAREN" select="$PAR_NO"/>
2575 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
2576 <xsl:apply-templates select = "*[2]" mode = "semantics">
2577 <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
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>
2583 <!-- HELM: added -->
2584 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2585 <xsl:attribute name="m:xref">
2586 <xsl:value-of select="m:setdiff/@id"/>
2589 <xsl:apply-templates select = "*[3]" mode = "semantics">
2590 <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
2591 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
2592 <xsl:with-param name="PAREN" select="$PAREN"/>
2593 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
2594 </xsl:apply-templates>
2597 <xsl:template match = "m:apply[m:card[1]]">
2598 <m:mfenced open="|" close="|" separators=",">
2599 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2600 <xsl:attribute name="m:xref">
2601 <xsl:value-of select="@id"/>
2604 <xsl:for-each select = "*[position()>1]">
2605 <xsl:apply-templates select = "." mode="semantics"/>
2611 <!-- ***************** SEQUENCES AND SERIES ***************** -->
2613 <xsl:template match = "m:apply[m:sum[1] | m:product[1]]">
2615 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2616 <xsl:attribute name="m:xref">
2617 <xsl:value-of select="@id"/>
2621 <xsl:when test="*[2]=m:bvar and m:lowlimit and m:uplimit">
2624 <xsl:if test="*[1]=m:sum">
2625 <!-- HELM: added -->
2626 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2627 <xsl:attribute name="m:xref">
2628 <xsl:value-of select="m:sum/@id"/>
2631 <m:mchar name="Sum"/>
2633 <xsl:if test="*[1]=m:product">
2634 <!-- HELM: added -->
2635 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2636 <xsl:attribute name="m:xref">
2637 <xsl:value-of select="m:product/@id"/>
2640 <m:mchar name="Product"/>
2644 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2646 <xsl:apply-templates select = "m:lowlimit" mode = "semantics"/>
2648 <xsl:apply-templates select = "m:uplimit" mode = "semantics"/>
2650 <xsl:apply-templates select = "*[5]" mode = "semantics"/>
2652 <xsl:when test="*[2]=m:bvar and *[3]=m:condition">
2655 <xsl:if test="*[1]=m:sum">
2656 <!-- HELM: added -->
2657 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2658 <xsl:attribute name="m:xref">
2659 <xsl:value-of select="m:sum/@id"/>
2662 <m:mchar name="Sum"/>
2664 <xsl:if test="*[1]=m:product">
2665 <!-- HELM: added -->
2666 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2667 <xsl:attribute name="m:xref">
2668 <xsl:value-of select="m:product/@id"/>
2671 <m:mchar name="Product"/>
2674 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
2676 <xsl:apply-templates select = "*[4]" mode = "semantics"/>
2682 <xsl:template match = "m:apply[m:limit[1]]">
2684 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2685 <xsl:attribute name="m:xref">
2686 <xsl:value-of select="@id"/>
2691 <!-- HELM: added -->
2692 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2693 <xsl:attribute name="m:xref">
2694 <xsl:value-of select="m:lim/@id"/>
2698 <xsl:if test="*[2]=m:bvar and *[3]=m:lowlimit">
2699 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2700 <m:mo> <m:mchar name="RightArrow"/> </m:mo>
2701 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
2703 <xsl:if test="*[2]=m:bvar and *[3]=m:condition">
2704 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
2708 <xsl:apply-templates select = "*[4]" mode = "semantics"/>
2713 <!-- ***************** TRIGONOMETRY ***************** -->
2715 <xsl:template match = "m:apply[*[1][self::m:sin | self::m:cos |
2716 self::m:tan | self::m:sec | self::m:csc |
2717 self::m:cot | self::m:sinh | self::m:cosh |
2718 self::m:tanh | self::m:sech | self::m:csch |
2719 self::m:coth | self::m:arcsin | self::m:arccos |
2722 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2723 <xsl:attribute name="m:xref">
2724 <xsl:value-of select="@id"/>
2727 <xsl:if test="not(parent::m:apply[m:power[1]])">
2728 <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
2730 <xsl:if test="parent::m:apply[m:power[1]]">
2732 <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
2733 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
2736 <m:mo> <m:mchar name='ApplyFunction'/> </m:mo>
2737 <xsl:apply-templates select = "*[2]" mode = "semantics">
2738 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
2739 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
2740 </xsl:apply-templates>
2744 <xsl:template match = "*" mode="trigonometry">
2746 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2747 <xsl:attribute name="m:xref">
2748 <xsl:value-of select="@id"/>
2752 <xsl:when test="self::m:sin">
2753 <xsl:value-of select="'sin'"/>
2755 <xsl:when test="self::m:cos">
2756 <xsl:value-of select="'cos'"/>
2758 <xsl:when test="self::m:tan">
2759 <xsl:value-of select="'tan'"/>
2761 <xsl:when test="self::m:sec">
2762 <xsl:value-of select="'sec'"/>
2764 <xsl:when test="self::m:csc">
2765 <xsl:value-of select="'csc'"/>
2767 <xsl:when test="self::m:cot">
2768 <xsl:value-of select="'cot'"/>
2770 <xsl:when test="self::m:sinh">
2771 <xsl:value-of select="'sinh'"/>
2773 <xsl:when test="self::m:cosh">
2774 <xsl:value-of select="'cosh'"/>
2776 <xsl:when test="self::m:tanh">
2777 <xsl:value-of select="'tanh'"/>
2779 <xsl:when test="self::m:sech">
2780 <xsl:value-of select="'sech'"/>
2782 <xsl:when test="self::m:csch">
2783 <xsl:value-of select="'csch'"/>
2785 <xsl:when test="self::m:coth">
2786 <xsl:value-of select="'coth'"/>
2788 <xsl:when test="self::m:arcsin">
2789 <xsl:value-of select="'arcsin'"/>
2791 <xsl:when test="self::m:arccos">
2792 <xsl:value-of select="'arccos'"/>
2794 <xsl:when test="self::m:arctan">
2795 <xsl:value-of select="'arctan'"/>
2802 <!-- ***************** STATISTICS ***************** -->
2804 <xsl:template match = "m:apply[m:mean[1]]">
2805 <m:mfenced open="<" close=">" separators=",">
2806 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2807 <xsl:attribute name="m:xref">
2808 <xsl:value-of select="@id"/>
2811 <xsl:for-each select = "*[position()>1]">
2812 <xsl:apply-templates select = "." mode="semantics"/>
2817 <xsl:template match = "m:apply[m:sdev[1]]">
2819 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2820 <xsl:attribute name="m:xref">
2821 <xsl:value-of select="@id"/>
2825 <!-- HELM: added -->
2826 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2827 <xsl:attribute name="m:xref">
2828 <xsl:value-of select="m:sdev/@id"/>
2831 <m:mchar name="sigma"/> </m:mo>
2832 <m:mfenced separators=",">
2833 <xsl:for-each select = "*[position()>1]">
2834 <xsl:apply-templates select = "." mode="semantics"/>
2840 <xsl:template match = "m:apply[m:variance[1]]">
2842 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2843 <xsl:attribute name="m:xref">
2844 <xsl:value-of select="@id"/>
2848 <!-- HELM: added -->
2849 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2850 <xsl:attribute name="m:xref">
2851 <xsl:value-of select="m:variance/@id"/>
2854 <m:mchar name="sigma"/> </m:mo>
2856 <m:mfenced separators=",">
2857 <xsl:for-each select = "*[position()>1]">
2858 <xsl:apply-templates select = "." mode="semantics"/>
2866 <xsl:template match = "m:apply[m:median[1]]">
2868 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2869 <xsl:attribute name="m:xref">
2870 <xsl:value-of select="@id"/>
2874 <!-- HELM: added -->
2875 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2876 <xsl:attribute name="m:xref">
2877 <xsl:value-of select="m:median/@id"/>
2879 </xsl:if>median</m:mo>
2880 <m:mfenced separators=",">
2881 <xsl:for-each select = "*[position()>1]">
2882 <xsl:apply-templates select = "." mode="semantics"/>
2888 <xsl:template match = "m:apply[m:mode[1]]">
2890 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2891 <xsl:attribute name="m:xref">
2892 <xsl:value-of select="@id"/>
2896 <!-- HELM: added -->
2897 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2898 <xsl:attribute name="m:xref">
2899 <xsl:value-of select="m:mode/@id"/>
2901 </xsl:if>mode</m:mo>
2902 <m:mfenced separators=",">
2903 <xsl:for-each select = "*[position()>1]">
2904 <xsl:apply-templates select = "." mode="semantics"/>
2910 <xsl:template match = "m:apply[m:moment[1]]">
2911 <m:mfenced open="<" close=">" separators="">
2912 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2913 <xsl:attribute name="m:xref">
2914 <xsl:value-of select="@id"/>
2917 <xsl:if test="*[2]=m:degree">
2919 <xsl:apply-templates select="*[3]" mode = "semantics"/>
2920 <xsl:apply-templates select="*[2]" mode = "semantics"/>
2923 <xsl:if test="not(*[2]=m:degree)">
2924 <xsl:for-each select = "*[position()>1]">
2925 <xsl:apply-templates select = "." mode="semantics"/>
2932 <!-- ***************** LINEAR ALGEBRA ***************** -->
2934 <xsl:template match="m:vector">
2935 <m:mfenced separators="">
2936 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2937 <xsl:attribute name="m:xref">
2938 <xsl:value-of select="@id"/>
2942 <xsl:for-each select="*">
2944 <xsl:apply-templates select="." mode = "semantics"/>
2951 <xsl:template match = "m:matrix">
2952 <m:mfenced separators="">
2953 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2954 <xsl:attribute name="m:xref">
2955 <xsl:value-of select="@id"/>
2959 <xsl:apply-templates select="*" mode = "semantics"/>
2964 <xsl:template match = "m:matrixrow">
2966 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2967 <xsl:attribute name="m:xref">
2968 <xsl:value-of select="@id"/>
2971 <xsl:for-each select="*">
2973 <xsl:apply-templates select="." mode = "semantics"/>
2979 <xsl:template match = "m:apply[m:determinant[1]]">
2981 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2982 <xsl:attribute name="m:xref">
2983 <xsl:value-of select="@id"/>
2987 <!-- HELM: added -->
2988 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
2989 <xsl:attribute name="m:xref">
2990 <xsl:value-of select="m:determinant/@id"/>
2993 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
2997 <xsl:template match = "m:apply[m:transpose[1]]">
2999 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3000 <xsl:attribute name="m:xref">
3001 <xsl:value-of select="@id"/>
3004 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
3006 <!-- HELM: added -->
3007 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3008 <xsl:attribute name="m:xref">
3009 <xsl:value-of select="m:transpose/@id"/>
3015 <xsl:template match = "m:apply[m:selector[1]]">
3016 <xsl:if test="*[2]=m:matrix and *[3]=m:cn">
3017 <xsl:variable name="m" select = "*[3]"/>
3019 <xsl:when test="*[4]=m:cn">
3020 <xsl:variable name="n" select = "*[4]"/>
3021 <xsl:copy-of select = "m:matrix/*[position()=$m]/*[position()=$n]"/>
3024 <xsl:copy-of select = "m:matrix/*[position()=$m]"/>
3028 <xsl:if test="(*[2]=m:vector or *[2]=m:list) and *[3]=m:cn">
3029 <xsl:variable name="m" select = "*[3]"/>
3030 <xsl:copy-of select = "*[2]/*[position()=$m]"/>
3034 <xsl:template match = "m:apply[m:vectorproduct[1] |
3035 m:scalarproduct[1] | m:outerproduct[1]]">
3037 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3038 <xsl:attribute name="m:xref">
3039 <xsl:value-of select="@id"/>
3042 <xsl:apply-templates select="*[2]" mode = "semantics"/>
3044 <xsl:if test="m:vectorproduct[1]">
3045 <!-- HELM: added -->
3046 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3047 <xsl:attribute name="m:xref">
3048 <xsl:value-of select="m:vectorproduct/@id"/>
3051 <m:mchar name="Cross"/>
3053 <xsl:if test="m:scalarproduct[1] | m:outerproduct[1]">
3054 <!-- HELM: added -->
3055 <xsl:if test="($SEM_SW=$SEM_XREF or $SEM_SW=$SEM_XREF_EXT) and @id">
3056 <xsl:attribute name="m:xref">
3057 <xsl:value-of select="*[1]/@id"/>
3060 <xsl:value-of select="'.'"/>
3063 <xsl:apply-templates select="*[3]" mode = "semantics"/>