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>
346 <!-- <CSC> Originale:
348 <xsl:call-template name="insert"/>
349 <xsl:apply-templates mode = "semantics"/>
352 <!-- <CSC> Modificato: -->
354 <xsl:when test="child::text()">
356 <xsl:call-template name="insert"/>
357 <xsl:apply-templates mode = "semantics"/>
361 <xsl:copy-of select="*"/>
369 <xsl:template match = "m:csymbol">
371 <xsl:when test="*[1]">
372 <xsl:copy-of select = "*"/>
375 <m:mo> <xsl:apply-templates mode = "semantics"/> </m:mo>
381 <!-- BASIC CONTENT ELEMENTS -->
383 <xsl:template match = "m:apply[m:fn[1]]">
385 <xsl:apply-templates select = "m:fn[1]" mode = "semantics"/>
386 <m:mfenced separators=",">
387 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
392 <xsl:template match = "m:fn">
393 <xsl:apply-templates select = "*[1]" mode = "semantics">
394 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
395 </xsl:apply-templates>
398 <xsl:template match = "m:interval">
400 <xsl:when test="@closure='closed'">
401 <m:mfenced open="[" close="]" separators=",">
402 <xsl:apply-templates mode = "semantics"/>
405 <xsl:when test="@closure='open'">
406 <m:mfenced separators=",">
407 <xsl:apply-templates mode = "semantics"/>
410 <xsl:when test="@closure='open-closed'">
411 <m:mfenced open="(" close="]" separators=",">
412 <xsl:apply-templates mode = "semantics"/>
415 <xsl:when test="@closure='closed-open'">
416 <m:mfenced open="[" close=")" separators=",">
417 <xsl:apply-templates mode = "semantics"/>
421 <m:mfenced open="[" close="]" separators=",">
422 <xsl:apply-templates mode = "semantics"/>
428 <xsl:template match = "m:apply[m:*[1][self::m:apply[m:inverse[1]]]]">
430 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
431 <m:mfenced separators=",">
432 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
437 <!-- HELM: these "semantical" Transformations are REALLY questionable.
440 <xsl:template match = "m:apply[*[1][self::m:inverse]]">
442 <xsl:when test="*[2]=m:exp">
445 <xsl:when test="*[2]=m:ln | m:log">
448 <xsl:when test="*[2]=m:sin">
451 <xsl:when test="*[2]=m:cos">
454 <xsl:when test="*[2]=m:tan">
457 <xsl:when test="*[2]=m:sec">
460 <xsl:when test="*[2]=m:csc">
463 <xsl:when test="*[2]=m:cot">
466 <xsl:when test="*[2]=m:sinh">
469 <xsl:when test="*[2]=m:cosh">
472 <xsl:when test="*[2]=m:tanh">
475 <xsl:when test="*[2]=m:sech">
478 <xsl:when test="*[2]=m:csch">
481 <xsl:when test="*[2]=m:coth">
484 <xsl:when test="*[2]=m:arcsin">
487 <xsl:when test="*[2]=m:arccos">
490 <xsl:when test="*[2]=m:arctan">
495 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
504 <xsl:template match = "m:sep"/>
506 <xsl:template match = "m:condition">
508 <xsl:when test="parent::m:apply[m:forall[1]]"/>
510 <xsl:if test="not(*[2])">
511 <xsl:apply-templates mode = "semantics"/>
515 <xsl:apply-templates mode = "semantics"/>
522 <xsl:template match = "m:declare"/>
524 <xsl:template match = "m:lambda">
526 <m:mo> Λ </m:mo>
527 <m:mfenced separators=",">
528 <xsl:for-each select = "*">
530 <xsl:when test="self::m:ci or self::m:cn">
531 <xsl:apply-templates select = "." mode="semantics"/>
535 <xsl:apply-templates select = "." mode="semantics"/>
544 <xsl:template match = "m:apply[m:*[1][self::m:apply[m:compose[1]]]]">
546 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
547 <m:mfenced separators=",">
548 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
553 <xsl:template match = "m:apply[*[1][self::m:compose]]">
554 <m:mfenced separators="">
555 <xsl:apply-templates select = "m:*[2][self::m:ci[@type='fn'] | self::m:fn]" mode="semantics"/>
556 <xsl:for-each select = "m:*[position()>2][self::m:ci[@type='fn'] | self::m:fn]">
557 <m:mo> <xsl:call-template name="insert2"/> <mchar name="SmallCircle"/> </m:mo>
558 <xsl:apply-templates select = "." mode="semantics"/>
563 <xsl:template match = "m:ident">
568 <!-- ARITHMETIC, ALGEBRA & LOGIC -->
570 <xsl:template match = "m:apply[m:quotient[1]]">
571 <m:mfenced open="⌊" close="⌋" separators="">
572 <xsl:call-template name="insert_xref"/>
573 <xsl:apply-templates select="*[2]" mode = "semantics">
574 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
575 </xsl:apply-templates>
576 <m:mo><xsl:call-template name="insert1"/>/</m:mo>
577 <xsl:apply-templates select="*[3]" mode = "semantics">
578 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
579 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
580 </xsl:apply-templates>
584 <xsl:template match = "m:apply[*[1][self::m:exp]]">
587 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
591 <xsl:template match = "m:apply[m:factorial[1]]">
593 <xsl:call-template name="insert_xref"/>
594 <xsl:apply-templates select = "*[2]" mode = "semantics">
595 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
596 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
597 </xsl:apply-templates>
598 <m:mo><xsl:call-template name="insert1"/>!</m:mo>
602 <xsl:template match = "m:apply[m:max[1] | m:min[1]]">
604 <xsl:call-template name="insert_xref"/>
605 <xsl:if test="*[2]=m:bvar">
607 <xsl:if test="*[1]=m:max">
608 <m:mo><xsl:call-template name="insert1"/>max</m:mo>
610 <xsl:if test="*[1]=m:min">
613 <xsl:apply-templates select="*[2]" mode = "semantics"/>
615 <xsl:if test="*[3]=m:condition">
616 <m:mfenced open="{{" close="}}" separators="">
617 <m:mfenced open="" close="" separators=",">
618 <xsl:for-each select = "*[position()>3]">
619 <xsl:apply-templates select = "." mode="semantics"/>
623 <xsl:apply-templates select="*[3]" mode = "semantics"/>
626 <xsl:if test="not(*[3]=m:condition)">
627 <m:mfenced open="{{" close="}}" separators=",">
628 <xsl:for-each select = "*[position()>2]">
629 <xsl:apply-templates select = "." mode="semantics"/>
634 <xsl:if test="*[2]=m:condition">
635 <xsl:if test="*[1]=m:max">
638 <xsl:if test="*[1]=m:min">
641 <m:mfenced open="{{" close="}}" separators="">
643 <m:mfenced open="" close="" separators=",">
644 <xsl:for-each select = "*[position()>2]">
645 <xsl:apply-templates select = "." mode="semantics"/>
650 <xsl:apply-templates select="*[2]" mode = "semantics"/>
653 <xsl:if test="not(*[2]=m:condition) and not(*[2]=m:bvar)">
654 <xsl:if test="*[1]=m:max">
657 <xsl:if test="*[1]=m:min">
658 <m:mo><xsl:call-template name="insert1"/>min</m:mo>
660 <m:mfenced open="{{" close="}}" separators=",">
661 <xsl:for-each select = "*[position()>1]">
662 <xsl:apply-templates select = "." mode="semantics"/>
669 <xsl:template match = "m:apply[m:minus[1]]">
670 <xsl:param name="IN_PREC" select="$NO_PREC"/>
671 <xsl:param name="PARAM" select="$NO_PARAM"/>
672 <xsl:param name="PAREN" select="$PAR_NO"/>
673 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
675 <xsl:when test="$IN_PREC > $MINUS_PREC or $IN_PREC=$MINUS_PREC and $PARAM=$PAR_SAME">
676 <m:mfenced separators="">
677 <xsl:call-template name="insert_xref"/>
678 <xsl:apply-templates select="." mode="minus">
679 <xsl:with-param name="PARAM" select="$PARAM"/>
680 <xsl:with-param name="PAREN" select="$PAR_YES"/>
681 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
682 </xsl:apply-templates>
685 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
686 <xsl:apply-templates select="." mode="minus">
687 <xsl:with-param name="PARAM" select="$PARAM"/>
688 <xsl:with-param name="PAREN" select="$PAREN"/>
689 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
690 </xsl:apply-templates>
694 <xsl:call-template name="insert_xref"/>
695 <xsl:apply-templates select="." mode="minus">
696 <xsl:with-param name="PARAM" select="$PARAM"/>
697 <xsl:with-param name="PAREN" select="$PAREN"/>
698 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
699 </xsl:apply-templates>
705 <xsl:template match = "m:apply[m:minus[1]]" mode="minus">
706 <xsl:param name="PARAM" select="$NO_PARAM"/>
707 <xsl:param name="PAREN" select="$PAR_NO"/>
708 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
709 <xsl:if test="not(*[3])">
710 <m:mo><xsl:call-template name="insert1"/>-</m:mo>
711 <xsl:apply-templates select="*[2]" mode = "semantics">
712 <xsl:with-param name="IN_PREC" select="$NEG_PREC"/>
713 <xsl:with-param name="PAREN" select="$PAREN"/>
714 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
715 </xsl:apply-templates>
718 <xsl:apply-templates select="*[2]" mode = "semantics">
719 <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
720 <xsl:with-param name="PARAM" select="$PARAM"/>
721 <xsl:with-param name="PAREN" select="$PAREN"/>
722 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
723 </xsl:apply-templates>
724 <m:mo><xsl:call-template name="insert1"/>-</m:mo>
725 <xsl:apply-templates select="*[3]" mode = "semantics">
726 <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
727 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
728 <xsl:with-param name="PAREN" select="$PAREN"/>
729 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
730 </xsl:apply-templates>
734 <xsl:template match = "m:apply[m:plus[1]]">
735 <xsl:param name="IN_PREC" select="$NO_PREC"/>
736 <xsl:param name="PARAM" select="$NO_PARAM"/>
737 <xsl:param name="PAREN" select="$PAR_NO"/>
738 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
740 <xsl:when test="$IN_PREC > $PLUS_PREC or $IN_PREC=$PLUS_PREC and $PARAM=$PAR_SAME">
741 <m:mfenced separators="">
742 <xsl:call-template name="insert_xref"/>
743 <xsl:apply-templates select="." mode="plus">
744 <xsl:with-param name="PARAM" select="$IN_PREC"/>
745 <xsl:with-param name="PAREN" select="$PAR_YES"/>
746 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
747 </xsl:apply-templates>
750 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
751 <xsl:apply-templates select="." mode="plus">
752 <xsl:with-param name="PARAM" select="$PARAM"/>
753 <xsl:with-param name="PAREN" select="$PAREN"/>
754 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
755 </xsl:apply-templates>
759 <xsl:call-template name="insert_xref"/>
760 <xsl:apply-templates select="." mode="plus">
761 <xsl:with-param name="PARAM" select="$IN_PREC"/>
762 <xsl:with-param name="PAREN" select="$PAREN"/>
763 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
764 </xsl:apply-templates>
770 <xsl:template match = "m:apply[m:plus[1]]" mode="plus">
771 <xsl:param name="PARAM" select="$NO_PARAM"/>
772 <xsl:param name="PAREN" select="$PAR_NO"/>
773 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
775 <xsl:apply-templates select="*[2]" mode = "semantics">
776 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
777 <xsl:with-param name="PARAM" select="$PARAM"/>
778 <xsl:with-param name="PAREN" select="$PAREN"/>
779 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
780 </xsl:apply-templates>
781 <xsl:for-each select = "*[position()>2]">
783 <xsl:when test=". < 0">
785 <m:mn> <xsl:value-of select="-."/> </m:mn>
787 <xsl:when test="self::m:apply[m:minus[1]] and not(*[3])">
788 <xsl:apply-templates select="." mode = "semantics">
789 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
790 <xsl:with-param name="PAREN" select="$PAREN"/>
791 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
792 </xsl:apply-templates>
795 <m:mo><xsl:call-template name="insert2"/>+</m:mo>
796 <xsl:apply-templates select="." mode = "semantics">
797 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
798 <xsl:with-param name="PAREN" select="$PAREN"/>
799 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
800 </xsl:apply-templates>
807 <xsl:template match = "m:apply[m:power[1]]">
809 <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]]">
810 <xsl:apply-templates select="*[2]" mode = "semantics"/>
814 <xsl:apply-templates select = "*[2]" mode = "semantics">
815 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
816 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
817 </xsl:apply-templates>
818 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
824 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]">
825 <xsl:param name="IN_PREC" select="$NO_PREC"/>
826 <xsl:param name="PARAM" select="$NO_PARAM"/>
827 <xsl:param name="PAREN" select="$PAR_NO"/>
828 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
830 <xsl:when test="$IN_PREC > $DIV_PREC or $IN_PREC=$DIV_PREC and $PARAM=$PAR_SAME">
831 <m:mfenced separators="">
832 <xsl:call-template name="insert_xref"/>
833 <xsl:apply-templates select="." mode="remdiv">
834 <xsl:with-param name="PARAM" select="$IN_PREC"/>
835 <xsl:with-param name="PAREN" select="$PAR_YES"/>
836 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
837 </xsl:apply-templates>
840 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
841 <xsl:apply-templates select="." mode="remdiv">
842 <xsl:with-param name="PARAM" select="$PARAM"/>
843 <xsl:with-param name="PAREN" select="$PAREN"/>
844 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
845 </xsl:apply-templates>
849 <xsl:call-template name="insert_xref"/>
850 <xsl:apply-templates select="." mode="remdiv">
851 <xsl:with-param name="PARAM" select="$IN_PREC"/>
852 <xsl:with-param name="PAREN" select="$PAREN"/>
853 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
854 </xsl:apply-templates>
860 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]" mode="remdiv">
861 <xsl:param name="PARAM" select="$NO_PARAM"/>
862 <xsl:param name="PAREN" select="$PAR_NO"/>
863 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
864 <xsl:apply-templates select = "*[2]" mode = "semantics">
865 <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
866 <xsl:with-param name="PARAM" select="$PARAM"/>
867 <xsl:with-param name="PAREN" select="$PAREN"/>
868 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
869 </xsl:apply-templates>
870 <xsl:if test="m:rem">
871 <m:mo><xsl:call-template name="insert1"/>%</m:mo>
873 <xsl:if test="m:divide">
874 <m:mo><xsl:call-template name="insert1"/>/</m:mo>
876 <xsl:apply-templates select = "*[3]" mode = "semantics">
877 <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
878 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
879 <xsl:with-param name="PAREN" select="$PAREN"/>
880 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
881 </xsl:apply-templates>
884 <xsl:template match = "m:apply[m:times[1]]">
885 <xsl:param name="IN_PREC" select="$NO_PREC"/>
886 <xsl:param name="PARAM" select="$NO_PARAM"/>
887 <xsl:param name="PAREN" select="$PAR_NO"/>
888 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
890 <xsl:when test="$IN_PREC > $MUL_PREC or $IN_PREC=$MUL_PREC and $PARAM=$PAR_SAME">
891 <m:mfenced separators="">
892 <xsl:call-template name="insert_xref"/>
893 <xsl:apply-templates select="." mode="times">
894 <xsl:with-param name="PARAM" select="$IN_PREC"/>
895 <xsl:with-param name="PAREN" select="$PAR_YES"/>
896 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
897 </xsl:apply-templates>
900 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
901 <xsl:apply-templates select="." mode="times">
902 <xsl:with-param name="PARAM" select="$PARAM"/>
903 <xsl:with-param name="PAREN" select="$PAREN"/>
904 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
905 </xsl:apply-templates>
909 <xsl:call-template name="insert_xref"/>
910 <xsl:apply-templates select="." mode="times">
911 <xsl:with-param name="PARAM" select="$IN_PREC"/>
912 <xsl:with-param name="PAREN" select="$PAREN"/>
913 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
914 </xsl:apply-templates>
920 <xsl:template match = "m:apply[m:times[1]]" mode="times">
921 <xsl:param name="PARAM" select="$NO_PARAM"/>
922 <xsl:param name="PAREN" select="$PAR_NO"/>
923 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
924 <xsl:apply-templates select="*[2]" mode = "semantics">
925 <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
926 <xsl:with-param name="PARAM" select="$PARAM"/>
927 <xsl:with-param name="PAREN" select="$PAREN"/>
928 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
929 </xsl:apply-templates>
931 <xsl:for-each select = "*[position()>2]">
932 <!-- HELM: MODIFICA PROVVISORIA -->
933 <!-- <m:mo><xsl:call-template name="insert2"/>
934 <mchar name="InvisibleTimes"/> </m:mo> -->
935 <m:mo><xsl:call-template name="insert2"/>*</m:mo>
936 <xsl:apply-templates select="." mode = "semantics">
937 <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
938 <xsl:with-param name="PAREN" select="$PAREN"/>
939 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
940 </xsl:apply-templates>
945 <!-- HELM: COMMENTO : dove metto la uri della definizione di radice ???? -->
947 <xsl:template match = "m:apply[m:root[1]]">
949 <xsl:call-template name="insert_xref"/>
950 <xsl:if test="*[2]=m:degree">
951 <xsl:apply-templates select="*[3]" mode = "semantics"/>
952 <xsl:apply-templates select="*[2]" mode = "semantics"/>
954 <xsl:if test="not(*[2]=m:degree)">
955 <xsl:apply-templates select="*[2]" mode = "semantics"/>
961 <xsl:template match = "m:apply[m:gcd[1]]">
963 <xsl:call-template name="insert_xref"/>
964 <xsl:if test="not(parent::m:apply[m:power[1]])">
965 <m:mo><xsl:call-template name="insert1"/>gcd</m:mo>
967 <xsl:if test="parent::m:apply[m:power[1]]">
969 <m:mo><xsl:call-template name="insert1"/>gcd</m:mo>
970 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
973 <m:mfenced separators=",">
974 <xsl:for-each select = "*[position()>1]">
975 <xsl:apply-templates select = "." mode="semantics"/>
981 <xsl:template match = "m:apply[m:and[1]]">
982 <xsl:param name="IN_PREC" select="$NO_PREC"/>
983 <xsl:param name="PAREN" select="$PAR_NO"/>
984 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
986 <xsl:when test="$IN_PREC > $AND_PREC">
987 <m:mfenced separators="">
988 <xsl:call-template name="insert_xref"/>
989 <xsl:apply-templates select="." mode="and">
990 <xsl:with-param name="PARAM" select="$IN_PREC"/>
991 <xsl:with-param name="PAREN" select="$PAR_YES"/>
992 </xsl:apply-templates>
995 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
996 <xsl:apply-templates select="." mode="and">
997 <xsl:with-param name="PARAM" select="$IN_PREC"/>
998 <xsl:with-param name="PAREN" select="$PAREN"/>
999 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1000 </xsl:apply-templates>
1004 <xsl:call-template name="insert_xref"/>
1005 <xsl:apply-templates select="." mode="and">
1006 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1007 <xsl:with-param name="PAREN" select="$PAREN"/>
1008 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1009 </xsl:apply-templates>
1015 <xsl:template match = "m:apply[m:and[1]]" mode="and">
1016 <xsl:param name="PARAM" select="$NO_PARAM"/>
1017 <xsl:param name="PAREN" select="$PAR_NO"/>
1018 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1019 <xsl:apply-templates select="*[2]" mode = "semantics">
1020 <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
1021 <xsl:with-param name="PARAM" select="$PARAM"/>
1022 <xsl:with-param name="PAREN" select="$PAREN"/>
1023 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1024 </xsl:apply-templates>
1025 <xsl:for-each select = "*[position()>2]">
1026 <m:mo><xsl:call-template name="insert2"/> <mchar name="wedge"/> </m:mo>
1027 <xsl:apply-templates select="." mode = "semantics">
1028 <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
1029 <xsl:with-param name="PAREN" select="$PAREN"/>
1030 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1031 </xsl:apply-templates>
1035 <xsl:template match = "m:apply[m:or[1]]">
1036 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1037 <xsl:param name="PAREN" select="$PAR_NO"/>
1038 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1040 <xsl:when test="$IN_PREC > $OR_PREC">
1041 <m:mfenced separators="">
1042 <xsl:call-template name="insert_xref"/>
1043 <xsl:apply-templates select="." mode="or">
1044 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1045 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1046 </xsl:apply-templates>
1049 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1050 <xsl:apply-templates select="." mode="or">
1051 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1052 <xsl:with-param name="PAREN" select="$PAREN"/>
1053 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1054 </xsl:apply-templates>
1058 <xsl:call-template name="insert_xref"/>
1059 <xsl:apply-templates select="." mode="or">
1060 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1061 <xsl:with-param name="PAREN" select="$PAREN"/>
1062 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1063 </xsl:apply-templates>
1069 <xsl:template match = "m:apply[m:or[1]]" mode="or">
1070 <xsl:param name="PARAM" select="$NO_PARAM"/>
1071 <xsl:param name="PAREN" select="$PAR_NO"/>
1072 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1073 <xsl:apply-templates select="*[2]" mode = "semantics">
1074 <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1075 <xsl:with-param name="PARAM" select="$PARAM"/>
1076 <xsl:with-param name="PAREN" select="$PAREN"/>
1077 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1078 </xsl:apply-templates>
1079 <xsl:for-each select = "*[position()>2]">
1080 <m:mo><xsl:call-template name="insert2"/> <mchar name="vee"/> </m:mo>
1081 <xsl:apply-templates select="." mode = "semantics">
1082 <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1083 <xsl:with-param name="PAREN" select="$PAREN"/>
1084 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1085 </xsl:apply-templates>
1089 <xsl:template match = "m:apply[m:xor[1]]">
1090 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1091 <xsl:param name="PAREN" select="$PAR_NO"/>
1092 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1094 <xsl:when test="$IN_PREC > $XOR_PREC">
1095 <m:mfenced separators="">
1096 <xsl:call-template name="insert_xref"/>
1097 <xsl:apply-templates select="." mode="xor">
1098 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1099 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1100 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1101 </xsl:apply-templates>
1104 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1105 <xsl:apply-templates select="." mode="xor">
1106 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1107 <xsl:with-param name="PAREN" select="$PAREN"/>
1108 </xsl:apply-templates>
1112 <xsl:call-template name="insert_xref"/>
1113 <xsl:apply-templates select="." mode="xor">
1114 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1115 <xsl:with-param name="PAREN" select="$PAREN"/>
1116 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1117 </xsl:apply-templates>
1123 <xsl:template match = "m:apply[m:xor[1]]" mode="xor">
1124 <xsl:param name="PARAM" select="$NO_PARAM"/>
1125 <xsl:param name="PAREN" select="$PAR_NO"/>
1126 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1127 <xsl:apply-templates select="*[2]" mode = "semantics">
1128 <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1129 <xsl:with-param name="PARAM" select="$PARAM"/>
1130 <xsl:with-param name="PAREN" select="$PAREN"/>
1131 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1132 </xsl:apply-templates>
1133 <xsl:for-each select = "*[position()>2]">
1134 <m:mo><xsl:call-template name="insert2"/> <mchar name="xor"/> </m:mo>
1135 <xsl:apply-templates select="." mode = "semantics">
1136 <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1137 <xsl:with-param name="PAREN" select="$PAREN"/>
1138 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1139 </xsl:apply-templates>
1143 <xsl:template match = "m:apply[m:not[1]]">
1145 <xsl:call-template name="insert_xref"/>
1146 <m:mo><xsl:call-template name="insert1"/>not</m:mo>
1147 <xsl:apply-templates select = "*[2]" mode = "semantics">
1148 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1149 </xsl:apply-templates>
1153 <xsl:template match = "m:apply[m:forall[1]]">
1155 <xsl:call-template name="insert_xref"/>
1156 <m:mo><xsl:call-template name="insert1"/>for all</m:mo>
1157 <m:mfenced separators=",">
1158 <xsl:for-each select = "m:bvar">
1159 <xsl:apply-templates select = "." mode="semantics"/>
1162 <xsl:if test="m:condition">
1164 <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1167 <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and not(self::m:condition)]" mode = "semantics"/>
1171 <xsl:template match = "m:apply[m:exists[1]]">
1173 <xsl:call-template name="insert_xref"/>
1174 <m:mo><xsl:call-template name="insert1"/> <mchar name="Exists"/> </m:mo>
1175 <m:mfenced separators=",">
1176 <xsl:for-each select = "m:bvar">
1177 <xsl:apply-templates select = "." mode="semantics"/>
1180 <xsl:if test="m:condition">
1182 <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1185 <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and not(self::m:condition)]" mode = "semantics"/>
1189 <xsl:template match = "m:apply[m:abs[1]]">
1190 <xsl:if test="not(parent::m:apply[m:power[1]])">
1191 <m:mfenced open="|" close="|" separators="">
1192 <xsl:call-template name="insert_xref"/>
1193 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1196 <xsl:if test="parent::m:apply[m:power[1]]">
1198 <m:mfenced open="|" close="|" separators="">
1199 <xsl:call-template name="insert_xref"/>
1200 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1202 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1207 <xsl:template match = "m:apply[m:conjugate[1]]">
1210 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1212 <m:mo><xsl:call-template name="insert1"/> <mchar name="UnderBar"/> </m:mo>
1216 <xsl:template match = "m:apply[m:arg[1] | m:real[1] | m:imaginary[1]]">
1218 <xsl:call-template name="insert_xref"/>
1220 <xsl:when test="m:arg">
1221 <m:mo><xsl:call-template name="insert1"/>arg</m:mo>
1223 <xsl:when test="m:real">
1224 <m:mo><xsl:call-template name="insert1"/>Real</m:mo>
1226 <xsl:when test="m:imaginary">
1227 <m:mo><xsl:call-template name="insert1"/>Imaginary</m:mo>
1230 <m:mfenced separators="">
1231 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1239 <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]">
1241 <xsl:call-template name="insert_xref"/>
1242 <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">
1243 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1244 <xsl:if test="*[1]=m:neq">
1245 <m:mo><xsl:call-template name="insert1"/> <mchar name="NotEqual"/> </m:mo>
1247 <xsl:if test="*[1]=m:approx">
1248 <m:mo><xsl:call-template name="insert1"/> <mchar name="approxeq"/> </m:mo>
1250 <xsl:if test="*[1]=m:tendsto">
1251 <m:mo><xsl:call-template name="insert1"/> <mchar name="RightArrow"/> </m:mo>
1253 <xsl:if test="*[1]=m:implies">
1254 <m:mo><xsl:call-template name="insert1"/> <mchar name="DoubleRightArrow"/> </m:mo>
1256 <xsl:if test="*[1]=m:in">
1257 <m:mo><xsl:call-template name="insert1"/>
1258 <mchar name="Element"/>
1261 <xsl:if test="*[1]=m:notin">
1262 <m:mo><xsl:call-template name="insert1"/> <mchar name="NotElement"/> </m:mo>
1264 <xsl:if test="*[1]=m:notsubset">
1265 <m:mo> <xsl:call-template name="insert1"/> <mchar name="NotSubset"/> </m:mo>
1267 <xsl:if test="*[1]=m:notprsubset">
1268 <m:mo> <xsl:call-template name="insert1"/> <mchar name="NotSubsetEqual"/> </m:mo>
1270 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1271 <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='below']">
1272 <m:mo><xsl:call-template name="insert1"/>-</m:mo>
1274 <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='above']">
1275 <m:mo><xsl:call-template name="insert1"/>+</m:mo>
1278 <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">
1279 <xsl:apply-templates select = "*[2]" mode="semantics"/>
1280 <xsl:for-each select = "*[position()>2]">
1281 <xsl:if test="../*[self::m:subset][1]">
1282 <m:mo> <xsl:call-template name="insert2"/> <mchar name="SubsetEqual"/> </m:mo>
1284 <xsl:if test="../*[self::m:prsubset][1]">
1285 <m:mo> <xsl:call-template name="insert2"/><mchar name="subset"/> </m:mo>
1287 <xsl:if test="../*[self::m:eq][1]">
1288 <m:mo><xsl:call-template name="insert2"/>=</m:mo>
1290 <xsl:if test="../*[self::m:gt][1]">
1291 <m:mo><xsl:call-template name="insert2"/>></m:mo>
1293 <xsl:if test="../*[self::m:lt][1]">
1294 <m:mo><xsl:call-template name="insert2"/><</m:mo>
1296 <xsl:if test="../*[self::m:geq][1]">
1297 <m:mo><xsl:call-template name="insert2"/> <mchar name="geq"/> </m:mo>
1299 <xsl:if test="../*[self::m:leq][1]">
1300 <m:mo><xsl:call-template name="insert2"/> <mchar name="leq"/> </m:mo>
1302 <xsl:if test="../*[self::m:equivalent][1]">
1303 <m:mo><xsl:call-template name="insert2"/> <mchar name="Congruent"/> </m:mo>
1305 <xsl:apply-templates select = "." mode="semantics"/>
1314 <xsl:template match = "m:apply[*[1][self::m:ln]]">
1316 <xsl:call-template name="insert_xref"/>
1318 <xsl:when test="parent::m:apply[m:power[1]]">
1320 <m:mo><xsl:call-template name="insert1"/>ln</m:mo>
1321 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1325 <m:mo><xsl:call-template name="insert1"/>ln</m:mo>
1328 <xsl:apply-templates select = "*[2]" mode = "semantics">
1329 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1330 </xsl:apply-templates>
1334 <xsl:template match = "m:apply[m:log[1]]">
1336 <xsl:call-template name="insert_xref"/>
1338 <xsl:when test="parent::m:apply[m:power[1]]">
1339 <xsl:if test="not(*[2]=m:logbase)">
1341 <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1342 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1345 <xsl:if test="*[2]=m:logbase">
1347 <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1348 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1349 <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
1354 <xsl:if test="not(*[2]=m:logbase)">
1355 <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1357 <xsl:if test="*[2]=m:logbase">
1359 <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1360 <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
1365 <xsl:if test="*[2]=m:logbase">
1366 <xsl:apply-templates select = "*[3]" mode = "semantics">
1367 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1368 </xsl:apply-templates>
1370 <xsl:if test="not(*[2]=m:logbase)">
1371 <xsl:apply-templates select = "*[2]" mode = "semantics">
1372 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1373 </xsl:apply-templates>
1378 <xsl:template match = "m:apply[m:diff[1]]">
1380 <xsl:call-template name="insert_xref"/>
1381 <xsl:if test="*[2]=m:bvar and m:bvar[*[2]=m:degree]">
1382 <m:mfrac><xsl:call-template name="insert1"/>
1385 <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
1390 <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
1391 <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
1396 <xsl:if test="*[2]=m:bvar and not(m:bvar[*[2]=m:degree])">
1397 <m:mfrac><xsl:call-template name="insert1"/>
1401 <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
1405 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1409 <xsl:template match = "m:apply[m:partialdiff[1]]">
1411 <xsl:call-template name="insert_xref"/>
1412 <xsl:for-each select = "m:bvar">
1413 <xsl:if test="*[last()]=m:degree">
1414 <m:mfrac><xsl:call-template name="insert1"/>
1417 <xsl:apply-templates select = "m:degree" mode = "semantics"/>
1422 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
1423 <xsl:apply-templates select = "m:degree" mode = "semantics"/>
1428 <xsl:if test="not(*[last()]=m:degree)">
1429 <m:mfrac><xsl:call-template name="insert1"/>
1433 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
1438 <xsl:apply-templates select = "*[last()]" mode = "semantics"/>
1442 <xsl:template match = "m:lowlimit | m:uplimit | m:bvar | m:degree | m:logbase">
1443 <xsl:apply-templates mode = "semantics"/>
1446 <xsl:template match = "m:apply[m:divergence[1] | m:grad[1] | m:curl[1]]">
1448 <xsl:call-template name="insert_xref"/>
1449 <xsl:if test="*[1]=m:divergence">
1450 <m:mo><xsl:call-template name="insert1"/>div</m:mo>
1452 <xsl:if test="*[1]=m:grad">
1453 <m:mo><xsl:call-template name="insert1"/>grad</m:mo>
1455 <xsl:if test="*[1]=m:curl">
1456 <m:mo><xsl:call-template name="insert1"/>curl</m:mo>
1459 <xsl:when test="*[2]=m:ci">
1460 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1463 <m:mfenced separators="">
1464 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1471 <xsl:template match = "m:apply[m:laplacian[1]]">
1473 <xsl:call-template name="insert_xref"/>
1474 <m:msup><xsl:call-template name="insert1"/>
1475 <m:mo> Δ </m:mo>
1478 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1485 <xsl:template match = "m:set | m:list">
1486 <m:mfenced open="{{" close="}}" separators="">
1487 <xsl:call-template name="insert_xref"/>
1488 <xsl:if test="*[1]=m:bvar and *[2]=m:condition">
1489 <xsl:apply-templates select="m:bvar" mode = "semantics"/>
1491 <xsl:apply-templates select="m:condition" mode = "semantics"/>
1493 <xsl:if test="*[1]=m:condition and not(child::m:bvar)">
1494 <m:mfenced open="" close="" separators=",">
1495 <xsl:for-each select = "*[not(self::m:condition) and not(self::m:bvar)]">
1496 <xsl:apply-templates select = "." mode="semantics"/>
1500 <xsl:apply-templates select="m:condition" mode = "semantics"/>
1502 <xsl:if test="not(child::m:bvar) and not(child::m:condition)">
1503 <m:mfenced open="" close="" separators=",">
1504 <xsl:for-each select = "*">
1505 <xsl:apply-templates select = "." mode="semantics"/>
1512 <xsl:template match = "m:apply[m:union[1]]">
1513 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1514 <xsl:param name="PARAM" select="$NO_PARAM"/>
1515 <xsl:param name="PAREN" select="$PAR_NO"/>
1516 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1518 <xsl:when test="$IN_PREC > $UNION_PREC or $IN_PREC=$UNION_PREC and $PARAM=$PAR_SAME">
1519 <m:mfenced separators="" helm:xref="{@helm:xref}">
1520 <xsl:call-template name="insert_xref"/>
1521 <xsl:apply-templates select="." mode="union">
1522 <xsl:with-param name="PARAM" select="$PARAM"/>
1523 <xsl:with-param name="PAREN" select="$PAREN"/>
1524 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1525 </xsl:apply-templates>
1528 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1529 <xsl:apply-templates select="." mode="union">
1530 <xsl:with-param name="PARAM" select="$PARAM"/>
1531 <xsl:with-param name="PAREN" select="$PAREN"/>
1532 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1533 </xsl:apply-templates>
1537 <xsl:call-template name="insert_xref"/>
1538 <xsl:apply-templates select="." mode="union">
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>
1548 <xsl:template match = "m:apply[m:union[1]]" mode="union">
1549 <xsl:param name="PARAM" select="$NO_PARAM"/>
1550 <xsl:param name="PAREN" select="$PAR_NO"/>
1551 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1552 <xsl:apply-templates select = "*[2]" mode="semantics">
1553 <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
1554 <xsl:with-param name="PARAM" select="$PARAM"/>
1555 <xsl:with-param name="PAREN" select="$PAREN"/>
1556 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1557 </xsl:apply-templates>
1558 <xsl:for-each select = "*[position()>2]">
1559 <m:mo><xsl:call-template name="insert2"/> <mchar name="Union"/> </m:mo>
1560 <xsl:apply-templates select = "." mode="semantics">
1561 <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
1562 <xsl:with-param name="PAREN" select="$PAREN"/>
1563 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1564 </xsl:apply-templates>
1568 <xsl:template match = "m:apply[m:intersect[1]]">
1569 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1570 <xsl:param name="PARAM" select="$NO_PARAM"/>
1571 <xsl:param name="PAREN" select="$PAR_NO"/>
1572 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1574 <xsl:when test="$IN_PREC > $INTERSECT_PREC">
1575 <m:mfenced separators="" helm:xref="{@helm:xref}">
1576 <xsl:call-template name="insert_xref"/>
1577 <xsl:apply-templates select="." mode="intersect">
1578 <xsl:with-param name="PARAM" select="$PARAM"/>
1579 <xsl:with-param name="PAREN" select="$PAREN"/>
1580 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1581 </xsl:apply-templates>
1584 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1585 <xsl:apply-templates select="." mode="intersect">
1586 <xsl:with-param name="PARAM" select="$PARAM"/>
1587 <xsl:with-param name="PAREN" select="$PAREN"/>
1588 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1589 </xsl:apply-templates>
1593 <xsl:call-template name="insert_xref"/>
1594 <xsl:apply-templates select="." mode="intersect">
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>
1604 <xsl:template match = "m:apply[m:intersect[1]]" mode="intersect">
1605 <xsl:param name="PARAM" select="$NO_PARAM"/>
1606 <xsl:param name="PAREN" select="$PAR_NO"/>
1607 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1608 <xsl:apply-templates select = "*[2]" mode="semantics">
1609 <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
1610 <xsl:with-param name="PARAM" select="$PARAM"/>
1611 <xsl:with-param name="PAREN" select="$PAREN"/>
1612 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1613 </xsl:apply-templates>
1614 <xsl:for-each select = "*[position()>2]">
1615 <m:mo><xsl:call-template name="insert2"/> <mchar name="Intersection"/> </m:mo>
1616 <xsl:apply-templates select = "." mode="semantics">
1617 <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
1618 <xsl:with-param name="PAREN" select="$PAREN"/>
1619 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1620 </xsl:apply-templates>
1624 <xsl:template match = "m:apply[m:setdiff[1]]">
1625 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1626 <xsl:param name="PARAM" select="$NO_PARAM"/>
1627 <xsl:param name="PAREN" select="$PAR_NO"/>
1628 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1630 <xsl:when test="$IN_PREC > $SETDIFF_PREC or $IN_PREC=$SETDIFF_PREC and $PARAM=$PAR_SAME">
1631 <m:mfenced separators="">
1632 <xsl:call-template name="insert_xref"/>
1633 <xsl:apply-templates select="." mode="setdiff">
1634 <xsl:with-param name="PARAM" select="$PARAM"/>
1635 <xsl:with-param name="PAREN" select="$PAREN"/>
1636 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1637 </xsl:apply-templates>
1640 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1641 <xsl:apply-templates select="." mode="setdiff">
1642 <xsl:with-param name="PARAM" select="$PARAM"/>
1643 <xsl:with-param name="PAREN" select="$PAREN"/>
1644 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1645 </xsl:apply-templates>
1649 <xsl:call-template name="insert_xref"/>
1650 <xsl:apply-templates select="." mode="setdiff">
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>
1660 <xsl:template match = "m:apply[m:setdiff[1]]" mode="setdiff">
1661 <xsl:param name="PARAM" select="$NO_PARAM"/>
1662 <xsl:param name="PAREN" select="$PAR_NO"/>
1663 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1664 <xsl:apply-templates select = "*[2]" mode = "semantics">
1665 <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
1666 <xsl:with-param name="PARAM" select="$PARAM"/>
1667 <xsl:with-param name="PAREN" select="$PAREN"/>
1668 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1669 </xsl:apply-templates>
1670 <m:mo><xsl:call-template name="insert1"/>\</m:mo>
1671 <xsl:apply-templates select = "*[3]" mode = "semantics">
1672 <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
1673 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
1674 <xsl:with-param name="PAREN" select="$PAREN"/>
1675 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1676 </xsl:apply-templates>
1679 <xsl:template match = "m:apply[m:card[1]]">
1680 <m:mfenced open="|" close="|" separators=",">
1681 <xsl:call-template name="insert_xref"/>
1682 <xsl:for-each select = "*[position()>1]">
1683 <xsl:apply-templates select = "." mode="semantics"/>
1689 <!-- SEQUENCES AND SERIES -->
1691 <xsl:template match = "m:apply[m:sum[1] | m:product[1]]">
1693 <xsl:call-template name="insert_xref"/>
1695 <xsl:when test="*[2]=m:bvar and m:lowlimit and m:uplimit">
1697 <xsl:if test="*[1]=m:sum">
1698 <m:mo><xsl:call-template name="insert1"/> <mchar name="Sum"/> </m:mo>
1700 <xsl:if test="*[1]=m:product">
1701 <m:mo><xsl:call-template name="insert1"/> <mchar name="Product"/> </m:mo>
1704 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1706 <xsl:apply-templates select = "m:lowlimit" mode = "semantics"/>
1708 <xsl:apply-templates select = "m:uplimit" mode = "semantics"/>
1710 <xsl:apply-templates select = "*[5]" mode = "semantics"/>
1712 <xsl:when test="*[2]=m:bvar and *[3]=m:condition">
1714 <xsl:if test="*[1]=m:sum">
1715 <m:mo><xsl:call-template name="insert1"/> <mchar name="Sum"/> </m:mo>
1717 <xsl:if test="*[1]=m:product">
1718 <m:mo><xsl:call-template name="insert1"/> <mchar name="Product"/> </m:mo>
1720 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1722 <xsl:apply-templates select = "*[4]" mode = "semantics"/>
1728 <xsl:template match = "m:apply[m:limit[1]]">
1730 <xsl:call-template name="insert_xref"/>
1732 <m:mo><xsl:call-template name="insert1"/>lim</m:mo>
1734 <xsl:if test="*[2]=m:bvar and *[3]=m:lowlimit">
1735 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1736 <m:mo> <mchar name="RightArrow"/> </m:mo>
1737 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1739 <xsl:if test="*[2]=m:bvar and *[3]=m:condition">
1740 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1744 <xsl:apply-templates select = "*[4]" mode = "semantics"/>
1749 <!-- TRIGONOMETRY -->
1751 <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]]">
1753 <xsl:call-template name="insert_xref"/>
1754 <xsl:if test="not(parent::m:apply[m:power[1]])">
1755 <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
1757 <xsl:if test="parent::m:apply[m:power[1]]">
1759 <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
1760 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1763 <xsl:apply-templates select = "*[2]" mode = "semantics">
1764 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1765 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1766 </xsl:apply-templates>
1770 <xsl:template match = "m:*" mode = "trigonometry">
1772 <xsl:when test="self::m:sin">
1775 <xsl:when test="self::m:cos">
1778 <xsl:when test="self::m:tan">
1781 <xsl:when test="self::m:sec">
1784 <xsl:when test="self::m:csc">
1787 <xsl:when test="self::m:cot">
1790 <xsl:when test="self::m:sinh">
1793 <xsl:when test="self::m:cosh">
1796 <xsl:when test="self::m:tanh">
1799 <xsl:when test="self::m:sech">
1802 <xsl:when test="self::m:csch">
1805 <xsl:when test="self::m:coth">
1808 <xsl:when test="self::m:arcsin">
1811 <xsl:when test="self::m:arccos">
1814 <xsl:when test="self::m:arctan">
1823 <xsl:template match = "m:apply[m:mean[1]]">
1824 <m:mfenced open="<" close=">" separators=",">
1825 <xsl:call-template name="insert_xref"/>
1826 <xsl:for-each select = "*[position()>1]">
1827 <xsl:apply-templates select = "." mode="semantics"/>
1832 <xsl:template match = "m:apply[m:sdev[1]]">
1834 <xsl:call-template name="insert_xref"/>
1835 <m:mo><xsl:call-template name="insert1"/> σ </m:mo>
1836 <m:mfenced separators=",">
1837 <xsl:for-each select = "*[position()>1]">
1838 <xsl:apply-templates select = "." mode="semantics"/>
1844 <xsl:template match = "m:apply[m:variance[1]]">
1846 <xsl:call-template name="insert_xref"/>
1847 <m:mo><xsl:call-template name="insert1"/> σ </m:mo>
1849 <m:mfenced separators=",">
1850 <xsl:for-each select = "*[position()>1]">
1851 <xsl:apply-templates select = "." mode="semantics"/>
1859 <xsl:template match = "m:apply[m:median[1]]">
1861 <xsl:call-template name="insert_xref"/>
1862 <m:mo><xsl:call-template name="insert1"/>median</m:mo>
1863 <m:mfenced separators=",">
1864 <xsl:for-each select = "*[position()>1]">
1865 <xsl:apply-templates select = "." mode="semantics"/>
1871 <xsl:template match = "m:apply[m:mode[1]]">
1873 <xsl:call-template name="insert_xref"/>
1874 <m:mo><xsl:call-template name="insert1"/>mode</m:mo>
1875 <m:mfenced separators=",">
1876 <xsl:for-each select = "*[position()>1]">
1877 <xsl:apply-templates select = "." mode="semantics"/>
1883 <xsl:template match = "m:apply[m:moment[1]]">
1884 <xsl:call-template name="insert_xref"/>
1885 <m:mfenced open="<" close=">" separators="">
1886 <xsl:if test="*[2]=m:degree">
1888 <xsl:apply-templates select="*[3]" mode = "semantics"/>
1889 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1892 <xsl:if test="not(*[2]=m:degree)">
1893 <xsl:for-each select = "*[position()>1]">
1894 <xsl:apply-templates select = "." mode="semantics"/>
1901 <!-- LINEAR ALGEBRA -->
1903 <xsl:template match="m:vector">
1904 <m:mfenced separators="">
1906 <xsl:for-each select="*">
1908 <xsl:apply-templates select="." mode = "semantics"/>
1915 <xsl:template match = "m:matrix">
1916 <m:mfenced separators="">
1918 <xsl:apply-templates mode = "semantics"/>
1923 <xsl:template match = "m:matrixrow">
1925 <xsl:for-each select="*">
1927 <xsl:apply-templates select="." mode = "semantics"/>
1933 <xsl:template match = "m:apply[m:determinant[1]]">
1935 <xsl:call-template name="insert_xref"/>
1936 <m:mo><xsl:call-template name="insert1"/>det</m:mo>
1937 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1941 <xsl:template match = "m:apply[m:transpose[1]]">
1943 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1948 <xsl:template match = "m:apply[m:selector[1]]">
1949 <xsl:if test="*[2]=m:matrix and *[3]=m:cn">
1950 <xsl:variable name="m" select = "*[3]"/>
1952 <xsl:when test="*[4]=m:cn">
1953 <xsl:variable name="n" select = "*[4]"/>
1954 <xsl:copy-of select = "m:matrix/*[position()=$m]/*[position()=$n]"/>
1957 <xsl:copy-of select = "m:matrix/*[position()=$m]"/>
1961 <xsl:if test="(*[2]=m:vector or *[2]=m:list) and *[3]=m:cn">
1962 <xsl:variable name="m" select = "*[3]"/>
1963 <xsl:copy-of select = "*[2]/*[position()=$m]"/>
1967 <xsl:template match = "m:apply[m:vectorproduct[1] | m:scalarproduct[1] | m:outerproduct[1]]">
1969 <xsl:call-template name="insert_xref"/>
1970 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1972 <xsl:when test="m:vectorproduct[1]">
1973 <m:mo><xsl:call-template name="insert1"/> <mchar name="Cross"/> </m:mo>
1975 <xsl:when test="m:scalarproduct[1] | m:outerproduct[1]">
1976 <m:mo><xsl:call-template name="insert1"/>.</m:mo>
1979 <xsl:apply-templates select="*[3]" mode = "semantics"/>