3 <!-- ====================================================== -->
4 <!-- XSL Transform of MathML content to MathML presentation -->
5 <!-- By Igor Rodionov, Computer Science Department of -->
6 <!-- the University of Western Ontario, London, Canada -->
7 <!-- Complies with the W3C Working Draft from Dec.3, 1999 -->
8 <!-- Version x.xx from Feb. 18, 2000 -->
9 <!-- Comments to: igor@csd.uwo.ca -->
11 <!-- (C) Copyright 1999, 2000 Symbolic Computation -->
12 <!-- Laboratory, University of Western Ontario. -->
13 <!-- ====================================================== -->
15 <!-- ====================================================== -->
16 <!-- May 11, 2000 - HELM group: -->
17 <!-- Added the namespace prefix to all the output elements -->
18 <!-- Changed the mml prefix into m -->
19 <!-- Swapped math element out of the semantic element -->
20 <!-- Added the declaration of the xlink namespace -->
21 <!-- ====================================================== -->
23 <!-- ====================================================== -->
24 <!-- June, 2000 - HELM group: -->
25 <!-- Added auxiliary function to inser: -->
26 <!-- 1) backwards pointers: helm:xref -->
27 <!-- 2) references to definitions: xlink:href -->
28 <!-- Added call-templates to the functions: -->
29 <!-- insert_xref, insert, insert1, insert2 -->
30 <!-- ====================================================== -->
33 <!-- HELM: namespace helm added -->
34 <xsl:stylesheet id="mml2mml"
36 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
37 xmlns:m="http://www.w3.org/1998/Math/MathML"
38 xmlns:xlink="http://www.w3.org/1999/xlink"
39 xmlns:helm="http://www.cs.unibo.it/helm">
41 <xsl:output method="xml" indent="yes" encoding="iso-8859-1"/>
43 <!-- ***************************************************** -->
44 <!-- Parameters affectin' stylesheet's run-time behavior -->
45 <!-- ***************************************************** -->
47 <!-- SEM_SW: -1 - strip off all semantics
48 0 - pass semantics "as is" (default)
49 1 - add semantics at top level only
50 2 - add semantics at all levels
51 3 - semantics at top level with cross-references
53 <!-- HELM: SEM_SW was 0 -->
54 <xsl:param name="SEM_SW" select="1"/>
56 <!-- Miscellaneous Variable Definitions -->
58 <xsl:variable name="NO" select="0"/>
59 <xsl:variable name="YES" select="1"/>
60 <xsl:variable name="PAR_NO" select="-7"/>
61 <xsl:variable name="PAR_YES" select="-5"/>
62 <xsl:variable name="PAR_SAME" select="-3"/>
63 <xsl:variable name="NO_PARAM" select="-1"/>
65 <!-- Operator Precedence Definitions -->
67 <xsl:variable name="NO_PREC" select="0"/>
68 <xsl:variable name="UNION_PREC" select="1"/>
69 <xsl:variable name="SETDIFF_PREC" select="1"/>
70 <xsl:variable name="INTERSECT_PREC" select="3"/>
71 <xsl:variable name="OR_PREC" select="5"/>
72 <xsl:variable name="XOR_PREC" select="5"/>
73 <xsl:variable name="AND_PREC" select="7"/>
74 <xsl:variable name="PLUS_PREC" select="9"/>
75 <xsl:variable name="MINUS_PREC" select="9"/>
76 <xsl:variable name="MUL_PREC" select="11"/>
77 <xsl:variable name="DIV_PREC" select="11"/>
78 <xsl:variable name="NEG_PREC" select="13"/>
79 <xsl:variable name="FUNCTION_PREC" select="99"/>
81 <!-- HELM: auxiliary functions for backwards pointers and refs -->
83 <xsl:template name = "insert_xref">
84 <xsl:if test="@helm:xref">
85 <xsl:attribute name="helm:xref">
86 <xsl:value-of select="@helm:xref"/>
91 <xsl:template name = "insert">
92 <xsl:if test="@definitionURL">
93 <xsl:attribute name="xlink:href">
94 <xsl:value-of select="@definitionURL"/>
97 <xsl:if test="@helm:xref">
98 <xsl:attribute name="helm:xref">
99 <xsl:value-of select="@helm:xref"/>
104 <!-- HELM: for use inside m:apply -->
105 <xsl:template name = "insert1">
106 <xsl:if test="*[1]/@definitionURL">
107 <xsl:attribute name="xlink:href">
108 <xsl:value-of select="*[1]/@definitionURL"/>
111 <xsl:if test="*[1]/@helm:xref">
112 <xsl:attribute name="helm:xref">
113 <xsl:value-of select="*[1]/@helm:xref"/>
118 <!-- HELM: for use inside "for-each" -->
119 <xsl:template name = "insert2">
120 <xsl:if test="../*[1]/@definitionURL">
121 <xsl:attribute name="xlink:href">
122 <xsl:value-of select="../*[1]/@definitionURL"/>
125 <xsl:if test="../*[1]/@helm:xref">
126 <xsl:attribute name="helm:xref">
127 <xsl:value-of select="../*[1]/@helm:xref"/>
132 <!-- THE TOPMOST ELEMENT: MATH -->
134 <xsl:template match = "m:math">
136 <xsl:when test="$SEM_SW>0">
137 <!-- HELM: deleted math (we have already inserted at object level) -->
140 <xsl:apply-templates mode = "semantics"/>
141 <m:annotation-xml encoding="MathML">
142 <xsl:copy-of select = "*"/>
149 <xsl:apply-templates mode = "semantics"/>
157 <xsl:template match = "m:*" mode = "semantics">
158 <xsl:param name="IN_PREC" select="$NO_PREC"/>
159 <xsl:param name="PARAM" select="$NO_PARAM"/>
160 <xsl:param name="PAREN" select="$PAR_NO"/>
161 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
163 <xsl:when test="$SEM_SW=-1 and self::m:semantics">
164 <xsl:apply-templates select="*[1]">
165 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
166 <xsl:with-param name="PARAM" select="$PARAM"/>
167 <xsl:with-param name="PAREN" select="$PAREN"/>
168 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
169 </xsl:apply-templates>
171 <xsl:when test="$SEM_SW=0 and self::m:semantics">
173 <xsl:apply-templates select="*[1]">
174 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
175 <xsl:with-param name="PARAM" select="$PARAM"/>
176 <xsl:with-param name="PAREN" select="$PAREN"/>
177 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
178 </xsl:apply-templates>
179 <xsl:copy-of select="m:annotation-xml"/>
182 <xsl:when test="$SEM_SW=2">
185 <xsl:when test="self::m:semantics">
186 <xsl:apply-templates select="*[1]">
187 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
188 <xsl:with-param name="PARAM" select="$PARAM"/>
189 <xsl:with-param name="PAREN" select="$PAREN"/>
190 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
191 </xsl:apply-templates>
192 <xsl:copy-of select="m:annotation-xml"/>
195 <xsl:apply-templates select=".">
196 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
197 <xsl:with-param name="PARAM" select="$PARAM"/>
198 <xsl:with-param name="PAREN" select="$PAREN"/>
199 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
200 </xsl:apply-templates>
201 <m:annotation-xml encoding="MathML">
202 <xsl:copy-of select="."/>
208 <xsl:when test="$SEM_SW=3 and @id">
209 <m:mrow idref="{@id}">
210 <xsl:apply-templates select=".">
211 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
212 <xsl:with-param name="PARAM" select="$PARAM"/>
213 <xsl:with-param name="PAREN" select="$PAREN"/>
214 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
215 </xsl:apply-templates>
219 <xsl:apply-templates select=".">
220 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
221 <xsl:with-param name="PARAM" select="$PARAM"/>
222 <xsl:with-param name="PAREN" select="$PAREN"/>
223 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
224 </xsl:apply-templates>
229 <xsl:template match = "m:semantics">
230 <xsl:apply-templates select="*[1]" mode = "semantics"/>
234 <!-- BASIC ELEMENTS -->
236 <xsl:template match = "m:cn">
237 <xsl:param name="IN_PREC" select="$NO_PREC"/>
238 <xsl:param name="PAREN" select="$PAR_NO"/>
239 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
241 <xsl:when test=". < 0 and $IN_PREC > 0 and $PAREN=$PAR_NO and $PAR_NO_IGNORE=$NO">
242 <m:mfenced separators="">
243 <xsl:apply-templates select="." mode="cn"/>
247 <xsl:apply-templates select="." mode="cn"/>
252 <xsl:template match = "m:cn" mode="cn">
254 <xsl:when test="@base and (not(@type) or @type='integer' or @type='real')">
256 <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
257 <m:mn> <xsl:value-of select="@base"/> </m:mn>
260 <xsl:when test="@type='complex' and not(@base) and child::m:sep[1]">
261 <m:mfenced separators="">
262 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
263 <xsl:if test="text()[2] < 0">
265 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
267 <xsl:if test="not(text()[2] < 0)">
269 <xsl:apply-templates select="text()[2]" mode = "semantics"/>
271 <m:mo> <mchar name="InvisibleTimes"/> </m:mo>
275 <xsl:when test="@type='complex' and @base and child::m:sep[1]">
277 <m:mfenced separators="">
278 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
279 <xsl:if test="text()[2] < 0">
281 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
283 <xsl:if test="not(text()[2] < 0)">
285 <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
287 <m:mo> <mchar name="InvisibleTimes"/> </m:mo>
290 <m:mn> <xsl:value-of select="@base"/> </m:mn>
293 <xsl:when test="@type='rational' and not(@base) and child::m:sep[1]">
295 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
297 <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
300 <xsl:when test="@type='rational' and @base and child::m:sep[1]">
302 <m:mfenced separators="">
303 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
305 <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
307 <m:mn> <xsl:value-of select="@base"/> </m:mn>
310 <xsl:when test="@type='polar' and not(@base) and child::m:sep[1]">
313 <m:mfenced separators=",">
314 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
315 <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
319 <xsl:when test="@type='polar' and @base and child::m:sep[1]">
323 <m:mfenced separators=",">
324 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
325 <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
328 <m:mn> <xsl:value-of select="@base"/> </m:mn>
333 <xsl:call-template name="insert"/>
334 <xsl:apply-templates mode = "semantics"/>
340 <xsl:template match = "m:ci">
342 <xsl:when test="@type='vector' or @type=matrix or @type=set">
343 <m:mi fontweight="bold"> <xsl:apply-templates mode = "semantics"/> </m:mi>
347 <xsl:call-template name="insert"/>
348 <xsl:apply-templates mode = "semantics"/>
354 <xsl:template match = "m:csymbol">
356 <xsl:when test="*[1]">
357 <xsl:copy-of select = "*"/>
360 <m:mo> <xsl:apply-templates mode = "semantics"/> </m:mo>
366 <!-- BASIC CONTENT ELEMENTS -->
368 <xsl:template match = "m:apply[m:fn[1]]">
370 <xsl:apply-templates select = "m:fn[1]" mode = "semantics"/>
371 <m:mfenced separators=",">
372 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
377 <xsl:template match = "m:fn">
378 <xsl:apply-templates select = "*[1]" mode = "semantics">
379 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
380 </xsl:apply-templates>
383 <xsl:template match = "m:interval">
385 <xsl:when test="@closure='closed'">
386 <m:mfenced open="[" close="]" separators=",">
387 <xsl:apply-templates mode = "semantics"/>
390 <xsl:when test="@closure='open'">
391 <m:mfenced separators=",">
392 <xsl:apply-templates mode = "semantics"/>
395 <xsl:when test="@closure='open-closed'">
396 <m:mfenced open="(" close="]" separators=",">
397 <xsl:apply-templates mode = "semantics"/>
400 <xsl:when test="@closure='closed-open'">
401 <m:mfenced open="[" close=")" separators=",">
402 <xsl:apply-templates mode = "semantics"/>
406 <m:mfenced open="[" close="]" separators=",">
407 <xsl:apply-templates mode = "semantics"/>
413 <xsl:template match = "m:apply[m:*[1][self::m:apply[m:inverse[1]]]]">
415 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
416 <m:mfenced separators=",">
417 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
422 <!-- HELM: these "semantical" Transformations are REALLY questionable.
425 <xsl:template match = "m:apply[*[1][self::m:inverse]]">
427 <xsl:when test="*[2]=m:exp">
430 <xsl:when test="*[2]=m:ln | m:log">
433 <xsl:when test="*[2]=m:sin">
436 <xsl:when test="*[2]=m:cos">
439 <xsl:when test="*[2]=m:tan">
442 <xsl:when test="*[2]=m:sec">
445 <xsl:when test="*[2]=m:csc">
448 <xsl:when test="*[2]=m:cot">
451 <xsl:when test="*[2]=m:sinh">
454 <xsl:when test="*[2]=m:cosh">
457 <xsl:when test="*[2]=m:tanh">
460 <xsl:when test="*[2]=m:sech">
463 <xsl:when test="*[2]=m:csch">
466 <xsl:when test="*[2]=m:coth">
469 <xsl:when test="*[2]=m:arcsin">
472 <xsl:when test="*[2]=m:arccos">
475 <xsl:when test="*[2]=m:arctan">
480 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
489 <xsl:template match = "m:sep"/>
491 <xsl:template match = "m:condition">
493 <xsl:when test="parent::m:apply[m:forall[1]]"/>
495 <xsl:if test="not(*[2])">
496 <xsl:apply-templates mode = "semantics"/>
500 <xsl:apply-templates mode = "semantics"/>
507 <xsl:template match = "m:declare"/>
509 <xsl:template match = "m:lambda">
511 <m:mo> Λ </m:mo>
512 <m:mfenced separators=",">
513 <xsl:for-each select = "*">
515 <xsl:when test="self::m:ci or self::m:cn">
516 <xsl:apply-templates select = "." mode="semantics"/>
520 <xsl:apply-templates select = "." mode="semantics"/>
529 <xsl:template match = "m:apply[m:*[1][self::m:apply[m:compose[1]]]]">
531 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
532 <m:mfenced separators=",">
533 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
538 <xsl:template match = "m:apply[*[1][self::m:compose]]">
539 <m:mfenced separators="">
540 <xsl:apply-templates select = "m:*[2][self::m:ci[@type='fn'] | self::m:fn]" mode="semantics"/>
541 <xsl:for-each select = "m:*[position()>2][self::m:ci[@type='fn'] | self::m:fn]">
542 <m:mo> <xsl:call-template name="insert2"/> <mchar name="SmallCircle"/> </m:mo>
543 <xsl:apply-templates select = "." mode="semantics"/>
548 <xsl:template match = "m:ident">
553 <!-- ARITHMETIC, ALGEBRA & LOGIC -->
555 <xsl:template match = "m:apply[m:quotient[1]]">
556 <m:mfenced open="⌊" close="⌋" separators="">
557 <xsl:call-template name="insert_xref"/>
558 <xsl:apply-templates select="*[2]" mode = "semantics">
559 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
560 </xsl:apply-templates>
561 <m:mo><xsl:call-template name="insert1"/>/</m:mo>
562 <xsl:apply-templates select="*[3]" mode = "semantics">
563 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
564 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
565 </xsl:apply-templates>
569 <xsl:template match = "m:apply[*[1][self::m:exp]]">
572 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
576 <xsl:template match = "m:apply[m:factorial[1]]">
578 <xsl:call-template name="insert_xref"/>
579 <xsl:apply-templates select = "*[2]" mode = "semantics">
580 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
581 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
582 </xsl:apply-templates>
583 <m:mo><xsl:call-template name="insert1"/>!</m:mo>
587 <xsl:template match = "m:apply[m:max[1] | m:min[1]]">
589 <xsl:call-template name="insert_xref"/>
590 <xsl:if test="*[2]=m:bvar">
592 <xsl:if test="*[1]=m:max">
593 <m:mo><xsl:call-template name="insert1"/>max</m:mo>
595 <xsl:if test="*[1]=m:min">
598 <xsl:apply-templates select="*[2]" mode = "semantics"/>
600 <xsl:if test="*[3]=m:condition">
601 <m:mfenced open="{{" close="}}" separators="">
602 <m:mfenced open="" close="" separators=",">
603 <xsl:for-each select = "*[position()>3]">
604 <xsl:apply-templates select = "." mode="semantics"/>
608 <xsl:apply-templates select="*[3]" mode = "semantics"/>
611 <xsl:if test="not(*[3]=m:condition)">
612 <m:mfenced open="{{" close="}}" separators=",">
613 <xsl:for-each select = "*[position()>2]">
614 <xsl:apply-templates select = "." mode="semantics"/>
619 <xsl:if test="*[2]=m:condition">
620 <xsl:if test="*[1]=m:max">
623 <xsl:if test="*[1]=m:min">
626 <m:mfenced open="{{" close="}}" separators="">
628 <m:mfenced open="" close="" separators=",">
629 <xsl:for-each select = "*[position()>2]">
630 <xsl:apply-templates select = "." mode="semantics"/>
635 <xsl:apply-templates select="*[2]" mode = "semantics"/>
638 <xsl:if test="not(*[2]=m:condition) and not(*[2]=m:bvar)">
639 <xsl:if test="*[1]=m:max">
642 <xsl:if test="*[1]=m:min">
643 <m:mo><xsl:call-template name="insert1"/>min</m:mo>
645 <m:mfenced open="{{" close="}}" separators=",">
646 <xsl:for-each select = "*[position()>1]">
647 <xsl:apply-templates select = "." mode="semantics"/>
654 <xsl:template match = "m:apply[m:minus[1]]">
655 <xsl:param name="IN_PREC" select="$NO_PREC"/>
656 <xsl:param name="PARAM" select="$NO_PARAM"/>
657 <xsl:param name="PAREN" select="$PAR_NO"/>
658 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
660 <xsl:when test="$IN_PREC > $MINUS_PREC or $IN_PREC=$MINUS_PREC and $PARAM=$PAR_SAME">
661 <m:mfenced separators="">
662 <xsl:call-template name="insert_xref"/>
663 <xsl:apply-templates select="." mode="minus">
664 <xsl:with-param name="PARAM" select="$PARAM"/>
665 <xsl:with-param name="PAREN" select="$PAR_YES"/>
666 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
667 </xsl:apply-templates>
670 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
671 <xsl:apply-templates select="." mode="minus">
672 <xsl:with-param name="PARAM" select="$PARAM"/>
673 <xsl:with-param name="PAREN" select="$PAREN"/>
674 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
675 </xsl:apply-templates>
679 <xsl:call-template name="insert_xref"/>
680 <xsl:apply-templates select="." mode="minus">
681 <xsl:with-param name="PARAM" select="$PARAM"/>
682 <xsl:with-param name="PAREN" select="$PAREN"/>
683 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
684 </xsl:apply-templates>
690 <xsl:template match = "m:apply[m:minus[1]]" mode="minus">
691 <xsl:param name="PARAM" select="$NO_PARAM"/>
692 <xsl:param name="PAREN" select="$PAR_NO"/>
693 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
694 <xsl:if test="not(*[3])">
695 <m:mo><xsl:call-template name="insert1"/>-</m:mo>
696 <xsl:apply-templates select="*[2]" mode = "semantics">
697 <xsl:with-param name="IN_PREC" select="$NEG_PREC"/>
698 <xsl:with-param name="PAREN" select="$PAREN"/>
699 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
700 </xsl:apply-templates>
703 <xsl:apply-templates select="*[2]" mode = "semantics">
704 <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
705 <xsl:with-param name="PARAM" select="$PARAM"/>
706 <xsl:with-param name="PAREN" select="$PAREN"/>
707 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
708 </xsl:apply-templates>
709 <m:mo><xsl:call-template name="insert1"/>-</m:mo>
710 <xsl:apply-templates select="*[3]" mode = "semantics">
711 <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
712 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
713 <xsl:with-param name="PAREN" select="$PAREN"/>
714 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
715 </xsl:apply-templates>
719 <xsl:template match = "m:apply[m:plus[1]]">
720 <xsl:param name="IN_PREC" select="$NO_PREC"/>
721 <xsl:param name="PARAM" select="$NO_PARAM"/>
722 <xsl:param name="PAREN" select="$PAR_NO"/>
723 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
725 <xsl:when test="$IN_PREC > $PLUS_PREC or $IN_PREC=$PLUS_PREC and $PARAM=$PAR_SAME">
726 <m:mfenced separators="">
727 <xsl:call-template name="insert_xref"/>
728 <xsl:apply-templates select="." mode="plus">
729 <xsl:with-param name="PARAM" select="$IN_PREC"/>
730 <xsl:with-param name="PAREN" select="$PAR_YES"/>
731 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
732 </xsl:apply-templates>
735 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
736 <xsl:apply-templates select="." mode="plus">
737 <xsl:with-param name="PARAM" select="$PARAM"/>
738 <xsl:with-param name="PAREN" select="$PAREN"/>
739 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
740 </xsl:apply-templates>
744 <xsl:call-template name="insert_xref"/>
745 <xsl:apply-templates select="." mode="plus">
746 <xsl:with-param name="PARAM" select="$IN_PREC"/>
747 <xsl:with-param name="PAREN" select="$PAREN"/>
748 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
749 </xsl:apply-templates>
755 <xsl:template match = "m:apply[m:plus[1]]" mode="plus">
756 <xsl:param name="PARAM" select="$NO_PARAM"/>
757 <xsl:param name="PAREN" select="$PAR_NO"/>
758 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
760 <xsl:apply-templates select="*[2]" mode = "semantics">
761 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
762 <xsl:with-param name="PARAM" select="$PARAM"/>
763 <xsl:with-param name="PAREN" select="$PAREN"/>
764 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
765 </xsl:apply-templates>
766 <xsl:for-each select = "*[position()>2]">
768 <xsl:when test=". < 0">
770 <m:mn> <xsl:value-of select="-."/> </m:mn>
772 <xsl:when test="self::m:apply[m:minus[1]] and not(*[3])">
773 <xsl:apply-templates select="." mode = "semantics">
774 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
775 <xsl:with-param name="PAREN" select="$PAREN"/>
776 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
777 </xsl:apply-templates>
780 <m:mo><xsl:call-template name="insert2"/>+</m:mo>
781 <xsl:apply-templates select="." mode = "semantics">
782 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
783 <xsl:with-param name="PAREN" select="$PAREN"/>
784 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
785 </xsl:apply-templates>
792 <xsl:template match = "m:apply[m:power[1]]">
794 <xsl:when test="*[2]=m:apply[m:ln[1] | m:log[1] | m:abs[1] | m:gcd[1] | m:sin[1] | m:cos[1] | m:tan[1] | m:sec[1] | m:csc[1] | m:cot[1] | m:sinh[1] | m:cosh[1] | m:tanh[1] | m:sech[1] | m:csch[1] | m:coth[1] | m:arcsin[1] | m:arccos[1] | m:arctan[1]]">
795 <xsl:apply-templates select="*[2]" mode = "semantics"/>
799 <xsl:apply-templates select = "*[2]" mode = "semantics">
800 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
801 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
802 </xsl:apply-templates>
803 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
809 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]">
810 <xsl:param name="IN_PREC" select="$NO_PREC"/>
811 <xsl:param name="PARAM" select="$NO_PARAM"/>
812 <xsl:param name="PAREN" select="$PAR_NO"/>
813 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
815 <xsl:when test="$IN_PREC > $DIV_PREC or $IN_PREC=$DIV_PREC and $PARAM=$PAR_SAME">
816 <m:mfenced separators="">
817 <xsl:call-template name="insert_xref"/>
818 <xsl:apply-templates select="." mode="remdiv">
819 <xsl:with-param name="PARAM" select="$IN_PREC"/>
820 <xsl:with-param name="PAREN" select="$PAR_YES"/>
821 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
822 </xsl:apply-templates>
825 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
826 <xsl:apply-templates select="." mode="remdiv">
827 <xsl:with-param name="PARAM" select="$PARAM"/>
828 <xsl:with-param name="PAREN" select="$PAREN"/>
829 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
830 </xsl:apply-templates>
834 <xsl:call-template name="insert_xref"/>
835 <xsl:apply-templates select="." mode="remdiv">
836 <xsl:with-param name="PARAM" select="$IN_PREC"/>
837 <xsl:with-param name="PAREN" select="$PAREN"/>
838 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
839 </xsl:apply-templates>
845 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]" mode="remdiv">
846 <xsl:param name="PARAM" select="$NO_PARAM"/>
847 <xsl:param name="PAREN" select="$PAR_NO"/>
848 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
849 <xsl:apply-templates select = "*[2]" mode = "semantics">
850 <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
851 <xsl:with-param name="PARAM" select="$PARAM"/>
852 <xsl:with-param name="PAREN" select="$PAREN"/>
853 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
854 </xsl:apply-templates>
855 <xsl:if test="m:rem">
856 <m:mo><xsl:call-template name="insert1"/>%</m:mo>
858 <xsl:if test="m:divide">
859 <m:mo><xsl:call-template name="insert1"/>/</m:mo>
861 <xsl:apply-templates select = "*[3]" mode = "semantics">
862 <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
863 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
864 <xsl:with-param name="PAREN" select="$PAREN"/>
865 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
866 </xsl:apply-templates>
869 <xsl:template match = "m:apply[m:times[1]]">
870 <xsl:param name="IN_PREC" select="$NO_PREC"/>
871 <xsl:param name="PARAM" select="$NO_PARAM"/>
872 <xsl:param name="PAREN" select="$PAR_NO"/>
873 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
875 <xsl:when test="$IN_PREC > $MUL_PREC or $IN_PREC=$MUL_PREC and $PARAM=$PAR_SAME">
876 <m:mfenced separators="">
877 <xsl:call-template name="insert_xref"/>
878 <xsl:apply-templates select="." mode="times">
879 <xsl:with-param name="PARAM" select="$IN_PREC"/>
880 <xsl:with-param name="PAREN" select="$PAR_YES"/>
881 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
882 </xsl:apply-templates>
885 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
886 <xsl:apply-templates select="." mode="times">
887 <xsl:with-param name="PARAM" select="$PARAM"/>
888 <xsl:with-param name="PAREN" select="$PAREN"/>
889 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
890 </xsl:apply-templates>
894 <xsl:call-template name="insert_xref"/>
895 <xsl:apply-templates select="." mode="times">
896 <xsl:with-param name="PARAM" select="$IN_PREC"/>
897 <xsl:with-param name="PAREN" select="$PAREN"/>
898 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
899 </xsl:apply-templates>
905 <xsl:template match = "m:apply[m:times[1]]" mode="times">
906 <xsl:param name="PARAM" select="$NO_PARAM"/>
907 <xsl:param name="PAREN" select="$PAR_NO"/>
908 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
909 <xsl:apply-templates select="*[2]" mode = "semantics">
910 <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
911 <xsl:with-param name="PARAM" select="$PARAM"/>
912 <xsl:with-param name="PAREN" select="$PAREN"/>
913 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
914 </xsl:apply-templates>
916 <xsl:for-each select = "*[position()>2]">
917 <!-- HELM: MODIFICA PROVVISORIA -->
918 <!-- <m:mo><xsl:call-template name="insert2"/>
919 <mchar name="InvisibleTimes"/> </m:mo> -->
920 <m:mo><xsl:call-template name="insert2"/>*</m:mo>
921 <xsl:apply-templates select="." mode = "semantics">
922 <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
923 <xsl:with-param name="PAREN" select="$PAREN"/>
924 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
925 </xsl:apply-templates>
930 <!-- HELM: COMMENTO : dove metto la uri della definizione di radice ???? -->
932 <xsl:template match = "m:apply[m:root[1]]">
934 <xsl:call-template name="insert_xref"/>
935 <xsl:if test="*[2]=m:degree">
936 <xsl:apply-templates select="*[3]" mode = "semantics"/>
937 <xsl:apply-templates select="*[2]" mode = "semantics"/>
939 <xsl:if test="not(*[2]=m:degree)">
940 <xsl:apply-templates select="*[2]" mode = "semantics"/>
946 <xsl:template match = "m:apply[m:gcd[1]]">
948 <xsl:call-template name="insert_xref"/>
949 <xsl:if test="not(parent::m:apply[m:power[1]])">
950 <m:mo><xsl:call-template name="insert1"/>gcd</m:mo>
952 <xsl:if test="parent::m:apply[m:power[1]]">
954 <m:mo><xsl:call-template name="insert1"/>gcd</m:mo>
955 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
958 <m:mfenced separators=",">
959 <xsl:for-each select = "*[position()>1]">
960 <xsl:apply-templates select = "." mode="semantics"/>
966 <xsl:template match = "m:apply[m:and[1]]">
967 <xsl:param name="IN_PREC" select="$NO_PREC"/>
968 <xsl:param name="PAREN" select="$PAR_NO"/>
969 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
971 <xsl:when test="$IN_PREC > $AND_PREC">
972 <m:mfenced separators="">
973 <xsl:call-template name="insert_xref"/>
974 <xsl:apply-templates select="." mode="and">
975 <xsl:with-param name="PARAM" select="$IN_PREC"/>
976 <xsl:with-param name="PAREN" select="$PAR_YES"/>
977 </xsl:apply-templates>
980 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
981 <xsl:apply-templates select="." mode="and">
982 <xsl:with-param name="PARAM" select="$IN_PREC"/>
983 <xsl:with-param name="PAREN" select="$PAREN"/>
984 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
985 </xsl:apply-templates>
989 <xsl:call-template name="insert_xref"/>
990 <xsl:apply-templates select="." mode="and">
991 <xsl:with-param name="PARAM" select="$IN_PREC"/>
992 <xsl:with-param name="PAREN" select="$PAREN"/>
993 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
994 </xsl:apply-templates>
1000 <xsl:template match = "m:apply[m:and[1]]" mode="and">
1001 <xsl:param name="PARAM" select="$NO_PARAM"/>
1002 <xsl:param name="PAREN" select="$PAR_NO"/>
1003 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1004 <xsl:apply-templates select="*[2]" mode = "semantics">
1005 <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
1006 <xsl:with-param name="PARAM" select="$PARAM"/>
1007 <xsl:with-param name="PAREN" select="$PAREN"/>
1008 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1009 </xsl:apply-templates>
1010 <xsl:for-each select = "*[position()>2]">
1011 <m:mo><xsl:call-template name="insert2"/> <mchar name="wedge"/> </m:mo>
1012 <xsl:apply-templates select="." mode = "semantics">
1013 <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
1014 <xsl:with-param name="PAREN" select="$PAREN"/>
1015 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1016 </xsl:apply-templates>
1020 <xsl:template match = "m:apply[m:or[1]]">
1021 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1022 <xsl:param name="PAREN" select="$PAR_NO"/>
1023 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1025 <xsl:when test="$IN_PREC > $OR_PREC">
1026 <m:mfenced separators="">
1027 <xsl:call-template name="insert_xref"/>
1028 <xsl:apply-templates select="." mode="or">
1029 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1030 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1031 </xsl:apply-templates>
1034 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1035 <xsl:apply-templates select="." mode="or">
1036 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1037 <xsl:with-param name="PAREN" select="$PAREN"/>
1038 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1039 </xsl:apply-templates>
1043 <xsl:call-template name="insert_xref"/>
1044 <xsl:apply-templates select="." mode="or">
1045 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1046 <xsl:with-param name="PAREN" select="$PAREN"/>
1047 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1048 </xsl:apply-templates>
1054 <xsl:template match = "m:apply[m:or[1]]" mode="or">
1055 <xsl:param name="PARAM" select="$NO_PARAM"/>
1056 <xsl:param name="PAREN" select="$PAR_NO"/>
1057 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1058 <xsl:apply-templates select="*[2]" mode = "semantics">
1059 <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1060 <xsl:with-param name="PARAM" select="$PARAM"/>
1061 <xsl:with-param name="PAREN" select="$PAREN"/>
1062 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1063 </xsl:apply-templates>
1064 <xsl:for-each select = "*[position()>2]">
1065 <m:mo><xsl:call-template name="insert2"/> <mchar name="vee"/> </m:mo>
1066 <xsl:apply-templates select="." mode = "semantics">
1067 <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1068 <xsl:with-param name="PAREN" select="$PAREN"/>
1069 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1070 </xsl:apply-templates>
1074 <xsl:template match = "m:apply[m:xor[1]]">
1075 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1076 <xsl:param name="PAREN" select="$PAR_NO"/>
1077 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1079 <xsl:when test="$IN_PREC > $XOR_PREC">
1080 <m:mfenced separators="">
1081 <xsl:call-template name="insert_xref"/>
1082 <xsl:apply-templates select="." mode="xor">
1083 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1084 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1085 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1086 </xsl:apply-templates>
1089 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1090 <xsl:apply-templates select="." mode="xor">
1091 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1092 <xsl:with-param name="PAREN" select="$PAREN"/>
1093 </xsl:apply-templates>
1097 <xsl:call-template name="insert_xref"/>
1098 <xsl:apply-templates select="." mode="xor">
1099 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1100 <xsl:with-param name="PAREN" select="$PAREN"/>
1101 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1102 </xsl:apply-templates>
1108 <xsl:template match = "m:apply[m:xor[1]]" mode="xor">
1109 <xsl:param name="PARAM" select="$NO_PARAM"/>
1110 <xsl:param name="PAREN" select="$PAR_NO"/>
1111 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1112 <xsl:apply-templates select="*[2]" mode = "semantics">
1113 <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1114 <xsl:with-param name="PARAM" select="$PARAM"/>
1115 <xsl:with-param name="PAREN" select="$PAREN"/>
1116 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1117 </xsl:apply-templates>
1118 <xsl:for-each select = "*[position()>2]">
1119 <m:mo><xsl:call-template name="insert2"/> <mchar name="xor"/> </m:mo>
1120 <xsl:apply-templates select="." mode = "semantics">
1121 <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1122 <xsl:with-param name="PAREN" select="$PAREN"/>
1123 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1124 </xsl:apply-templates>
1128 <xsl:template match = "m:apply[m:not[1]]">
1130 <xsl:call-template name="insert_xref"/>
1131 <m:mo><xsl:call-template name="insert1"/>not</m:mo>
1132 <xsl:apply-templates select = "*[2]" mode = "semantics">
1133 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1134 </xsl:apply-templates>
1138 <xsl:template match = "m:apply[m:forall[1]]">
1140 <xsl:call-template name="insert_xref"/>
1141 <m:mo><xsl:call-template name="insert1"/>for all</m:mo>
1142 <m:mfenced separators=",">
1143 <xsl:for-each select = "m:bvar">
1144 <xsl:apply-templates select = "." mode="semantics"/>
1147 <xsl:if test="m:condition">
1149 <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1152 <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and not(self::m:condition)]" mode = "semantics"/>
1156 <xsl:template match = "m:apply[m:exists[1]]">
1158 <xsl:call-template name="insert_xref"/>
1159 <m:mo><xsl:call-template name="insert1"/> <mchar name="Exists"/> </m:mo>
1160 <m:mfenced separators=",">
1161 <xsl:for-each select = "m:bvar">
1162 <xsl:apply-templates select = "." mode="semantics"/>
1165 <xsl:if test="m:condition">
1167 <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1170 <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and not(self::m:condition)]" mode = "semantics"/>
1174 <xsl:template match = "m:apply[m:abs[1]]">
1175 <xsl:if test="not(parent::m:apply[m:power[1]])">
1176 <m:mfenced open="|" close="|" separators="">
1177 <xsl:call-template name="insert_xref"/>
1178 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1181 <xsl:if test="parent::m:apply[m:power[1]]">
1183 <m:mfenced open="|" close="|" separators="">
1184 <xsl:call-template name="insert_xref"/>
1185 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1187 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1192 <xsl:template match = "m:apply[m:conjugate[1]]">
1195 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1197 <m:mo><xsl:call-template name="insert1"/> <mchar name="UnderBar"/> </m:mo>
1201 <xsl:template match = "m:apply[m:arg[1] | m:real[1] | m:imaginary[1]]">
1203 <xsl:call-template name="insert_xref"/>
1205 <xsl:when test="m:arg">
1206 <m:mo><xsl:call-template name="insert1"/>arg</m:mo>
1208 <xsl:when test="m:real">
1209 <m:mo><xsl:call-template name="insert1"/>Real</m:mo>
1211 <xsl:when test="m:imaginary">
1212 <m:mo><xsl:call-template name="insert1"/>Imaginary</m:mo>
1215 <m:mfenced separators="">
1216 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1224 <xsl:template match = "m:apply[m:neq | m:approx | m:tendsto | m:implies | m:in | m:notin | m:notsubset | m:notprsubset | m:subset | m:prsubset | m:eq | m:gt | m:lt | m:geq | m:leq | m:equivalent]">
1226 <xsl:call-template name="insert_xref"/>
1227 <xsl:if test="*[1]=m:neq or *[1]=m:approx or *[1]=m:tendsto or *[1]=m:implies or *[1]=m:in or *[1]=m:notin or *[1]=m:notsubset or *[1]=m:notprsubset">
1228 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1229 <xsl:if test="*[1]=m:neq">
1230 <m:mo><xsl:call-template name="insert1"/> <mchar name="NotEqual"/> </m:mo>
1232 <xsl:if test="*[1]=m:approx">
1233 <m:mo><xsl:call-template name="insert1"/> <mchar name="approxeq"/> </m:mo>
1235 <xsl:if test="*[1]=m:tendsto">
1236 <m:mo><xsl:call-template name="insert1"/> <mchar name="RightArrow"/> </m:mo>
1238 <xsl:if test="*[1]=m:implies">
1239 <m:mo><xsl:call-template name="insert1"/> <mchar name="DoubleRightArrow"/> </m:mo>
1241 <xsl:if test="*[1]=m:in">
1242 <m:mo><xsl:call-template name="insert1"/>
1243 <mchar name="Element"/>
1246 <xsl:if test="*[1]=m:notin">
1247 <m:mo><xsl:call-template name="insert1"/> <mchar name="NotElement"/> </m:mo>
1249 <xsl:if test="*[1]=m:notsubset">
1250 <m:mo> <xsl:call-template name="insert1"/> <mchar name="NotSubset"/> </m:mo>
1252 <xsl:if test="*[1]=m:notprsubset">
1253 <m:mo> <xsl:call-template name="insert1"/> <mchar name="NotSubsetEqual"/> </m:mo>
1255 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1256 <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='below']">
1257 <m:mo><xsl:call-template name="insert1"/>-</m:mo>
1259 <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='above']">
1260 <m:mo><xsl:call-template name="insert1"/>+</m:mo>
1263 <xsl:if test="*[1]=m:subset or *[1]=m:prsubset or *[1]=m:eq or *[1]=m:gt or *[1]=m:lt or *[1]=m:geq or *[1]=m:leq or *[1]=m:equivalent">
1264 <xsl:apply-templates select = "*[2]" mode="semantics"/>
1265 <xsl:for-each select = "*[position()>2]">
1266 <xsl:if test="../*[self::m:subset][1]">
1267 <m:mo> <xsl:call-template name="insert2"/> <mchar name="SubsetEqual"/> </m:mo>
1269 <xsl:if test="../*[self::m:prsubset][1]">
1270 <m:mo> <xsl:call-template name="insert2"/><mchar name="subset"/> </m:mo>
1272 <xsl:if test="../*[self::m:eq][1]">
1273 <m:mo><xsl:call-template name="insert2"/>=</m:mo>
1275 <xsl:if test="../*[self::m:gt][1]">
1276 <m:mo><xsl:call-template name="insert2"/>></m:mo>
1278 <xsl:if test="../*[self::m:lt][1]">
1279 <m:mo><xsl:call-template name="insert2"/><</m:mo>
1281 <xsl:if test="../*[self::m:geq][1]">
1282 <m:mo><xsl:call-template name="insert2"/> <mchar name="geq"/> </m:mo>
1284 <xsl:if test="../*[self::m:leq][1]">
1285 <m:mo><xsl:call-template name="insert2"/> <mchar name="leq"/> </m:mo>
1287 <xsl:if test="../*[self::m:equivalent][1]">
1288 <m:mo><xsl:call-template name="insert2"/> <mchar name="Congruent"/> </m:mo>
1290 <xsl:apply-templates select = "." mode="semantics"/>
1299 <xsl:template match = "m:apply[*[1][self::m:ln]]">
1301 <xsl:call-template name="insert_xref"/>
1303 <xsl:when test="parent::m:apply[m:power[1]]">
1305 <m:mo><xsl:call-template name="insert1"/>ln</m:mo>
1306 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1310 <m:mo><xsl:call-template name="insert1"/>ln</m:mo>
1313 <xsl:apply-templates select = "*[2]" mode = "semantics">
1314 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1315 </xsl:apply-templates>
1319 <xsl:template match = "m:apply[m:log[1]]">
1321 <xsl:call-template name="insert_xref"/>
1323 <xsl:when test="parent::m:apply[m:power[1]]">
1324 <xsl:if test="not(*[2]=m:logbase)">
1326 <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1327 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1330 <xsl:if test="*[2]=m:logbase">
1332 <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1333 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1334 <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
1339 <xsl:if test="not(*[2]=m:logbase)">
1340 <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1342 <xsl:if test="*[2]=m:logbase">
1344 <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1345 <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
1350 <xsl:if test="*[2]=m:logbase">
1351 <xsl:apply-templates select = "*[3]" mode = "semantics">
1352 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1353 </xsl:apply-templates>
1355 <xsl:if test="not(*[2]=m:logbase)">
1356 <xsl:apply-templates select = "*[2]" mode = "semantics">
1357 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1358 </xsl:apply-templates>
1363 <xsl:template match = "m:apply[m:diff[1]]">
1365 <xsl:call-template name="insert_xref"/>
1366 <xsl:if test="*[2]=m:bvar and m:bvar[*[2]=m:degree]">
1367 <m:mfrac><xsl:call-template name="insert1"/>
1370 <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
1375 <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
1376 <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
1381 <xsl:if test="*[2]=m:bvar and not(m:bvar[*[2]=m:degree])">
1382 <m:mfrac><xsl:call-template name="insert1"/>
1386 <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
1390 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1394 <xsl:template match = "m:apply[m:partialdiff[1]]">
1396 <xsl:call-template name="insert_xref"/>
1397 <xsl:for-each select = "m:bvar">
1398 <xsl:if test="*[last()]=m:degree">
1399 <m:mfrac><xsl:call-template name="insert1"/>
1402 <xsl:apply-templates select = "m:degree" mode = "semantics"/>
1407 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
1408 <xsl:apply-templates select = "m:degree" mode = "semantics"/>
1413 <xsl:if test="not(*[last()]=m:degree)">
1414 <m:mfrac><xsl:call-template name="insert1"/>
1418 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
1423 <xsl:apply-templates select = "*[last()]" mode = "semantics"/>
1427 <xsl:template match = "m:lowlimit | m:uplimit | m:bvar | m:degree | m:logbase">
1428 <xsl:apply-templates mode = "semantics"/>
1431 <xsl:template match = "m:apply[m:divergence[1] | m:grad[1] | m:curl[1]]">
1433 <xsl:call-template name="insert_xref"/>
1434 <xsl:if test="*[1]=m:divergence">
1435 <m:mo><xsl:call-template name="insert1"/>div</m:mo>
1437 <xsl:if test="*[1]=m:grad">
1438 <m:mo><xsl:call-template name="insert1"/>grad</m:mo>
1440 <xsl:if test="*[1]=m:curl">
1441 <m:mo><xsl:call-template name="insert1"/>curl</m:mo>
1444 <xsl:when test="*[2]=m:ci">
1445 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1448 <m:mfenced separators="">
1449 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1456 <xsl:template match = "m:apply[m:laplacian[1]]">
1458 <xsl:call-template name="insert_xref"/>
1459 <m:msup><xsl:call-template name="insert1"/>
1460 <m:mo> Δ </m:mo>
1463 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1470 <xsl:template match = "m:set | m:list">
1471 <m:mfenced open="{{" close="}}" separators="">
1472 <xsl:call-template name="insert_xref"/>
1473 <xsl:if test="*[1]=m:bvar and *[2]=m:condition">
1474 <xsl:apply-templates select="m:bvar" mode = "semantics"/>
1476 <xsl:apply-templates select="m:condition" mode = "semantics"/>
1478 <xsl:if test="*[1]=m:condition and not(child::m:bvar)">
1479 <m:mfenced open="" close="" separators=",">
1480 <xsl:for-each select = "*[not(self::m:condition) and not(self::m:bvar)]">
1481 <xsl:apply-templates select = "." mode="semantics"/>
1485 <xsl:apply-templates select="m:condition" mode = "semantics"/>
1487 <xsl:if test="not(child::m:bvar) and not(child::m:condition)">
1488 <m:mfenced open="" close="" separators=",">
1489 <xsl:for-each select = "*">
1490 <xsl:apply-templates select = "." mode="semantics"/>
1497 <xsl:template match = "m:apply[m:union[1]]">
1498 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1499 <xsl:param name="PARAM" select="$NO_PARAM"/>
1500 <xsl:param name="PAREN" select="$PAR_NO"/>
1501 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1503 <xsl:when test="$IN_PREC > $UNION_PREC or $IN_PREC=$UNION_PREC and $PARAM=$PAR_SAME">
1504 <m:mfenced separators="" helm:xref="{@helm:xref}">
1505 <xsl:call-template name="insert_xref"/>
1506 <xsl:apply-templates select="." mode="union">
1507 <xsl:with-param name="PARAM" select="$PARAM"/>
1508 <xsl:with-param name="PAREN" select="$PAREN"/>
1509 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1510 </xsl:apply-templates>
1513 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1514 <xsl:apply-templates select="." mode="union">
1515 <xsl:with-param name="PARAM" select="$PARAM"/>
1516 <xsl:with-param name="PAREN" select="$PAREN"/>
1517 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1518 </xsl:apply-templates>
1522 <xsl:call-template name="insert_xref"/>
1523 <xsl:apply-templates select="." mode="union">
1524 <xsl:with-param name="PARAM" select="$PARAM"/>
1525 <xsl:with-param name="PAREN" select="$PAREN"/>
1526 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1527 </xsl:apply-templates>
1533 <xsl:template match = "m:apply[m:union[1]]" mode="union">
1534 <xsl:param name="PARAM" select="$NO_PARAM"/>
1535 <xsl:param name="PAREN" select="$PAR_NO"/>
1536 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1537 <xsl:apply-templates select = "*[2]" mode="semantics">
1538 <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
1539 <xsl:with-param name="PARAM" select="$PARAM"/>
1540 <xsl:with-param name="PAREN" select="$PAREN"/>
1541 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1542 </xsl:apply-templates>
1543 <xsl:for-each select = "*[position()>2]">
1544 <m:mo><xsl:call-template name="insert2"/> <mchar name="Union"/> </m:mo>
1545 <xsl:apply-templates select = "." mode="semantics">
1546 <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
1547 <xsl:with-param name="PAREN" select="$PAREN"/>
1548 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1549 </xsl:apply-templates>
1553 <xsl:template match = "m:apply[m:intersect[1]]">
1554 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1555 <xsl:param name="PARAM" select="$NO_PARAM"/>
1556 <xsl:param name="PAREN" select="$PAR_NO"/>
1557 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1559 <xsl:when test="$IN_PREC > $INTERSECT_PREC">
1560 <m:mfenced separators="" helm:xref="{@helm:xref}">
1561 <xsl:call-template name="insert_xref"/>
1562 <xsl:apply-templates select="." mode="intersect">
1563 <xsl:with-param name="PARAM" select="$PARAM"/>
1564 <xsl:with-param name="PAREN" select="$PAREN"/>
1565 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1566 </xsl:apply-templates>
1569 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1570 <xsl:apply-templates select="." mode="intersect">
1571 <xsl:with-param name="PARAM" select="$PARAM"/>
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:call-template name="insert_xref"/>
1579 <xsl:apply-templates select="." mode="intersect">
1580 <xsl:with-param name="PARAM" select="$PARAM"/>
1581 <xsl:with-param name="PAREN" select="$PAREN"/>
1582 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1583 </xsl:apply-templates>
1589 <xsl:template match = "m:apply[m:intersect[1]]" mode="intersect">
1590 <xsl:param name="PARAM" select="$NO_PARAM"/>
1591 <xsl:param name="PAREN" select="$PAR_NO"/>
1592 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1593 <xsl:apply-templates select = "*[2]" mode="semantics">
1594 <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
1595 <xsl:with-param name="PARAM" select="$PARAM"/>
1596 <xsl:with-param name="PAREN" select="$PAREN"/>
1597 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1598 </xsl:apply-templates>
1599 <xsl:for-each select = "*[position()>2]">
1600 <m:mo><xsl:call-template name="insert2"/> <mchar name="Intersection"/> </m:mo>
1601 <xsl:apply-templates select = "." mode="semantics">
1602 <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
1603 <xsl:with-param name="PAREN" select="$PAREN"/>
1604 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1605 </xsl:apply-templates>
1609 <xsl:template match = "m:apply[m:setdiff[1]]">
1610 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1611 <xsl:param name="PARAM" select="$NO_PARAM"/>
1612 <xsl:param name="PAREN" select="$PAR_NO"/>
1613 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1615 <xsl:when test="$IN_PREC > $SETDIFF_PREC or $IN_PREC=$SETDIFF_PREC and $PARAM=$PAR_SAME">
1616 <m:mfenced separators="">
1617 <xsl:call-template name="insert_xref"/>
1618 <xsl:apply-templates select="." mode="setdiff">
1619 <xsl:with-param name="PARAM" select="$PARAM"/>
1620 <xsl:with-param name="PAREN" select="$PAREN"/>
1621 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1622 </xsl:apply-templates>
1625 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1626 <xsl:apply-templates select="." mode="setdiff">
1627 <xsl:with-param name="PARAM" select="$PARAM"/>
1628 <xsl:with-param name="PAREN" select="$PAREN"/>
1629 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1630 </xsl:apply-templates>
1634 <xsl:call-template name="insert_xref"/>
1635 <xsl:apply-templates select="." mode="setdiff">
1636 <xsl:with-param name="PARAM" select="$PARAM"/>
1637 <xsl:with-param name="PAREN" select="$PAREN"/>
1638 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1639 </xsl:apply-templates>
1645 <xsl:template match = "m:apply[m:setdiff[1]]" mode="setdiff">
1646 <xsl:param name="PARAM" select="$NO_PARAM"/>
1647 <xsl:param name="PAREN" select="$PAR_NO"/>
1648 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1649 <xsl:apply-templates select = "*[2]" mode = "semantics">
1650 <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
1651 <xsl:with-param name="PARAM" select="$PARAM"/>
1652 <xsl:with-param name="PAREN" select="$PAREN"/>
1653 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1654 </xsl:apply-templates>
1655 <m:mo><xsl:call-template name="insert1"/>\</m:mo>
1656 <xsl:apply-templates select = "*[3]" mode = "semantics">
1657 <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
1658 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
1659 <xsl:with-param name="PAREN" select="$PAREN"/>
1660 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1661 </xsl:apply-templates>
1664 <xsl:template match = "m:apply[m:card[1]]">
1665 <m:mfenced open="|" close="|" separators=",">
1666 <xsl:call-template name="insert_xref"/>
1667 <xsl:for-each select = "*[position()>1]">
1668 <xsl:apply-templates select = "." mode="semantics"/>
1674 <!-- SEQUENCES AND SERIES -->
1676 <xsl:template match = "m:apply[m:sum[1] | m:product[1]]">
1678 <xsl:call-template name="insert_xref"/>
1680 <xsl:when test="*[2]=m:bvar and m:lowlimit and m:uplimit">
1682 <xsl:if test="*[1]=m:sum">
1683 <m:mo><xsl:call-template name="insert1"/> <mchar name="Sum"/> </m:mo>
1685 <xsl:if test="*[1]=m:product">
1686 <m:mo><xsl:call-template name="insert1"/> <mchar name="Product"/> </m:mo>
1689 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1691 <xsl:apply-templates select = "m:lowlimit" mode = "semantics"/>
1693 <xsl:apply-templates select = "m:uplimit" mode = "semantics"/>
1695 <xsl:apply-templates select = "*[5]" mode = "semantics"/>
1697 <xsl:when test="*[2]=m:bvar and *[3]=m:condition">
1699 <xsl:if test="*[1]=m:sum">
1700 <m:mo><xsl:call-template name="insert1"/> <mchar name="Sum"/> </m:mo>
1702 <xsl:if test="*[1]=m:product">
1703 <m:mo><xsl:call-template name="insert1"/> <mchar name="Product"/> </m:mo>
1705 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1707 <xsl:apply-templates select = "*[4]" mode = "semantics"/>
1713 <xsl:template match = "m:apply[m:limit[1]]">
1715 <xsl:call-template name="insert_xref"/>
1717 <m:mo><xsl:call-template name="insert1"/>lim</m:mo>
1719 <xsl:if test="*[2]=m:bvar and *[3]=m:lowlimit">
1720 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1721 <m:mo> <mchar name="RightArrow"/> </m:mo>
1722 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1724 <xsl:if test="*[2]=m:bvar and *[3]=m:condition">
1725 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1729 <xsl:apply-templates select = "*[4]" mode = "semantics"/>
1734 <!-- TRIGONOMETRY -->
1736 <xsl:template match = "m:apply[*[1][self::m:sin | self::m:cos | self::m:tan | self::m:sec | self::m:csc | self::m:cot | self::m:sinh | self::m:cosh | self::m:tanh | self::m:sech | self::m:csch | self::m:coth | self::m:arcsin | self::m:arccos | self::m:arctan]]">
1738 <xsl:call-template name="insert_xref"/>
1739 <xsl:if test="not(parent::m:apply[m:power[1]])">
1740 <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
1742 <xsl:if test="parent::m:apply[m:power[1]]">
1744 <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
1745 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1748 <xsl:apply-templates select = "*[2]" mode = "semantics">
1749 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1750 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1751 </xsl:apply-templates>
1755 <xsl:template match = "m:*" mode = "trigonometry">
1757 <xsl:when test="self::m:sin">
1760 <xsl:when test="self::m:cos">
1763 <xsl:when test="self::m:tan">
1766 <xsl:when test="self::m:sec">
1769 <xsl:when test="self::m:csc">
1772 <xsl:when test="self::m:cot">
1775 <xsl:when test="self::m:sinh">
1778 <xsl:when test="self::m:cosh">
1781 <xsl:when test="self::m:tanh">
1784 <xsl:when test="self::m:sech">
1787 <xsl:when test="self::m:csch">
1790 <xsl:when test="self::m:coth">
1793 <xsl:when test="self::m:arcsin">
1796 <xsl:when test="self::m:arccos">
1799 <xsl:when test="self::m:arctan">
1808 <xsl:template match = "m:apply[m:mean[1]]">
1809 <m:mfenced open="<" close=">" separators=",">
1810 <xsl:call-template name="insert_xref"/>
1811 <xsl:for-each select = "*[position()>1]">
1812 <xsl:apply-templates select = "." mode="semantics"/>
1817 <xsl:template match = "m:apply[m:sdev[1]]">
1819 <xsl:call-template name="insert_xref"/>
1820 <m:mo><xsl:call-template name="insert1"/> σ </m:mo>
1821 <m:mfenced separators=",">
1822 <xsl:for-each select = "*[position()>1]">
1823 <xsl:apply-templates select = "." mode="semantics"/>
1829 <xsl:template match = "m:apply[m:variance[1]]">
1831 <xsl:call-template name="insert_xref"/>
1832 <m:mo><xsl:call-template name="insert1"/> σ </m:mo>
1834 <m:mfenced separators=",">
1835 <xsl:for-each select = "*[position()>1]">
1836 <xsl:apply-templates select = "." mode="semantics"/>
1844 <xsl:template match = "m:apply[m:median[1]]">
1846 <xsl:call-template name="insert_xref"/>
1847 <m:mo><xsl:call-template name="insert1"/>median</m:mo>
1848 <m:mfenced separators=",">
1849 <xsl:for-each select = "*[position()>1]">
1850 <xsl:apply-templates select = "." mode="semantics"/>
1856 <xsl:template match = "m:apply[m:mode[1]]">
1858 <xsl:call-template name="insert_xref"/>
1859 <m:mo><xsl:call-template name="insert1"/>mode</m:mo>
1860 <m:mfenced separators=",">
1861 <xsl:for-each select = "*[position()>1]">
1862 <xsl:apply-templates select = "." mode="semantics"/>
1868 <xsl:template match = "m:apply[m:moment[1]]">
1869 <xsl:call-template name="insert_xref"/>
1870 <m:mfenced open="<" close=">" separators="">
1871 <xsl:if test="*[2]=m:degree">
1873 <xsl:apply-templates select="*[3]" mode = "semantics"/>
1874 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1877 <xsl:if test="not(*[2]=m:degree)">
1878 <xsl:for-each select = "*[position()>1]">
1879 <xsl:apply-templates select = "." mode="semantics"/>
1886 <!-- LINEAR ALGEBRA -->
1888 <xsl:template match="m:vector">
1889 <m:mfenced separators="">
1891 <xsl:for-each select="*">
1893 <xsl:apply-templates select="." mode = "semantics"/>
1900 <xsl:template match = "m:matrix">
1901 <m:mfenced separators="">
1903 <xsl:apply-templates mode = "semantics"/>
1908 <xsl:template match = "m:matrixrow">
1910 <xsl:for-each select="*">
1912 <xsl:apply-templates select="." mode = "semantics"/>
1918 <xsl:template match = "m:apply[m:determinant[1]]">
1920 <xsl:call-template name="insert_xref"/>
1921 <m:mo><xsl:call-template name="insert1"/>det</m:mo>
1922 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1926 <xsl:template match = "m:apply[m:transpose[1]]">
1928 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1933 <xsl:template match = "m:apply[m:selector[1]]">
1934 <xsl:if test="*[2]=m:matrix and *[3]=m:cn">
1935 <xsl:variable name="m" select = "*[3]"/>
1937 <xsl:when test="*[4]=m:cn">
1938 <xsl:variable name="n" select = "*[4]"/>
1939 <xsl:copy-of select = "m:matrix/*[position()=$m]/*[position()=$n]"/>
1942 <xsl:copy-of select = "m:matrix/*[position()=$m]"/>
1946 <xsl:if test="(*[2]=m:vector or *[2]=m:list) and *[3]=m:cn">
1947 <xsl:variable name="m" select = "*[3]"/>
1948 <xsl:copy-of select = "*[2]/*[position()=$m]"/>
1952 <xsl:template match = "m:apply[m:vectorproduct[1] | m:scalarproduct[1] | m:outerproduct[1]]">
1954 <xsl:call-template name="insert_xref"/>
1955 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1957 <xsl:when test="m:vectorproduct[1]">
1958 <m:mo><xsl:call-template name="insert1"/> <mchar name="Cross"/> </m:mo>
1960 <xsl:when test="m:scalarproduct[1] | m:outerproduct[1]">
1961 <m:mo><xsl:call-template name="insert1"/>.</m:mo>
1964 <xsl:apply-templates select="*[3]" mode = "semantics"/>