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 <xsl:stylesheet id="mml2mml"
25 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
26 xmlns:m="http://www.w3.org/1998/Math/MathML"
27 xmlns:xlink="http://www.w3.org/1999/xlink"
28 xmlns:helm="http://www.cs.unibo.it/helm">
30 <xsl:output method="xml" indent="yes" encoding="iso-8859-1"/>
32 <!-- ***************************************************** -->
33 <!-- Parameters affectin' stylesheet's run-time behavior -->
34 <!-- ***************************************************** -->
36 <!-- SEM_SW: -1 - strip off all semantics
37 0 - pass semantics "as is" (default)
38 1 - add semantics at top level only
39 2 - add semantics at all levels
40 3 - semantics at top level with cross-references
42 <!-- HELM: SEM_SW was 0 -->
43 <xsl:param name="SEM_SW" select="1"/>
45 <!-- Miscellaneous Variable Definitions -->
47 <xsl:variable name="NO" select="0"/>
48 <xsl:variable name="YES" select="1"/>
49 <xsl:variable name="PAR_NO" select="-7"/>
50 <xsl:variable name="PAR_YES" select="-5"/>
51 <xsl:variable name="PAR_SAME" select="-3"/>
52 <xsl:variable name="NO_PARAM" select="-1"/>
54 <!-- Operator Precedence Definitions -->
56 <xsl:variable name="NO_PREC" select="0"/>
57 <xsl:variable name="UNION_PREC" select="1"/>
58 <xsl:variable name="SETDIFF_PREC" select="1"/>
59 <xsl:variable name="INTERSECT_PREC" select="3"/>
60 <xsl:variable name="OR_PREC" select="5"/>
61 <xsl:variable name="XOR_PREC" select="5"/>
62 <xsl:variable name="AND_PREC" select="7"/>
63 <xsl:variable name="PLUS_PREC" select="9"/>
64 <xsl:variable name="MINUS_PREC" select="9"/>
65 <xsl:variable name="MUL_PREC" select="11"/>
66 <xsl:variable name="DIV_PREC" select="11"/>
67 <xsl:variable name="NEG_PREC" select="13"/>
68 <xsl:variable name="FUNCTION_PREC" select="99"/>
70 <!-- AUXILIARY FUNCTIONS FOR BACKWARD POINTERS AND REFS (by andrea) -->
72 <xsl:template name = "insert_xref">
73 <xsl:if test="@helm:xref">
74 <xsl:attribute name="helm:xref">
75 <xsl:value-of select="@helm:xref"/>
80 <xsl:template name = "insert">
81 <xsl:if test="@definitionURL">
82 <xsl:attribute name="xlink:href">
83 <xsl:value-of select="@definitionURL"/>
86 <xsl:if test="@helm:xref">
87 <xsl:attribute name="helm:xref">
88 <xsl:value-of select="@helm:xref"/>
93 <!-- for use inside m:apply -->
94 <xsl:template name = "insert1">
95 <xsl:if test="*[1]/@definitionURL">
96 <xsl:attribute name="xlink:href">
97 <xsl:value-of select="*[1]/@definitionURL"/>
100 <xsl:if test="*[1]/@helm:xref">
101 <xsl:attribute name="helm:xref">
102 <xsl:value-of select="*[1]/@helm:xref"/>
107 <!-- For use inside "for-each" -->
108 <xsl:template name = "insert2">
109 <xsl:if test="../*[1]/@definitionURL">
110 <xsl:attribute name="xlink:href">
111 <xsl:value-of select="../*[1]/@definitionURL"/>
114 <xsl:if test="../*[1]/@helm:xref">
115 <xsl:attribute name="helm:xref">
116 <xsl:value-of select="../*[1]/@helm:xref"/>
121 <!-- THE TOPMOST ELEMENT: MATH -->
123 <xsl:template match = "m:math">
125 <xsl:when test="$SEM_SW>0">
126 <!-- HELM: deleted math (we have already inserted at object level) -->
129 <xsl:apply-templates mode = "semantics"/>
130 <m:annotation-xml encoding="MathML">
131 <xsl:copy-of select = "*"/>
138 <xsl:apply-templates mode = "semantics"/>
146 <xsl:template match = "m:*" mode = "semantics">
147 <xsl:param name="IN_PREC" select="$NO_PREC"/>
148 <xsl:param name="PARAM" select="$NO_PARAM"/>
149 <xsl:param name="PAREN" select="$PAR_NO"/>
150 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
152 <xsl:when test="$SEM_SW=-1 and self::m:semantics">
153 <xsl:apply-templates select="*[1]">
154 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
155 <xsl:with-param name="PARAM" select="$PARAM"/>
156 <xsl:with-param name="PAREN" select="$PAREN"/>
157 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
158 </xsl:apply-templates>
160 <xsl:when test="$SEM_SW=0 and self::m:semantics">
162 <xsl:apply-templates select="*[1]">
163 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
164 <xsl:with-param name="PARAM" select="$PARAM"/>
165 <xsl:with-param name="PAREN" select="$PAREN"/>
166 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
167 </xsl:apply-templates>
168 <xsl:copy-of select="m:annotation-xml"/>
171 <xsl:when test="$SEM_SW=2">
174 <xsl:when test="self::m:semantics">
175 <xsl:apply-templates select="*[1]">
176 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
177 <xsl:with-param name="PARAM" select="$PARAM"/>
178 <xsl:with-param name="PAREN" select="$PAREN"/>
179 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
180 </xsl:apply-templates>
181 <xsl:copy-of select="m:annotation-xml"/>
184 <xsl:apply-templates select=".">
185 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
186 <xsl:with-param name="PARAM" select="$PARAM"/>
187 <xsl:with-param name="PAREN" select="$PAREN"/>
188 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
189 </xsl:apply-templates>
190 <m:annotation-xml encoding="MathML">
191 <xsl:copy-of select="."/>
197 <xsl:when test="$SEM_SW=3 and @id">
198 <m:mrow idref="{@id}">
199 <xsl:apply-templates select=".">
200 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
201 <xsl:with-param name="PARAM" select="$PARAM"/>
202 <xsl:with-param name="PAREN" select="$PAREN"/>
203 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
204 </xsl:apply-templates>
208 <xsl:apply-templates select=".">
209 <xsl:with-param name="IN_PREC" select="$IN_PREC"/>
210 <xsl:with-param name="PARAM" select="$PARAM"/>
211 <xsl:with-param name="PAREN" select="$PAREN"/>
212 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
213 </xsl:apply-templates>
218 <xsl:template match = "m:semantics">
219 <xsl:apply-templates select="*[1]" mode = "semantics"/>
223 <!-- BASIC ELEMENTS -->
225 <xsl:template match = "m:cn">
226 <xsl:param name="IN_PREC" select="$NO_PREC"/>
227 <xsl:param name="PAREN" select="$PAR_NO"/>
228 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
230 <xsl:when test=". < 0 and $IN_PREC > 0 and $PAREN=$PAR_NO and $PAR_NO_IGNORE=$NO">
231 <m:mfenced separators="">
232 <xsl:apply-templates select="." mode="cn"/>
236 <xsl:apply-templates select="." mode="cn"/>
241 <xsl:template match = "m:cn" mode="cn">
243 <xsl:when test="@base and (not(@type) or @type='integer' or @type='real')">
245 <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
246 <m:mn> <xsl:value-of select="@base"/> </m:mn>
249 <xsl:when test="@type='complex' and not(@base) and child::m:sep[1]">
250 <m:mfenced separators="">
251 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
252 <xsl:if test="text()[2] < 0">
254 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
256 <xsl:if test="not(text()[2] < 0)">
258 <xsl:apply-templates select="text()[2]" mode = "semantics"/>
260 <m:mo> <mchar name="InvisibleTimes"/> </m:mo>
264 <xsl:when test="@type='complex' and @base and child::m:sep[1]">
266 <m:mfenced separators="">
267 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
268 <xsl:if test="text()[2] < 0">
270 <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
272 <xsl:if test="not(text()[2] < 0)">
274 <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
276 <m:mo> <mchar name="InvisibleTimes"/> </m:mo>
279 <m:mn> <xsl:value-of select="@base"/> </m:mn>
282 <xsl:when test="@type='rational' and not(@base) and child::m:sep[1]">
284 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
286 <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
289 <xsl:when test="@type='rational' and @base and child::m:sep[1]">
291 <m:mfenced separators="">
292 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
294 <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
296 <m:mn> <xsl:value-of select="@base"/> </m:mn>
299 <xsl:when test="@type='polar' and not(@base) and child::m:sep[1]">
302 <m:mfenced separators=",">
303 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
304 <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
308 <xsl:when test="@type='polar' and @base and child::m:sep[1]">
312 <m:mfenced separators=",">
313 <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
314 <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
317 <m:mn> <xsl:value-of select="@base"/> </m:mn>
322 <xsl:call-template name="insert"/>
323 <xsl:apply-templates mode = "semantics"/>
329 <xsl:template match = "m:ci">
331 <xsl:when test="@type='vector' or @type=matrix or @type=set">
332 <m:mi fontweight="bold"> <xsl:apply-templates mode = "semantics"/> </m:mi>
336 <xsl:call-template name="insert"/>
337 <xsl:apply-templates mode = "semantics"/>
343 <xsl:template match = "m:csymbol">
345 <xsl:when test="*[1]">
346 <xsl:copy-of select = "*"/>
349 <m:mo> <xsl:apply-templates mode = "semantics"/> </m:mo>
355 <!-- BASIC CONTENT ELEMENTS -->
357 <xsl:template match = "m:apply[m:fn[1]]">
359 <xsl:apply-templates select = "m:fn[1]" mode = "semantics"/>
360 <m:mfenced separators=",">
361 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
366 <xsl:template match = "m:fn">
367 <xsl:apply-templates select = "*[1]" mode = "semantics">
368 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
369 </xsl:apply-templates>
372 <xsl:template match = "m:interval">
374 <xsl:when test="@closure='closed'">
375 <m:mfenced open="[" close="]" separators=",">
376 <xsl:apply-templates mode = "semantics"/>
379 <xsl:when test="@closure='open'">
380 <m:mfenced separators=",">
381 <xsl:apply-templates mode = "semantics"/>
384 <xsl:when test="@closure='open-closed'">
385 <m:mfenced open="(" close="]" separators=",">
386 <xsl:apply-templates mode = "semantics"/>
389 <xsl:when test="@closure='closed-open'">
390 <m:mfenced open="[" close=")" separators=",">
391 <xsl:apply-templates mode = "semantics"/>
395 <m:mfenced open="[" close="]" separators=",">
396 <xsl:apply-templates mode = "semantics"/>
402 <xsl:template match = "m:apply[m:*[1][self::m:apply[m:inverse[1]]]]">
404 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
405 <m:mfenced separators=",">
406 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
411 <!-- These "semantical" Transformations are REALLY questionable.
414 <xsl:template match = "m:apply[*[1][self::m:inverse]]">
416 <xsl:when test="*[2]=m:exp">
419 <xsl:when test="*[2]=m:ln | m:log">
422 <xsl:when test="*[2]=m:sin">
425 <xsl:when test="*[2]=m:cos">
428 <xsl:when test="*[2]=m:tan">
431 <xsl:when test="*[2]=m:sec">
434 <xsl:when test="*[2]=m:csc">
437 <xsl:when test="*[2]=m:cot">
440 <xsl:when test="*[2]=m:sinh">
443 <xsl:when test="*[2]=m:cosh">
446 <xsl:when test="*[2]=m:tanh">
449 <xsl:when test="*[2]=m:sech">
452 <xsl:when test="*[2]=m:csch">
455 <xsl:when test="*[2]=m:coth">
458 <xsl:when test="*[2]=m:arcsin">
461 <xsl:when test="*[2]=m:arccos">
464 <xsl:when test="*[2]=m:arctan">
469 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
478 <xsl:template match = "m:sep"/>
480 <xsl:template match = "m:condition">
482 <xsl:when test="parent::m:apply[m:forall[1]]"/>
484 <xsl:if test="not(*[2])">
485 <xsl:apply-templates mode = "semantics"/>
489 <xsl:apply-templates mode = "semantics"/>
496 <xsl:template match = "m:declare"/>
498 <xsl:template match = "m:lambda">
500 <m:mo> Λ </m:mo>
501 <m:mfenced separators=",">
502 <xsl:for-each select = "*">
504 <xsl:when test="self::m:ci or self::m:cn">
505 <xsl:apply-templates select = "." mode="semantics"/>
509 <xsl:apply-templates select = "." mode="semantics"/>
518 <xsl:template match = "m:apply[m:*[1][self::m:apply[m:compose[1]]]]">
520 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
521 <m:mfenced separators=",">
522 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
527 <xsl:template match = "m:apply[*[1][self::m:compose]]">
528 <m:mfenced separators="">
529 <xsl:apply-templates select = "m:*[2][self::m:ci[@type='fn'] | self::m:fn]" mode="semantics"/>
530 <xsl:for-each select = "m:*[position()>2][self::m:ci[@type='fn'] | self::m:fn]">
531 <m:mo> <xsl:call-template name="insert2"/> <mchar name="SmallCircle"/> </m:mo>
532 <xsl:apply-templates select = "." mode="semantics"/>
537 <xsl:template match = "m:ident">
542 <!-- ARITHMETIC, ALGEBRA & LOGIC -->
544 <xsl:template match = "m:apply[m:quotient[1]]">
545 <m:mfenced open="⌊" close="⌋" separators="">
546 <xsl:call-template name="insert_xref"/>
547 <xsl:apply-templates select="*[2]" mode = "semantics">
548 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
549 </xsl:apply-templates>
550 <m:mo><xsl:call-template name="insert1"/>/</m:mo>
551 <xsl:apply-templates select="*[3]" mode = "semantics">
552 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
553 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
554 </xsl:apply-templates>
558 <xsl:template match = "m:apply[*[1][self::m:exp]]">
561 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
565 <xsl:template match = "m:apply[m:factorial[1]]">
567 <xsl:call-template name="insert_xref"/>
568 <xsl:apply-templates select = "*[2]" mode = "semantics">
569 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
570 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
571 </xsl:apply-templates>
572 <m:mo><xsl:call-template name="insert1"/>!</m:mo>
576 <xsl:template match = "m:apply[m:max[1] | m:min[1]]">
578 <xsl:call-template name="insert_xref"/>
579 <xsl:if test="*[2]=m:bvar">
581 <xsl:if test="*[1]=m:max">
582 <m:mo><xsl:call-template name="insert1"/>max</m:mo>
584 <xsl:if test="*[1]=m:min">
587 <xsl:apply-templates select="*[2]" mode = "semantics"/>
589 <xsl:if test="*[3]=m:condition">
590 <m:mfenced open="{{" close="}}" separators="">
591 <m:mfenced open="" close="" separators=",">
592 <xsl:for-each select = "*[position()>3]">
593 <xsl:apply-templates select = "." mode="semantics"/>
597 <xsl:apply-templates select="*[3]" mode = "semantics"/>
600 <xsl:if test="not(*[3]=m:condition)">
601 <m:mfenced open="{{" close="}}" separators=",">
602 <xsl:for-each select = "*[position()>2]">
603 <xsl:apply-templates select = "." mode="semantics"/>
608 <xsl:if test="*[2]=m:condition">
609 <xsl:if test="*[1]=m:max">
612 <xsl:if test="*[1]=m:min">
615 <m:mfenced open="{{" close="}}" separators="">
617 <m:mfenced open="" close="" separators=",">
618 <xsl:for-each select = "*[position()>2]">
619 <xsl:apply-templates select = "." mode="semantics"/>
624 <xsl:apply-templates select="*[2]" mode = "semantics"/>
627 <xsl:if test="not(*[2]=m:condition) and not(*[2]=m:bvar)">
628 <xsl:if test="*[1]=m:max">
631 <xsl:if test="*[1]=m:min">
632 <m:mo><xsl:call-template name="insert1"/>min</m:mo>
634 <m:mfenced open="{{" close="}}" separators=",">
635 <xsl:for-each select = "*[position()>1]">
636 <xsl:apply-templates select = "." mode="semantics"/>
643 <xsl:template match = "m:apply[m:minus[1]]">
644 <xsl:param name="IN_PREC" select="$NO_PREC"/>
645 <xsl:param name="PARAM" select="$NO_PARAM"/>
646 <xsl:param name="PAREN" select="$PAR_NO"/>
647 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
649 <xsl:when test="$IN_PREC > $MINUS_PREC or $IN_PREC=$MINUS_PREC and $PARAM=$PAR_SAME">
650 <m:mfenced separators="">
651 <xsl:call-template name="insert_xref"/>
652 <xsl:apply-templates select="." mode="minus">
653 <xsl:with-param name="PARAM" select="$PARAM"/>
654 <xsl:with-param name="PAREN" select="$PAR_YES"/>
655 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
656 </xsl:apply-templates>
659 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
660 <xsl:apply-templates select="." mode="minus">
661 <xsl:with-param name="PARAM" select="$PARAM"/>
662 <xsl:with-param name="PAREN" select="$PAREN"/>
663 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
664 </xsl:apply-templates>
668 <xsl:call-template name="insert_xref"/>
669 <xsl:apply-templates select="." mode="minus">
670 <xsl:with-param name="PARAM" select="$PARAM"/>
671 <xsl:with-param name="PAREN" select="$PAREN"/>
672 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
673 </xsl:apply-templates>
679 <xsl:template match = "m:apply[m:minus[1]]" mode="minus">
680 <xsl:param name="PARAM" select="$NO_PARAM"/>
681 <xsl:param name="PAREN" select="$PAR_NO"/>
682 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
683 <xsl:if test="not(*[3])">
684 <m:mo><xsl:call-template name="insert1"/>-</m:mo>
685 <xsl:apply-templates select="*[2]" mode = "semantics">
686 <xsl:with-param name="IN_PREC" select="$NEG_PREC"/>
687 <xsl:with-param name="PAREN" select="$PAREN"/>
688 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
689 </xsl:apply-templates>
692 <xsl:apply-templates select="*[2]" mode = "semantics">
693 <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
694 <xsl:with-param name="PARAM" select="$PARAM"/>
695 <xsl:with-param name="PAREN" select="$PAREN"/>
696 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
697 </xsl:apply-templates>
698 <m:mo><xsl:call-template name="insert1"/>-</m:mo>
699 <xsl:apply-templates select="*[3]" mode = "semantics">
700 <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
701 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
702 <xsl:with-param name="PAREN" select="$PAREN"/>
703 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
704 </xsl:apply-templates>
708 <xsl:template match = "m:apply[m:plus[1]]">
709 <xsl:param name="IN_PREC" select="$NO_PREC"/>
710 <xsl:param name="PARAM" select="$NO_PARAM"/>
711 <xsl:param name="PAREN" select="$PAR_NO"/>
712 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
714 <xsl:when test="$IN_PREC > $PLUS_PREC or $IN_PREC=$PLUS_PREC and $PARAM=$PAR_SAME">
715 <m:mfenced separators="">
716 <xsl:call-template name="insert_xref"/>
717 <xsl:apply-templates select="." mode="plus">
718 <xsl:with-param name="PARAM" select="$IN_PREC"/>
719 <xsl:with-param name="PAREN" select="$PAR_YES"/>
720 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
721 </xsl:apply-templates>
724 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
725 <xsl:apply-templates select="." mode="plus">
726 <xsl:with-param name="PARAM" select="$PARAM"/>
727 <xsl:with-param name="PAREN" select="$PAREN"/>
728 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
729 </xsl:apply-templates>
733 <xsl:call-template name="insert_xref"/>
734 <xsl:apply-templates select="." mode="plus">
735 <xsl:with-param name="PARAM" select="$IN_PREC"/>
736 <xsl:with-param name="PAREN" select="$PAREN"/>
737 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
738 </xsl:apply-templates>
744 <xsl:template match = "m:apply[m:plus[1]]" mode="plus">
745 <xsl:param name="PARAM" select="$NO_PARAM"/>
746 <xsl:param name="PAREN" select="$PAR_NO"/>
747 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
749 <xsl:apply-templates select="*[2]" mode = "semantics">
750 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
751 <xsl:with-param name="PARAM" select="$PARAM"/>
752 <xsl:with-param name="PAREN" select="$PAREN"/>
753 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
754 </xsl:apply-templates>
755 <xsl:for-each select = "*[position()>2]">
757 <xsl:when test=". < 0">
759 <m:mn> <xsl:value-of select="-."/> </m:mn>
761 <xsl:when test="self::m:apply[m:minus[1]] and not(*[3])">
762 <xsl:apply-templates select="." mode = "semantics">
763 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
764 <xsl:with-param name="PAREN" select="$PAREN"/>
765 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
766 </xsl:apply-templates>
769 <m:mo><xsl:call-template name="insert2"/>+</m:mo>
770 <xsl:apply-templates select="." mode = "semantics">
771 <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
772 <xsl:with-param name="PAREN" select="$PAREN"/>
773 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
774 </xsl:apply-templates>
781 <xsl:template match = "m:apply[m:power[1]]">
783 <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]]">
784 <xsl:apply-templates select="*[2]" mode = "semantics"/>
788 <xsl:apply-templates select = "*[2]" mode = "semantics">
789 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
790 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
791 </xsl:apply-templates>
792 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
798 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]">
799 <xsl:param name="IN_PREC" select="$NO_PREC"/>
800 <xsl:param name="PARAM" select="$NO_PARAM"/>
801 <xsl:param name="PAREN" select="$PAR_NO"/>
802 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
804 <xsl:when test="$IN_PREC > $DIV_PREC or $IN_PREC=$DIV_PREC and $PARAM=$PAR_SAME">
805 <m:mfenced separators="">
806 <xsl:call-template name="insert_xref"/>
807 <xsl:apply-templates select="." mode="remdiv">
808 <xsl:with-param name="PARAM" select="$IN_PREC"/>
809 <xsl:with-param name="PAREN" select="$PAR_YES"/>
810 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
811 </xsl:apply-templates>
814 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
815 <xsl:apply-templates select="." mode="remdiv">
816 <xsl:with-param name="PARAM" select="$PARAM"/>
817 <xsl:with-param name="PAREN" select="$PAREN"/>
818 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
819 </xsl:apply-templates>
823 <xsl:call-template name="insert_xref"/>
824 <xsl:apply-templates select="." mode="remdiv">
825 <xsl:with-param name="PARAM" select="$IN_PREC"/>
826 <xsl:with-param name="PAREN" select="$PAREN"/>
827 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
828 </xsl:apply-templates>
834 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]" mode="remdiv">
835 <xsl:param name="PARAM" select="$NO_PARAM"/>
836 <xsl:param name="PAREN" select="$PAR_NO"/>
837 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
838 <xsl:apply-templates select = "*[2]" mode = "semantics">
839 <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
840 <xsl:with-param name="PARAM" select="$PARAM"/>
841 <xsl:with-param name="PAREN" select="$PAREN"/>
842 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
843 </xsl:apply-templates>
844 <xsl:if test="m:rem">
845 <m:mo><xsl:call-template name="insert1"/>%</m:mo>
847 <xsl:if test="m:divide">
848 <m:mo><xsl:call-template name="insert1"/>/</m:mo>
850 <xsl:apply-templates select = "*[3]" mode = "semantics">
851 <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
852 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
853 <xsl:with-param name="PAREN" select="$PAREN"/>
854 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
855 </xsl:apply-templates>
858 <xsl:template match = "m:apply[m:times[1]]">
859 <xsl:param name="IN_PREC" select="$NO_PREC"/>
860 <xsl:param name="PARAM" select="$NO_PARAM"/>
861 <xsl:param name="PAREN" select="$PAR_NO"/>
862 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
864 <xsl:when test="$IN_PREC > $MUL_PREC or $IN_PREC=$MUL_PREC and $PARAM=$PAR_SAME">
865 <m:mfenced separators="">
866 <xsl:call-template name="insert_xref"/>
867 <xsl:apply-templates select="." mode="times">
868 <xsl:with-param name="PARAM" select="$IN_PREC"/>
869 <xsl:with-param name="PAREN" select="$PAR_YES"/>
870 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
871 </xsl:apply-templates>
874 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
875 <xsl:apply-templates select="." mode="times">
876 <xsl:with-param name="PARAM" select="$PARAM"/>
877 <xsl:with-param name="PAREN" select="$PAREN"/>
878 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
879 </xsl:apply-templates>
883 <xsl:call-template name="insert_xref"/>
884 <xsl:apply-templates select="." mode="times">
885 <xsl:with-param name="PARAM" select="$IN_PREC"/>
886 <xsl:with-param name="PAREN" select="$PAREN"/>
887 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
888 </xsl:apply-templates>
894 <xsl:template match = "m:apply[m:times[1]]" mode="times">
895 <xsl:param name="PARAM" select="$NO_PARAM"/>
896 <xsl:param name="PAREN" select="$PAR_NO"/>
897 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
898 <xsl:apply-templates select="*[2]" mode = "semantics">
899 <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
900 <xsl:with-param name="PARAM" select="$PARAM"/>
901 <xsl:with-param name="PAREN" select="$PAREN"/>
902 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
903 </xsl:apply-templates>
905 <xsl:for-each select = "*[position()>2]">
906 <!-- MODIFICA PROVVISORIA -->
907 <!-- <m:mo><xsl:call-template name="insert2"/>
908 <mchar name="InvisibleTimes"/> </m:mo> -->
909 <m:mo><xsl:call-template name="insert2"/>*</m:mo>
910 <xsl:apply-templates select="." mode = "semantics">
911 <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
912 <xsl:with-param name="PAREN" select="$PAREN"/>
913 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
914 </xsl:apply-templates>
919 <!-- COMMENTO : dove metto la uri della definizione di radice ???? -->
921 <xsl:template match = "m:apply[m:root[1]]">
923 <xsl:call-template name="insert_xref"/>
924 <xsl:if test="*[2]=m:degree">
925 <xsl:apply-templates select="*[3]" mode = "semantics"/>
926 <xsl:apply-templates select="*[2]" mode = "semantics"/>
928 <xsl:if test="not(*[2]=m:degree)">
929 <xsl:apply-templates select="*[2]" mode = "semantics"/>
935 <xsl:template match = "m:apply[m:gcd[1]]">
937 <xsl:call-template name="insert_xref"/>
938 <xsl:if test="not(parent::m:apply[m:power[1]])">
939 <m:mo><xsl:call-template name="insert1"/>gcd</m:mo>
941 <xsl:if test="parent::m:apply[m:power[1]]">
943 <m:mo><xsl:call-template name="insert1"/>gcd</m:mo>
944 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
947 <m:mfenced separators=",">
948 <xsl:for-each select = "*[position()>1]">
949 <xsl:apply-templates select = "." mode="semantics"/>
955 <xsl:template match = "m:apply[m:and[1]]">
956 <xsl:param name="IN_PREC" select="$NO_PREC"/>
957 <xsl:param name="PAREN" select="$PAR_NO"/>
958 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
960 <xsl:when test="$IN_PREC > $AND_PREC">
961 <m:mfenced separators="">
962 <xsl:call-template name="insert_xref"/>
963 <xsl:apply-templates select="." mode="and">
964 <xsl:with-param name="PARAM" select="$IN_PREC"/>
965 <xsl:with-param name="PAREN" select="$PAR_YES"/>
966 </xsl:apply-templates>
969 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
970 <xsl:apply-templates select="." mode="and">
971 <xsl:with-param name="PARAM" select="$IN_PREC"/>
972 <xsl:with-param name="PAREN" select="$PAREN"/>
973 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
974 </xsl:apply-templates>
978 <xsl:call-template name="insert_xref"/>
979 <xsl:apply-templates select="." mode="and">
980 <xsl:with-param name="PARAM" select="$IN_PREC"/>
981 <xsl:with-param name="PAREN" select="$PAREN"/>
982 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
983 </xsl:apply-templates>
989 <xsl:template match = "m:apply[m:and[1]]" mode="and">
990 <xsl:param name="PARAM" select="$NO_PARAM"/>
991 <xsl:param name="PAREN" select="$PAR_NO"/>
992 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
993 <xsl:apply-templates select="*[2]" mode = "semantics">
994 <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
995 <xsl:with-param name="PARAM" select="$PARAM"/>
996 <xsl:with-param name="PAREN" select="$PAREN"/>
997 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
998 </xsl:apply-templates>
999 <xsl:for-each select = "*[position()>2]">
1000 <m:mo><xsl:call-template name="insert2"/> <mchar name="wedge"/> </m:mo>
1001 <xsl:apply-templates select="." mode = "semantics">
1002 <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
1003 <xsl:with-param name="PAREN" select="$PAREN"/>
1004 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1005 </xsl:apply-templates>
1009 <xsl:template match = "m:apply[m:or[1]]">
1010 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1011 <xsl:param name="PAREN" select="$PAR_NO"/>
1012 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1014 <xsl:when test="$IN_PREC > $OR_PREC">
1015 <m:mfenced separators="">
1016 <xsl:call-template name="insert_xref"/>
1017 <xsl:apply-templates select="." mode="or">
1018 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1019 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1020 </xsl:apply-templates>
1023 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1024 <xsl:apply-templates select="." mode="or">
1025 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1026 <xsl:with-param name="PAREN" select="$PAREN"/>
1027 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1028 </xsl:apply-templates>
1032 <xsl:call-template name="insert_xref"/>
1033 <xsl:apply-templates select="." mode="or">
1034 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1035 <xsl:with-param name="PAREN" select="$PAREN"/>
1036 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1037 </xsl:apply-templates>
1043 <xsl:template match = "m:apply[m:or[1]]" mode="or">
1044 <xsl:param name="PARAM" select="$NO_PARAM"/>
1045 <xsl:param name="PAREN" select="$PAR_NO"/>
1046 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1047 <xsl:apply-templates select="*[2]" mode = "semantics">
1048 <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1049 <xsl:with-param name="PARAM" select="$PARAM"/>
1050 <xsl:with-param name="PAREN" select="$PAREN"/>
1051 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1052 </xsl:apply-templates>
1053 <xsl:for-each select = "*[position()>2]">
1054 <m:mo><xsl:call-template name="insert2"/> <mchar name="vee"/> </m:mo>
1055 <xsl:apply-templates select="." mode = "semantics">
1056 <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1057 <xsl:with-param name="PAREN" select="$PAREN"/>
1058 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1059 </xsl:apply-templates>
1063 <xsl:template match = "m:apply[m:xor[1]]">
1064 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1065 <xsl:param name="PAREN" select="$PAR_NO"/>
1066 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1068 <xsl:when test="$IN_PREC > $XOR_PREC">
1069 <m:mfenced separators="">
1070 <xsl:call-template name="insert_xref"/>
1071 <xsl:apply-templates select="." mode="xor">
1072 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1073 <xsl:with-param name="PAREN" select="$PAR_YES"/>
1074 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1075 </xsl:apply-templates>
1078 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1079 <xsl:apply-templates select="." mode="xor">
1080 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1081 <xsl:with-param name="PAREN" select="$PAREN"/>
1082 </xsl:apply-templates>
1086 <xsl:call-template name="insert_xref"/>
1087 <xsl:apply-templates select="." mode="xor">
1088 <xsl:with-param name="PARAM" select="$IN_PREC"/>
1089 <xsl:with-param name="PAREN" select="$PAREN"/>
1090 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1091 </xsl:apply-templates>
1097 <xsl:template match = "m:apply[m:xor[1]]" mode="xor">
1098 <xsl:param name="PARAM" select="$NO_PARAM"/>
1099 <xsl:param name="PAREN" select="$PAR_NO"/>
1100 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1101 <xsl:apply-templates select="*[2]" mode = "semantics">
1102 <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1103 <xsl:with-param name="PARAM" select="$PARAM"/>
1104 <xsl:with-param name="PAREN" select="$PAREN"/>
1105 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1106 </xsl:apply-templates>
1107 <xsl:for-each select = "*[position()>2]">
1108 <m:mo><xsl:call-template name="insert2"/> <mchar name="xor"/> </m:mo>
1109 <xsl:apply-templates select="." mode = "semantics">
1110 <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1111 <xsl:with-param name="PAREN" select="$PAREN"/>
1112 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1113 </xsl:apply-templates>
1117 <xsl:template match = "m:apply[m:not[1]]">
1119 <xsl:call-template name="insert_xref"/>
1120 <m:mo><xsl:call-template name="insert1"/>not</m:mo>
1121 <xsl:apply-templates select = "*[2]" mode = "semantics">
1122 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1123 </xsl:apply-templates>
1127 <xsl:template match = "m:apply[m:forall[1]]">
1129 <xsl:call-template name="insert_xref"/>
1130 <m:mo><xsl:call-template name="insert1"/>for all</m:mo>
1131 <m:mfenced separators=",">
1132 <xsl:for-each select = "m:bvar">
1133 <xsl:apply-templates select = "." mode="semantics"/>
1136 <xsl:if test="m:condition">
1138 <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1141 <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and not(self::m:condition)]" mode = "semantics"/>
1145 <xsl:template match = "m:apply[m:exists[1]]">
1147 <xsl:call-template name="insert_xref"/>
1148 <m:mo><xsl:call-template name="insert1"/> <mchar name="Exists"/> </m:mo>
1149 <m:mfenced separators=",">
1150 <xsl:for-each select = "m:bvar">
1151 <xsl:apply-templates select = "." mode="semantics"/>
1154 <xsl:if test="m:condition">
1156 <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1159 <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and not(self::m:condition)]" mode = "semantics"/>
1163 <xsl:template match = "m:apply[m:abs[1]]">
1164 <xsl:if test="not(parent::m:apply[m:power[1]])">
1165 <m:mfenced open="|" close="|" separators="">
1166 <xsl:call-template name="insert_xref"/>
1167 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1170 <xsl:if test="parent::m:apply[m:power[1]]">
1172 <m:mfenced open="|" close="|" separators="">
1173 <xsl:call-template name="insert_xref"/>
1174 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1176 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1181 <xsl:template match = "m:apply[m:conjugate[1]]">
1184 <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1186 <m:mo><xsl:call-template name="insert1"/> <mchar name="UnderBar"/> </m:mo>
1190 <xsl:template match = "m:apply[m:arg[1] | m:real[1] | m:imaginary[1]]">
1192 <xsl:call-template name="insert_xref"/>
1194 <xsl:when test="m:arg">
1195 <m:mo><xsl:call-template name="insert1"/>arg</m:mo>
1197 <xsl:when test="m:real">
1198 <m:mo><xsl:call-template name="insert1"/>Real</m:mo>
1200 <xsl:when test="m:imaginary">
1201 <m:mo><xsl:call-template name="insert1"/>Imaginary</m:mo>
1204 <m:mfenced separators="">
1205 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1213 <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]">
1215 <xsl:call-template name="insert_xref"/>
1216 <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">
1217 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1218 <xsl:if test="*[1]=m:neq">
1219 <m:mo><xsl:call-template name="insert1"/> <mchar name="NotEqual"/> </m:mo>
1221 <xsl:if test="*[1]=m:approx">
1222 <m:mo><xsl:call-template name="insert1"/> <mchar name="approxeq"/> </m:mo>
1224 <xsl:if test="*[1]=m:tendsto">
1225 <m:mo><xsl:call-template name="insert1"/> <mchar name="RightArrow"/> </m:mo>
1227 <xsl:if test="*[1]=m:implies">
1228 <m:mo><xsl:call-template name="insert1"/> <mchar name="DoubleRightArrow"/> </m:mo>
1230 <xsl:if test="*[1]=m:in">
1231 <m:mo><xsl:call-template name="insert1"/>
1232 <mchar name="Element"/>
1235 <xsl:if test="*[1]=m:notin">
1236 <m:mo><xsl:call-template name="insert1"/> <mchar name="NotElement"/> </m:mo>
1238 <xsl:if test="*[1]=m:notsubset">
1239 <m:mo> <xsl:call-template name="insert1"/> <mchar name="NotSubset"/> </m:mo>
1241 <xsl:if test="*[1]=m:notprsubset">
1242 <m:mo> <xsl:call-template name="insert1"/> <mchar name="NotSubsetEqual"/> </m:mo>
1244 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1245 <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='below']">
1246 <m:mo><xsl:call-template name="insert1"/>-</m:mo>
1248 <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='above']">
1249 <m:mo><xsl:call-template name="insert1"/>+</m:mo>
1252 <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">
1253 <xsl:apply-templates select = "*[2]" mode="semantics"/>
1254 <xsl:for-each select = "*[position()>2]">
1255 <xsl:if test="../*[self::m:subset][1]">
1256 <m:mo> <xsl:call-template name="insert2"/> <mchar name="SubsetEqual"/> </m:mo>
1258 <xsl:if test="../*[self::m:prsubset][1]">
1259 <m:mo> <xsl:call-template name="insert2"/><mchar name="subset"/> </m:mo>
1261 <xsl:if test="../*[self::m:eq][1]">
1262 <m:mo><xsl:call-template name="insert2"/>=</m:mo>
1264 <xsl:if test="../*[self::m:gt][1]">
1265 <m:mo><xsl:call-template name="insert2"/>></m:mo>
1267 <xsl:if test="../*[self::m:lt][1]">
1268 <m:mo><xsl:call-template name="insert2"/><</m:mo>
1270 <xsl:if test="../*[self::m:geq][1]">
1271 <m:mo><xsl:call-template name="insert2"/> <mchar name="geq"/> </m:mo>
1273 <xsl:if test="../*[self::m:leq][1]">
1274 <m:mo><xsl:call-template name="insert2"/> <mchar name="leq"/> </m:mo>
1276 <xsl:if test="../*[self::m:equivalent][1]">
1277 <m:mo><xsl:call-template name="insert2"/> <mchar name="Congruent"/> </m:mo>
1279 <xsl:apply-templates select = "." mode="semantics"/>
1288 <xsl:template match = "m:apply[*[1][self::m:ln]]">
1290 <xsl:call-template name="insert_xref"/>
1292 <xsl:when test="parent::m:apply[m:power[1]]">
1294 <m:mo><xsl:call-template name="insert1"/>ln</m:mo>
1295 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1299 <m:mo><xsl:call-template name="insert1"/>ln</m:mo>
1302 <xsl:apply-templates select = "*[2]" mode = "semantics">
1303 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1304 </xsl:apply-templates>
1308 <xsl:template match = "m:apply[m:log[1]]">
1310 <xsl:call-template name="insert_xref"/>
1312 <xsl:when test="parent::m:apply[m:power[1]]">
1313 <xsl:if test="not(*[2]=m:logbase)">
1315 <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1316 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1319 <xsl:if test="*[2]=m:logbase">
1321 <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1322 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1323 <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
1328 <xsl:if test="not(*[2]=m:logbase)">
1329 <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1331 <xsl:if test="*[2]=m:logbase">
1333 <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1334 <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
1339 <xsl:if test="*[2]=m:logbase">
1340 <xsl:apply-templates select = "*[3]" mode = "semantics">
1341 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1342 </xsl:apply-templates>
1344 <xsl:if test="not(*[2]=m:logbase)">
1345 <xsl:apply-templates select = "*[2]" mode = "semantics">
1346 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1347 </xsl:apply-templates>
1352 <xsl:template match = "m:apply[m:diff[1]]">
1354 <xsl:call-template name="insert_xref"/>
1355 <xsl:if test="*[2]=m:bvar and m:bvar[*[2]=m:degree]">
1356 <m:mfrac><xsl:call-template name="insert1"/>
1359 <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
1364 <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
1365 <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
1370 <xsl:if test="*[2]=m:bvar and not(m:bvar[*[2]=m:degree])">
1371 <m:mfrac><xsl:call-template name="insert1"/>
1375 <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
1379 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1383 <xsl:template match = "m:apply[m:partialdiff[1]]">
1385 <xsl:call-template name="insert_xref"/>
1386 <xsl:for-each select = "m:bvar">
1387 <xsl:if test="*[last()]=m:degree">
1388 <m:mfrac><xsl:call-template name="insert1"/>
1391 <xsl:apply-templates select = "m:degree" mode = "semantics"/>
1396 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
1397 <xsl:apply-templates select = "m:degree" mode = "semantics"/>
1402 <xsl:if test="not(*[last()]=m:degree)">
1403 <m:mfrac><xsl:call-template name="insert1"/>
1407 <xsl:apply-templates select = "*[1]" mode = "semantics"/>
1412 <xsl:apply-templates select = "*[last()]" mode = "semantics"/>
1416 <xsl:template match = "m:lowlimit | m:uplimit | m:bvar | m:degree | m:logbase">
1417 <xsl:apply-templates mode = "semantics"/>
1420 <xsl:template match = "m:apply[m:divergence[1] | m:grad[1] | m:curl[1]]">
1422 <xsl:call-template name="insert_xref"/>
1423 <xsl:if test="*[1]=m:divergence">
1424 <m:mo><xsl:call-template name="insert1"/>div</m:mo>
1426 <xsl:if test="*[1]=m:grad">
1427 <m:mo><xsl:call-template name="insert1"/>grad</m:mo>
1429 <xsl:if test="*[1]=m:curl">
1430 <m:mo><xsl:call-template name="insert1"/>curl</m:mo>
1433 <xsl:when test="*[2]=m:ci">
1434 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1437 <m:mfenced separators="">
1438 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1445 <xsl:template match = "m:apply[m:laplacian[1]]">
1447 <xsl:call-template name="insert_xref"/>
1448 <m:msup><xsl:call-template name="insert1"/>
1449 <m:mo> Δ </m:mo>
1452 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1459 <xsl:template match = "m:set | m:list">
1460 <m:mfenced open="{{" close="}}" separators="">
1461 <xsl:call-template name="insert_xref"/>
1462 <xsl:if test="*[1]=m:bvar and *[2]=m:condition">
1463 <xsl:apply-templates select="m:bvar" mode = "semantics"/>
1465 <xsl:apply-templates select="m:condition" mode = "semantics"/>
1467 <xsl:if test="*[1]=m:condition and not(child::m:bvar)">
1468 <m:mfenced open="" close="" separators=",">
1469 <xsl:for-each select = "*[not(self::m:condition) and not(self::m:bvar)]">
1470 <xsl:apply-templates select = "." mode="semantics"/>
1474 <xsl:apply-templates select="m:condition" mode = "semantics"/>
1476 <xsl:if test="not(child::m:bvar) and not(child::m:condition)">
1477 <m:mfenced open="" close="" separators=",">
1478 <xsl:for-each select = "*">
1479 <xsl:apply-templates select = "." mode="semantics"/>
1486 <xsl:template match = "m:apply[m:union[1]]">
1487 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1488 <xsl:param name="PARAM" select="$NO_PARAM"/>
1489 <xsl:param name="PAREN" select="$PAR_NO"/>
1490 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1492 <xsl:when test="$IN_PREC > $UNION_PREC or $IN_PREC=$UNION_PREC and $PARAM=$PAR_SAME">
1493 <m:mfenced separators="" helm:xref="{@helm:xref}">
1494 <xsl:call-template name="insert_xref"/>
1495 <xsl:apply-templates select="." mode="union">
1496 <xsl:with-param name="PARAM" select="$PARAM"/>
1497 <xsl:with-param name="PAREN" select="$PAREN"/>
1498 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1499 </xsl:apply-templates>
1502 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1503 <xsl:apply-templates select="." mode="union">
1504 <xsl:with-param name="PARAM" select="$PARAM"/>
1505 <xsl:with-param name="PAREN" select="$PAREN"/>
1506 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1507 </xsl:apply-templates>
1511 <xsl:call-template name="insert_xref"/>
1512 <xsl:apply-templates select="." mode="union">
1513 <xsl:with-param name="PARAM" select="$PARAM"/>
1514 <xsl:with-param name="PAREN" select="$PAREN"/>
1515 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1516 </xsl:apply-templates>
1522 <xsl:template match = "m:apply[m:union[1]]" mode="union">
1523 <xsl:param name="PARAM" select="$NO_PARAM"/>
1524 <xsl:param name="PAREN" select="$PAR_NO"/>
1525 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1526 <xsl:apply-templates select = "*[2]" mode="semantics">
1527 <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
1528 <xsl:with-param name="PARAM" select="$PARAM"/>
1529 <xsl:with-param name="PAREN" select="$PAREN"/>
1530 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1531 </xsl:apply-templates>
1532 <xsl:for-each select = "*[position()>2]">
1533 <m:mo><xsl:call-template name="insert2"/> <mchar name="Union"/> </m:mo>
1534 <xsl:apply-templates select = "." mode="semantics">
1535 <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
1536 <xsl:with-param name="PAREN" select="$PAREN"/>
1537 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1538 </xsl:apply-templates>
1542 <xsl:template match = "m:apply[m:intersect[1]]">
1543 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1544 <xsl:param name="PARAM" select="$NO_PARAM"/>
1545 <xsl:param name="PAREN" select="$PAR_NO"/>
1546 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1548 <xsl:when test="$IN_PREC > $INTERSECT_PREC">
1549 <m:mfenced separators="" helm:xref="{@helm:xref}">
1550 <xsl:call-template name="insert_xref"/>
1551 <xsl:apply-templates select="." mode="intersect">
1552 <xsl:with-param name="PARAM" select="$PARAM"/>
1553 <xsl:with-param name="PAREN" select="$PAREN"/>
1554 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1555 </xsl:apply-templates>
1558 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1559 <xsl:apply-templates select="." mode="intersect">
1560 <xsl:with-param name="PARAM" select="$PARAM"/>
1561 <xsl:with-param name="PAREN" select="$PAREN"/>
1562 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1563 </xsl:apply-templates>
1567 <xsl:call-template name="insert_xref"/>
1568 <xsl:apply-templates select="." mode="intersect">
1569 <xsl:with-param name="PARAM" select="$PARAM"/>
1570 <xsl:with-param name="PAREN" select="$PAREN"/>
1571 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1572 </xsl:apply-templates>
1578 <xsl:template match = "m:apply[m:intersect[1]]" mode="intersect">
1579 <xsl:param name="PARAM" select="$NO_PARAM"/>
1580 <xsl:param name="PAREN" select="$PAR_NO"/>
1581 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1582 <xsl:apply-templates select = "*[2]" mode="semantics">
1583 <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
1584 <xsl:with-param name="PARAM" select="$PARAM"/>
1585 <xsl:with-param name="PAREN" select="$PAREN"/>
1586 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1587 </xsl:apply-templates>
1588 <xsl:for-each select = "*[position()>2]">
1589 <m:mo><xsl:call-template name="insert2"/> <mchar name="Intersection"/> </m:mo>
1590 <xsl:apply-templates select = "." mode="semantics">
1591 <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
1592 <xsl:with-param name="PAREN" select="$PAREN"/>
1593 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1594 </xsl:apply-templates>
1598 <xsl:template match = "m:apply[m:setdiff[1]]">
1599 <xsl:param name="IN_PREC" select="$NO_PREC"/>
1600 <xsl:param name="PARAM" select="$NO_PARAM"/>
1601 <xsl:param name="PAREN" select="$PAR_NO"/>
1602 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1604 <xsl:when test="$IN_PREC > $SETDIFF_PREC or $IN_PREC=$SETDIFF_PREC and $PARAM=$PAR_SAME">
1605 <m:mfenced separators="">
1606 <xsl:call-template name="insert_xref"/>
1607 <xsl:apply-templates select="." mode="setdiff">
1608 <xsl:with-param name="PARAM" select="$PARAM"/>
1609 <xsl:with-param name="PAREN" select="$PAREN"/>
1610 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1611 </xsl:apply-templates>
1614 <xsl:when test="$IN_PREC > $NO_PREC and $IN_PREC < $FUNCTION_PREC and not($SEM_SW=2)">
1615 <xsl:apply-templates select="." mode="setdiff">
1616 <xsl:with-param name="PARAM" select="$PARAM"/>
1617 <xsl:with-param name="PAREN" select="$PAREN"/>
1618 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1619 </xsl:apply-templates>
1623 <xsl:call-template name="insert_xref"/>
1624 <xsl:apply-templates select="." mode="setdiff">
1625 <xsl:with-param name="PARAM" select="$PARAM"/>
1626 <xsl:with-param name="PAREN" select="$PAREN"/>
1627 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1628 </xsl:apply-templates>
1634 <xsl:template match = "m:apply[m:setdiff[1]]" mode="setdiff">
1635 <xsl:param name="PARAM" select="$NO_PARAM"/>
1636 <xsl:param name="PAREN" select="$PAR_NO"/>
1637 <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1638 <xsl:apply-templates select = "*[2]" mode = "semantics">
1639 <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
1640 <xsl:with-param name="PARAM" select="$PARAM"/>
1641 <xsl:with-param name="PAREN" select="$PAREN"/>
1642 <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1643 </xsl:apply-templates>
1644 <m:mo><xsl:call-template name="insert1"/>\</m:mo>
1645 <xsl:apply-templates select = "*[3]" mode = "semantics">
1646 <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
1647 <xsl:with-param name="PARAM" select="$PAR_SAME"/>
1648 <xsl:with-param name="PAREN" select="$PAREN"/>
1649 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1650 </xsl:apply-templates>
1653 <xsl:template match = "m:apply[m:card[1]]">
1654 <m:mfenced open="|" close="|" separators=",">
1655 <xsl:call-template name="insert_xref"/>
1656 <xsl:for-each select = "*[position()>1]">
1657 <xsl:apply-templates select = "." mode="semantics"/>
1663 <!-- SEQUENCES AND SERIES -->
1665 <xsl:template match = "m:apply[m:sum[1] | m:product[1]]">
1667 <xsl:call-template name="insert_xref"/>
1669 <xsl:when test="*[2]=m:bvar and m:lowlimit and m:uplimit">
1671 <xsl:if test="*[1]=m:sum">
1672 <m:mo><xsl:call-template name="insert1"/> <mchar name="Sum"/> </m:mo>
1674 <xsl:if test="*[1]=m:product">
1675 <m:mo><xsl:call-template name="insert1"/> <mchar name="Product"/> </m:mo>
1678 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1680 <xsl:apply-templates select = "m:lowlimit" mode = "semantics"/>
1682 <xsl:apply-templates select = "m:uplimit" mode = "semantics"/>
1684 <xsl:apply-templates select = "*[5]" mode = "semantics"/>
1686 <xsl:when test="*[2]=m:bvar and *[3]=m:condition">
1688 <xsl:if test="*[1]=m:sum">
1689 <m:mo><xsl:call-template name="insert1"/> <mchar name="Sum"/> </m:mo>
1691 <xsl:if test="*[1]=m:product">
1692 <m:mo><xsl:call-template name="insert1"/> <mchar name="Product"/> </m:mo>
1694 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1696 <xsl:apply-templates select = "*[4]" mode = "semantics"/>
1702 <xsl:template match = "m:apply[m:limit[1]]">
1704 <xsl:call-template name="insert_xref"/>
1706 <m:mo><xsl:call-template name="insert1"/>lim</m:mo>
1708 <xsl:if test="*[2]=m:bvar and *[3]=m:lowlimit">
1709 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1710 <m:mo> <mchar name="RightArrow"/> </m:mo>
1711 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1713 <xsl:if test="*[2]=m:bvar and *[3]=m:condition">
1714 <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1718 <xsl:apply-templates select = "*[4]" mode = "semantics"/>
1723 <!-- TRIGONOMETRY -->
1725 <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]]">
1727 <xsl:call-template name="insert_xref"/>
1728 <xsl:if test="not(parent::m:apply[m:power[1]])">
1729 <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
1731 <xsl:if test="parent::m:apply[m:power[1]]">
1733 <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
1734 <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1737 <xsl:apply-templates select = "*[2]" mode = "semantics">
1738 <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1739 <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1740 </xsl:apply-templates>
1744 <xsl:template match = "m:*" mode = "trigonometry">
1746 <xsl:when test="self::m:sin">
1749 <xsl:when test="self::m:cos">
1752 <xsl:when test="self::m:tan">
1755 <xsl:when test="self::m:sec">
1758 <xsl:when test="self::m:csc">
1761 <xsl:when test="self::m:cot">
1764 <xsl:when test="self::m:sinh">
1767 <xsl:when test="self::m:cosh">
1770 <xsl:when test="self::m:tanh">
1773 <xsl:when test="self::m:sech">
1776 <xsl:when test="self::m:csch">
1779 <xsl:when test="self::m:coth">
1782 <xsl:when test="self::m:arcsin">
1785 <xsl:when test="self::m:arccos">
1788 <xsl:when test="self::m:arctan">
1797 <xsl:template match = "m:apply[m:mean[1]]">
1798 <m:mfenced open="<" close=">" separators=",">
1799 <xsl:call-template name="insert_xref"/>
1800 <xsl:for-each select = "*[position()>1]">
1801 <xsl:apply-templates select = "." mode="semantics"/>
1806 <xsl:template match = "m:apply[m:sdev[1]]">
1808 <xsl:call-template name="insert_xref"/>
1809 <m:mo><xsl:call-template name="insert1"/> σ </m:mo>
1810 <m:mfenced separators=",">
1811 <xsl:for-each select = "*[position()>1]">
1812 <xsl:apply-templates select = "." mode="semantics"/>
1818 <xsl:template match = "m:apply[m:variance[1]]">
1820 <xsl:call-template name="insert_xref"/>
1821 <m:mo><xsl:call-template name="insert1"/> σ </m:mo>
1823 <m:mfenced separators=",">
1824 <xsl:for-each select = "*[position()>1]">
1825 <xsl:apply-templates select = "." mode="semantics"/>
1833 <xsl:template match = "m:apply[m:median[1]]">
1835 <xsl:call-template name="insert_xref"/>
1836 <m:mo><xsl:call-template name="insert1"/>median</m:mo>
1837 <m:mfenced separators=",">
1838 <xsl:for-each select = "*[position()>1]">
1839 <xsl:apply-templates select = "." mode="semantics"/>
1845 <xsl:template match = "m:apply[m:mode[1]]">
1847 <xsl:call-template name="insert_xref"/>
1848 <m:mo><xsl:call-template name="insert1"/>mode</m:mo>
1849 <m:mfenced separators=",">
1850 <xsl:for-each select = "*[position()>1]">
1851 <xsl:apply-templates select = "." mode="semantics"/>
1857 <xsl:template match = "m:apply[m:moment[1]]">
1858 <xsl:call-template name="insert_xref"/>
1859 <m:mfenced open="<" close=">" separators="">
1860 <xsl:if test="*[2]=m:degree">
1862 <xsl:apply-templates select="*[3]" mode = "semantics"/>
1863 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1866 <xsl:if test="not(*[2]=m:degree)">
1867 <xsl:for-each select = "*[position()>1]">
1868 <xsl:apply-templates select = "." mode="semantics"/>
1875 <!-- LINEAR ALGEBRA -->
1877 <xsl:template match="m:vector">
1878 <m:mfenced separators="">
1880 <xsl:for-each select="*">
1882 <xsl:apply-templates select="." mode = "semantics"/>
1889 <xsl:template match = "m:matrix">
1890 <m:mfenced separators="">
1892 <xsl:apply-templates mode = "semantics"/>
1897 <xsl:template match = "m:matrixrow">
1899 <xsl:for-each select="*">
1901 <xsl:apply-templates select="." mode = "semantics"/>
1907 <xsl:template match = "m:apply[m:determinant[1]]">
1909 <xsl:call-template name="insert_xref"/>
1910 <m:mo><xsl:call-template name="insert1"/>det</m:mo>
1911 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1915 <xsl:template match = "m:apply[m:transpose[1]]">
1917 <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1922 <xsl:template match = "m:apply[m:selector[1]]">
1923 <xsl:if test="*[2]=m:matrix and *[3]=m:cn">
1924 <xsl:variable name="m" select = "*[3]"/>
1926 <xsl:when test="*[4]=m:cn">
1927 <xsl:variable name="n" select = "*[4]"/>
1928 <xsl:copy-of select = "m:matrix/*[position()=$m]/*[position()=$n]"/>
1931 <xsl:copy-of select = "m:matrix/*[position()=$m]"/>
1935 <xsl:if test="(*[2]=m:vector or *[2]=m:list) and *[3]=m:cn">
1936 <xsl:variable name="m" select = "*[3]"/>
1937 <xsl:copy-of select = "*[2]/*[position()=$m]"/>
1941 <xsl:template match = "m:apply[m:vectorproduct[1] | m:scalarproduct[1] | m:outerproduct[1]]">
1943 <xsl:call-template name="insert_xref"/>
1944 <xsl:apply-templates select="*[2]" mode = "semantics"/>
1946 <xsl:when test="m:vectorproduct[1]">
1947 <m:mo><xsl:call-template name="insert1"/> <mchar name="Cross"/> </m:mo>
1949 <xsl:when test="m:scalarproduct[1] | m:outerproduct[1]">
1950 <m:mo><xsl:call-template name="insert1"/>.</m:mo>
1953 <xsl:apply-templates select="*[3]" mode = "semantics"/>