]> matita.cs.unibo.it Git - helm.git/blob - helm/style/mml2mmlv1_0.xsl
not simbol is now the logical one
[helm.git] / helm / style / mml2mmlv1_0.xsl
1 <?xml version="1.0"?>
2
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             -->
10 <!--                                                        -->
11 <!-- (C) Copyright 1999, 2000 Symbolic Computation          -->
12 <!--     Laboratory, University of Western Ontario.         -->
13 <!-- ====================================================== -->
14
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 <!-- ====================================================== -->
22
23 <!-- ====================================================== -->
24 <!--  June, 2000 - HELM group:                              -->
25 <!--  Added auxiliary function to insert:                    -->
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 <!-- ====================================================== -->
31
32
33 <!-- HELM: namespace helm added -->
34 <xsl:stylesheet id="mml2mml"
35                 version="1.0"
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">
40
41 <xsl:output method="xml" indent="yes" encoding="iso-8859-1"/>
42
43 <!-- ***************************************************** -->
44 <!--  Parameters affectin' stylesheet's run-time behavior  -->
45 <!-- ***************************************************** -->
46
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
52 -->
53 <!-- HELM: SEM_SW was 0 -->
54 <xsl:param name="SEM_SW" select="1"/>
55
56 <!-- Miscellaneous Variable Definitions -->
57
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"/>
64
65 <!-- Operator Precedence Definitions -->
66
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"/>
80
81 <!-- HELM: auxiliary functions for backwards pointers and refs -->
82
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"/>
87   </xsl:attribute>
88  </xsl:if>
89 </xsl:template>
90
91 <xsl:template name = "insert">
92  <xsl:if test="@definitionURL">
93   <xsl:attribute name="xlink:href">
94    <xsl:value-of select="@definitionURL"/>
95   </xsl:attribute>
96  </xsl:if>
97  <xsl:if test="@helm:xref">
98   <xsl:attribute name="helm:xref">
99    <xsl:value-of select="@helm:xref"/>
100   </xsl:attribute>
101  </xsl:if>
102 </xsl:template>
103
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"/>
109   </xsl:attribute>
110  </xsl:if>
111  <xsl:if test="*[1]/@helm:xref">
112   <xsl:attribute name="helm:xref">
113    <xsl:value-of select="*[1]/@helm:xref"/>
114   </xsl:attribute>
115  </xsl:if>
116 </xsl:template>
117
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"/>
123   </xsl:attribute>
124  </xsl:if>
125  <xsl:if test="../*[1]/@helm:xref">
126   <xsl:attribute name="helm:xref">
127    <xsl:value-of select="../*[1]/@helm:xref"/>
128   </xsl:attribute>
129  </xsl:if>
130 </xsl:template>
131
132 <!-- THE TOPMOST ELEMENT: MATH -->
133
134 <xsl:template match = "m:math">
135   <xsl:choose>
136     <xsl:when test="$SEM_SW>0">
137 <!-- HELM: deleted math (we have already inserted at object level) -->
138      <!--<m:math>-->
139       <m:semantics>
140           <xsl:apply-templates mode = "semantics"/>
141        <m:annotation-xml encoding="MathML">
142           <xsl:copy-of select = "*"/>
143        </m:annotation-xml>
144       </m:semantics>
145      <!--</m:math>-->
146     </xsl:when>
147     <xsl:otherwise>
148       <!--<m:math>-->
149         <xsl:apply-templates mode = "semantics"/>
150       <!--</m:math>-->  
151     </xsl:otherwise>
152   </xsl:choose>
153 </xsl:template>
154
155 <!-- SEMANTICS -->
156
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"/>
162   <xsl:choose>
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>
170     </xsl:when>
171     <xsl:when test="$SEM_SW=0 and self::m:semantics">
172       <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"/>
180       </m:semantics>
181     </xsl:when>
182     <xsl:when test="$SEM_SW=2">
183       <m:semantics>
184         <xsl:choose>
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"/>
193           </xsl:when>
194           <xsl:otherwise>
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="."/>
203             </m:annotation-xml>
204           </xsl:otherwise>
205         </xsl:choose>
206       </m:semantics>
207     </xsl:when>
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>
216       </m:mrow>
217     </xsl:when>
218     <xsl:otherwise>
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>
225     </xsl:otherwise>
226   </xsl:choose>
227 </xsl:template>
228
229 <xsl:template match = "m:semantics">
230   <xsl:apply-templates select="*[1]" mode = "semantics"/>
231 </xsl:template>
232
233
234 <!-- BASIC ELEMENTS -->
235
236 <!-- HELM: cn could not contain MAthMl presentation -->
237 <xsl:template match = "m:cn">
238   <xsl:param name="IN_PREC" select="$NO_PREC"/>
239   <xsl:param name="PAREN" select="$PAR_NO"/>
240   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
241 <!-- HELM: added -->
242 <xsl:choose>
243   <xsl:when test="child::text()">
244 <!-- HELM -->
245   <xsl:choose>
246     <xsl:when test=". &lt; 0 and $IN_PREC &gt; 0 and $PAREN=$PAR_NO and $PAR_NO_IGNORE=$NO">
247       <m:mfenced separators="">
248         <xsl:apply-templates select="." mode="cn"/>
249       </m:mfenced>
250     </xsl:when>
251     <xsl:otherwise>
252       <xsl:apply-templates select="." mode="cn"/>
253     </xsl:otherwise>
254   </xsl:choose>
255 <!-- HELM: added -->
256 </xsl:when>
257   <xsl:otherwise>
258    <xsl:copy-of select="*"/> 
259   </xsl:otherwise>
260  </xsl:choose>
261 <!-- HELM -->
262 </xsl:template>
263
264 <xsl:template match = "m:cn" mode="cn">
265   <xsl:choose>
266     <xsl:when test="@base and (not(@type) or @type='integer' or @type='real')">
267       <m:msub>
268         <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
269         <m:mn> <xsl:value-of select="@base"/> </m:mn>
270       </m:msub>
271     </xsl:when>
272     <xsl:when test="@type='complex' and not(@base) and child::m:sep[1]">
273       <m:mfenced separators="">
274         <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
275         <xsl:if test="text()[2] &lt; 0">
276           <m:mo>-</m:mo>
277           <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
278         </xsl:if>
279         <xsl:if test="not(text()[2] &lt; 0)">
280           <m:mo>+</m:mo>
281           <xsl:apply-templates select="text()[2]" mode = "semantics"/>
282         </xsl:if>
283         <m:mo> <mchar name="InvisibleTimes"/> </m:mo>
284         <m:mo>i</m:mo>
285       </m:mfenced>
286     </xsl:when>
287     <xsl:when test="@type='complex' and @base and child::m:sep[1]">
288       <m:msub>
289         <m:mfenced separators="">
290           <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
291           <xsl:if test="text()[2] &lt; 0">
292             <m:mo>-</m:mo>
293             <m:mn> <xsl:value-of select="-text()[2]"/> </m:mn>
294           </xsl:if>
295           <xsl:if test="not(text()[2] &lt; 0)">
296             <m:mo>+</m:mo>
297             <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
298           </xsl:if>
299           <m:mo> <mchar name="InvisibleTimes"/> </m:mo>
300           <m:mo>i</m:mo>
301         </m:mfenced>
302         <m:mn> <xsl:value-of select="@base"/> </m:mn>
303       </m:msub>
304     </xsl:when>
305     <xsl:when test="@type='rational' and not(@base) and child::m:sep[1]">
306       <m:mrow>
307         <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
308         <m:mo>/</m:mo>
309         <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
310       </m:mrow>
311     </xsl:when>
312     <xsl:when test="@type='rational' and @base and child::m:sep[1]">
313       <m:msub>
314         <m:mfenced separators="">
315           <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
316           <m:mo>/</m:mo>
317           <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
318         </m:mfenced>
319         <m:mn> <xsl:value-of select="@base"/> </m:mn>
320       </m:msub>
321     </xsl:when>
322     <xsl:when test="@type='polar' and not(@base) and child::m:sep[1]">
323       <m:mrow>
324         <m:mo>Polar</m:mo>
325         <m:mfenced separators=",">
326           <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
327           <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
328         </m:mfenced>
329       </m:mrow>
330     </xsl:when>
331     <xsl:when test="@type='polar' and @base and child::m:sep[1]">
332       <m:msub>
333         <m:mrow>
334           <m:mo>Polar</m:mo>
335           <m:mfenced separators=",">
336             <m:mn> <xsl:apply-templates select="text()[1]" mode = "semantics"/> </m:mn>
337             <m:mn> <xsl:apply-templates select="text()[2]" mode = "semantics"/> </m:mn>
338           </m:mfenced>
339         </m:mrow>
340         <m:mn> <xsl:value-of select="@base"/> </m:mn>
341       </m:msub>
342    </xsl:when>
343     <xsl:otherwise>
344       <m:mn> 
345        <xsl:call-template name="insert"/>
346        <xsl:apply-templates mode = "semantics"/> 
347       </m:mn>
348     </xsl:otherwise>
349   </xsl:choose>
350 </xsl:template>
351
352 <xsl:template match = "m:ci">
353   <xsl:choose>
354     <xsl:when test="@type='vector' or @type=matrix or @type=set">
355       <m:mi fontweight="bold"> <xsl:apply-templates mode = "semantics"/> </m:mi>
356     </xsl:when>
357     <xsl:otherwise>
358 <!-- HELM: ci could not contain MathML presentation 
359      <m:mi> 
360       <xsl:call-template name="insert"/>
361       <xsl:apply-templates mode = "semantics"/> 
362      </m:mi>
363 -->
364  <xsl:choose>
365   <!-- HELM: or the opposite test <xsl:when test="*[1]"> -->
366   <xsl:when test="child::text()">
367    <m:mi> 
368     <xsl:call-template name="insert"/>
369     <xsl:apply-templates mode = "semantics"/> 
370    </m:mi>
371   </xsl:when>
372   <xsl:otherwise>
373    <xsl:copy-of select="*"/>
374   </xsl:otherwise>
375  </xsl:choose>
376     </xsl:otherwise>
377   </xsl:choose>
378 </xsl:template>
379
380
381 <xsl:template match = "m:csymbol">
382    <xsl:choose>
383     <xsl:when test="*[1]">
384      <xsl:copy-of select = "*"/>
385     </xsl:when>
386    <xsl:otherwise>
387     <m:mo> <xsl:apply-templates mode = "semantics"/> </m:mo>
388    </xsl:otherwise>
389   </xsl:choose>
390 </xsl:template>
391
392
393 <!-- BASIC CONTENT ELEMENTS -->
394
395 <xsl:template match = "m:apply[m:fn[1]]">
396   <m:mrow>
397     <xsl:apply-templates select = "m:fn[1]" mode = "semantics"/>
398     <m:mfenced separators=",">
399       <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
400     </m:mfenced>
401   </m:mrow>
402 </xsl:template>
403
404 <xsl:template match = "m:fn">
405   <xsl:apply-templates select = "*[1]" mode = "semantics">
406     <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
407   </xsl:apply-templates>
408 </xsl:template>
409
410 <xsl:template match = "m:interval">
411   <xsl:choose>
412     <xsl:when test="@closure='closed'">
413       <m:mfenced open="[" close="]" separators=",">
414         <xsl:apply-templates mode = "semantics"/>
415       </m:mfenced>
416     </xsl:when>
417     <xsl:when test="@closure='open'">
418       <m:mfenced separators=",">
419         <xsl:apply-templates mode = "semantics"/>
420       </m:mfenced>
421     </xsl:when>
422     <xsl:when test="@closure='open-closed'">
423       <m:mfenced open="(" close="]" separators=",">
424         <xsl:apply-templates mode = "semantics"/>
425       </m:mfenced>
426     </xsl:when>
427     <xsl:when test="@closure='closed-open'">
428       <m:mfenced open="[" close=")" separators=",">
429         <xsl:apply-templates mode = "semantics"/>
430       </m:mfenced>
431     </xsl:when>
432     <xsl:otherwise>
433       <m:mfenced open="[" close="]" separators=",">
434         <xsl:apply-templates mode = "semantics"/>
435       </m:mfenced>
436     </xsl:otherwise>
437   </xsl:choose>
438 </xsl:template>
439
440 <xsl:template match = "m:apply[m:*[1][self::m:apply[m:inverse[1]]]]">
441   <m:mrow>
442     <xsl:apply-templates select = "*[1]" mode = "semantics"/>
443     <m:mfenced separators=",">
444       <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
445     </m:mfenced>
446  </m:mrow>
447 </xsl:template>
448
449 <!-- HELM: these "semantical" Transformations are REALLY questionable.
450      Andrea -->
451
452 <xsl:template match = "m:apply[*[1][self::m:inverse]]">
453   <xsl:choose>
454     <xsl:when test="*[2]=m:exp">
455       <m:mo>ln</m:mo>
456     </xsl:when>
457     <xsl:when test="*[2]=m:ln | m:log">
458       <m:mo>exp</m:mo>
459     </xsl:when>
460     <xsl:when test="*[2]=m:sin">
461       <m:mo>arcsin</m:mo>
462     </xsl:when>
463     <xsl:when test="*[2]=m:cos">
464       <m:mo>arccos</m:mo>
465     </xsl:when>
466     <xsl:when test="*[2]=m:tan">
467       <m:mo>arctan</m:mo>
468     </xsl:when>
469     <xsl:when test="*[2]=m:sec">
470       <m:mo>arcsec</m:mo>
471     </xsl:when>
472     <xsl:when test="*[2]=m:csc">
473       <m:mo>arccsc</m:mo>
474     </xsl:when>
475     <xsl:when test="*[2]=m:cot">
476       <m:mo>arccot</m:mo>
477     </xsl:when>
478     <xsl:when test="*[2]=m:sinh">
479       <m:mo>arcsinh</m:mo>
480     </xsl:when>
481     <xsl:when test="*[2]=m:cosh">
482       <m:mo>arccosh</m:mo>
483     </xsl:when>
484     <xsl:when test="*[2]=m:tanh">
485       <m:mo>arctanh</m:mo>
486     </xsl:when>
487     <xsl:when test="*[2]=m:sech">
488       <m:mo>arcsech</m:mo>
489     </xsl:when>
490     <xsl:when test="*[2]=m:csch">
491       <m:mo>arccsch</m:mo>
492     </xsl:when>
493     <xsl:when test="*[2]=m:coth">
494       <m:mo>arccoth</m:mo>
495     </xsl:when>
496     <xsl:when test="*[2]=m:arcsin">
497       <m:mo>sin</m:mo>
498     </xsl:when>
499     <xsl:when test="*[2]=m:arccos">
500       <m:mo>cos</m:mo>
501     </xsl:when>
502     <xsl:when test="*[2]=m:arctan">
503       <m:mo>tan</m:mo>
504     </xsl:when>
505     <xsl:otherwise>
506       <m:msup>
507         <xsl:apply-templates select = "*[2]" mode = "semantics"/>
508         <m:mfenced>
509           <m:mn>-1</m:mn>
510         </m:mfenced>
511       </m:msup>
512     </xsl:otherwise>
513   </xsl:choose>
514 </xsl:template>
515
516 <xsl:template match = "m:sep"/>
517
518 <xsl:template match = "m:condition">
519   <xsl:choose>
520     <xsl:when test="parent::m:apply[m:forall[1]]"/>
521     <xsl:otherwise>
522       <xsl:if test="not(*[2])">
523         <xsl:apply-templates mode = "semantics"/>
524       </xsl:if>
525       <xsl:if test="*[2]">
526         <m:mrow>
527           <xsl:apply-templates mode = "semantics"/>
528         </m:mrow>
529       </xsl:if>
530     </xsl:otherwise>
531   </xsl:choose>
532 </xsl:template>
533
534 <xsl:template match = "m:declare"/>
535
536 <xsl:template match = "m:lambda">
537   <m:mrow>
538     <m:mo> &#x039b; </m:mo>
539     <m:mfenced separators=",">
540       <xsl:for-each select = "*">
541         <xsl:choose>
542           <xsl:when test="self::m:ci or self::m:cn">
543             <xsl:apply-templates select = "." mode="semantics"/>
544           </xsl:when>
545           <xsl:otherwise>
546             <m:mrow>
547               <xsl:apply-templates select = "." mode="semantics"/>
548             </m:mrow>
549           </xsl:otherwise>
550         </xsl:choose>
551       </xsl:for-each>
552     </m:mfenced>
553   </m:mrow>
554 </xsl:template>
555
556 <xsl:template match = "m:apply[m:*[1][self::m:apply[m:compose[1]]]]">
557   <m:mrow>
558     <xsl:apply-templates select = "*[1]" mode = "semantics"/>
559     <m:mfenced separators=",">
560       <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
561     </m:mfenced>
562  </m:mrow>
563 </xsl:template>
564
565 <xsl:template match = "m:apply[*[1][self::m:compose]]">
566   <m:mfenced separators="">
567     <xsl:apply-templates select = "m:*[2][self::m:ci[@type='fn'] | self::m:fn]" mode="semantics"/>
568     <xsl:for-each select = "m:*[position()>2][self::m:ci[@type='fn'] | self::m:fn]">
569       <m:mo> <xsl:call-template name="insert2"/> <mchar name="SmallCircle"/> </m:mo>
570       <xsl:apply-templates select = "." mode="semantics"/>
571     </xsl:for-each>
572   </m:mfenced>
573 </xsl:template>
574
575 <xsl:template match = "m:ident">
576   <m:mo>id</m:mo>
577 </xsl:template>
578
579
580 <!-- ARITHMETIC, ALGEBRA & LOGIC -->
581
582 <xsl:template match = "m:apply[m:quotient[1]]">
583   <m:mfenced open="&#x230a;" close="&#x230b;" separators="">
584     <xsl:call-template name="insert_xref"/>
585     <xsl:apply-templates select="*[2]" mode = "semantics">
586       <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
587     </xsl:apply-templates>
588     <m:mo><xsl:call-template name="insert1"/>/</m:mo>
589     <xsl:apply-templates select="*[3]" mode = "semantics">
590       <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
591       <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
592     </xsl:apply-templates>
593   </m:mfenced>
594 </xsl:template>
595
596 <xsl:template match = "m:apply[*[1][self::m:exp]]">
597   <m:msup>
598     <m:mo>e</m:mo>
599     <xsl:apply-templates select = "*[2]" mode = "semantics"/>
600   </m:msup>
601 </xsl:template>
602
603 <xsl:template match = "m:apply[m:factorial[1]]">
604   <m:mrow>
605     <xsl:call-template name="insert_xref"/>
606     <xsl:apply-templates select = "*[2]" mode = "semantics">
607       <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
608       <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
609     </xsl:apply-templates>
610     <m:mo><xsl:call-template name="insert1"/>!</m:mo>
611   </m:mrow>
612 </xsl:template>
613
614 <xsl:template match = "m:apply[m:max[1] | m:min[1]]">
615   <m:mrow>
616     <xsl:call-template name="insert_xref"/>
617     <xsl:if test="*[2]=m:bvar">
618       <m:munder>
619         <xsl:if test="*[1]=m:max">
620           <m:mo><xsl:call-template name="insert1"/>max</m:mo>
621         </xsl:if>
622         <xsl:if test="*[1]=m:min">
623           <m:mo>min</m:mo>
624         </xsl:if>
625         <xsl:apply-templates select="*[2]" mode = "semantics"/>
626       </m:munder>
627       <xsl:if test="*[3]=m:condition">
628         <m:mfenced open="{{" close="}}" separators="">
629           <m:mfenced open="" close="" separators=",">
630             <xsl:for-each select = "*[position()>3]">
631               <xsl:apply-templates select = "." mode="semantics"/>
632             </xsl:for-each>
633           </m:mfenced>
634           <m:mo>|</m:mo>
635           <xsl:apply-templates select="*[3]" mode = "semantics"/>
636         </m:mfenced>
637       </xsl:if>
638       <xsl:if test="not(*[3]=m:condition)">
639         <m:mfenced open="{{" close="}}" separators=",">
640           <xsl:for-each select = "*[position()>2]">
641             <xsl:apply-templates select = "." mode="semantics"/>
642           </xsl:for-each>
643         </m:mfenced>
644       </xsl:if>
645     </xsl:if>
646     <xsl:if test="*[2]=m:condition">
647       <xsl:if test="*[1]=m:max">
648         <m:mo>max</m:mo>
649       </xsl:if>
650       <xsl:if test="*[1]=m:min">
651         <m:mo>min</m:mo>
652       </xsl:if>
653       <m:mfenced open="{{" close="}}" separators="">
654         <xsl:if test="*[3]">
655           <m:mfenced open="" close="" separators=",">
656             <xsl:for-each select = "*[position()>2]">
657               <xsl:apply-templates select = "." mode="semantics"/>
658             </xsl:for-each>
659           </m:mfenced>
660           <m:mo>|</m:mo>
661         </xsl:if>
662         <xsl:apply-templates select="*[2]" mode = "semantics"/>
663       </m:mfenced>
664     </xsl:if>
665     <xsl:if test="not(*[2]=m:condition) and not(*[2]=m:bvar)">
666       <xsl:if test="*[1]=m:max">
667         <m:mo>max</m:mo>
668       </xsl:if>
669       <xsl:if test="*[1]=m:min">
670         <m:mo><xsl:call-template name="insert1"/>min</m:mo>
671       </xsl:if>
672       <m:mfenced open="{{" close="}}" separators=",">
673         <xsl:for-each select = "*[position()>1]">
674           <xsl:apply-templates select = "." mode="semantics"/>
675         </xsl:for-each>
676       </m:mfenced>
677     </xsl:if>
678   </m:mrow>
679 </xsl:template>
680
681 <xsl:template match = "m:apply[m:minus[1]]">
682   <xsl:param name="IN_PREC" select="$NO_PREC"/>
683   <xsl:param name="PARAM" select="$NO_PARAM"/>
684   <xsl:param name="PAREN" select="$PAR_NO"/>
685   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
686   <xsl:choose>
687     <xsl:when test="$IN_PREC &gt; $MINUS_PREC or $IN_PREC=$MINUS_PREC and $PARAM=$PAR_SAME">
688       <m:mfenced separators="">
689         <xsl:call-template name="insert_xref"/>
690         <xsl:apply-templates select="." mode="minus">
691           <xsl:with-param name="PARAM" select="$PARAM"/>
692           <xsl:with-param name="PAREN" select="$PAR_YES"/>
693           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
694         </xsl:apply-templates>
695       </m:mfenced>
696     </xsl:when>
697     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC and not($SEM_SW=2)">
698       <xsl:apply-templates select="." mode="minus">
699         <xsl:with-param name="PARAM" select="$PARAM"/>
700         <xsl:with-param name="PAREN" select="$PAREN"/>
701         <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
702       </xsl:apply-templates>
703     </xsl:when>
704     <xsl:otherwise>
705       <m:mrow>
706         <xsl:call-template name="insert_xref"/>
707         <xsl:apply-templates select="." mode="minus">
708           <xsl:with-param name="PARAM" select="$PARAM"/>
709           <xsl:with-param name="PAREN" select="$PAREN"/>
710           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
711         </xsl:apply-templates>
712       </m:mrow>
713     </xsl:otherwise>
714   </xsl:choose>
715 </xsl:template>
716
717 <xsl:template match = "m:apply[m:minus[1]]" mode="minus">
718   <xsl:param name="PARAM" select="$NO_PARAM"/>
719   <xsl:param name="PAREN" select="$PAR_NO"/>
720   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
721   <xsl:if test="not(*[3])">
722     <m:mo><xsl:call-template name="insert1"/>-</m:mo>
723     <xsl:apply-templates select="*[2]" mode = "semantics">
724       <xsl:with-param name="IN_PREC" select="$NEG_PREC"/>
725       <xsl:with-param name="PAREN" select="$PAREN"/>
726       <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
727     </xsl:apply-templates>
728   </xsl:if>
729   <xsl:if test="*[3]">
730     <xsl:apply-templates select="*[2]" mode = "semantics">
731       <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
732       <xsl:with-param name="PARAM" select="$PARAM"/>
733       <xsl:with-param name="PAREN" select="$PAREN"/>
734       <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
735     </xsl:apply-templates>
736     <m:mo><xsl:call-template name="insert1"/>-</m:mo>
737     <xsl:apply-templates select="*[3]" mode = "semantics">
738       <xsl:with-param name="IN_PREC" select="$MINUS_PREC"/>
739       <xsl:with-param name="PARAM" select="$PAR_SAME"/>
740       <xsl:with-param name="PAREN" select="$PAREN"/>
741       <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
742     </xsl:apply-templates>
743   </xsl:if>
744 </xsl:template>
745
746 <xsl:template match = "m:apply[m:plus[1]]">
747   <xsl:param name="IN_PREC" select="$NO_PREC"/>
748   <xsl:param name="PARAM" select="$NO_PARAM"/>
749   <xsl:param name="PAREN" select="$PAR_NO"/>
750   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
751   <xsl:choose>
752     <xsl:when test="$IN_PREC &gt; $PLUS_PREC or $IN_PREC=$PLUS_PREC and $PARAM=$PAR_SAME">
753       <m:mfenced separators="">
754         <xsl:call-template name="insert_xref"/>
755         <xsl:apply-templates select="." mode="plus">
756           <xsl:with-param name="PARAM" select="$IN_PREC"/>
757           <xsl:with-param name="PAREN" select="$PAR_YES"/>
758           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
759         </xsl:apply-templates>
760       </m:mfenced>
761     </xsl:when>
762     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC and not($SEM_SW=2)">
763       <xsl:apply-templates select="." mode="plus">
764         <xsl:with-param name="PARAM" select="$PARAM"/>
765         <xsl:with-param name="PAREN" select="$PAREN"/>
766         <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
767       </xsl:apply-templates>
768     </xsl:when>
769     <xsl:otherwise>
770       <m:mrow>
771         <xsl:call-template name="insert_xref"/>
772         <xsl:apply-templates select="." mode="plus">
773           <xsl:with-param name="PARAM" select="$IN_PREC"/>
774           <xsl:with-param name="PAREN" select="$PAREN"/>
775           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
776         </xsl:apply-templates>
777       </m:mrow>
778     </xsl:otherwise>
779   </xsl:choose>
780 </xsl:template>
781
782 <xsl:template match = "m:apply[m:plus[1]]" mode="plus">
783   <xsl:param name="PARAM" select="$NO_PARAM"/>
784   <xsl:param name="PAREN" select="$PAR_NO"/>
785   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
786   <xsl:if test="*[2]">
787     <xsl:apply-templates select="*[2]" mode = "semantics">
788       <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
789       <xsl:with-param name="PARAM" select="$PARAM"/>
790       <xsl:with-param name="PAREN" select="$PAREN"/>
791       <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
792     </xsl:apply-templates>
793     <xsl:for-each select = "*[position()>2]">
794       <xsl:choose>
795         <xsl:when test=". &lt; 0">
796           <m:mo>-</m:mo>
797           <m:mn> <xsl:value-of select="-."/> </m:mn>
798         </xsl:when>
799         <xsl:when test="self::m:apply[m:minus[1]] and not(*[3])">
800           <xsl:apply-templates select="." mode = "semantics">
801             <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
802             <xsl:with-param name="PAREN" select="$PAREN"/>
803             <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
804           </xsl:apply-templates>
805         </xsl:when>
806         <xsl:otherwise>
807           <m:mo><xsl:call-template name="insert2"/>+</m:mo>
808           <xsl:apply-templates select="." mode = "semantics">
809             <xsl:with-param name="IN_PREC" select="$PLUS_PREC"/>
810             <xsl:with-param name="PAREN" select="$PAREN"/>
811             <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
812           </xsl:apply-templates>
813         </xsl:otherwise>
814       </xsl:choose>
815     </xsl:for-each>
816   </xsl:if>
817 </xsl:template>
818
819 <xsl:template match = "m:apply[m:power[1]]">
820   <xsl:choose>
821     <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]]">
822       <xsl:apply-templates select="*[2]" mode = "semantics"/>
823     </xsl:when>
824     <xsl:otherwise>
825       <m:msup>
826         <xsl:apply-templates select = "*[2]" mode = "semantics">
827           <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
828           <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
829         </xsl:apply-templates>
830         <xsl:apply-templates select = "*[3]" mode = "semantics"/>
831       </m:msup>
832     </xsl:otherwise>
833   </xsl:choose>
834 </xsl:template>
835
836 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]">
837   <xsl:param name="IN_PREC" select="$NO_PREC"/>
838   <xsl:param name="PARAM" select="$NO_PARAM"/>
839   <xsl:param name="PAREN" select="$PAR_NO"/>
840   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
841   <xsl:choose>
842     <xsl:when test="$IN_PREC &gt; $DIV_PREC or $IN_PREC=$DIV_PREC and $PARAM=$PAR_SAME">
843       <m:mfenced separators="">
844         <xsl:call-template name="insert_xref"/>
845         <xsl:apply-templates select="." mode="remdiv">
846           <xsl:with-param name="PARAM" select="$IN_PREC"/>
847           <xsl:with-param name="PAREN" select="$PAR_YES"/>
848           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
849         </xsl:apply-templates>
850       </m:mfenced>
851     </xsl:when>
852     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC and not($SEM_SW=2)">
853       <xsl:apply-templates select="." mode="remdiv">
854         <xsl:with-param name="PARAM" select="$PARAM"/>
855         <xsl:with-param name="PAREN" select="$PAREN"/>
856         <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
857       </xsl:apply-templates>
858     </xsl:when>
859     <xsl:otherwise>
860       <m:mrow>
861         <xsl:call-template name="insert_xref"/>
862         <xsl:apply-templates select="." mode="remdiv">
863           <xsl:with-param name="PARAM" select="$IN_PREC"/>
864           <xsl:with-param name="PAREN" select="$PAREN"/>
865           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
866         </xsl:apply-templates>
867       </m:mrow>
868     </xsl:otherwise>
869   </xsl:choose>
870 </xsl:template>
871
872 <xsl:template match = "m:apply[m:rem[1] | m:divide[1]]" mode="remdiv">
873   <xsl:param name="PARAM" select="$NO_PARAM"/>
874   <xsl:param name="PAREN" select="$PAR_NO"/>
875   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
876   <xsl:apply-templates select = "*[2]" mode = "semantics">
877     <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
878       <xsl:with-param name="PARAM" select="$PARAM"/>
879       <xsl:with-param name="PAREN" select="$PAREN"/>
880       <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
881   </xsl:apply-templates>
882   <xsl:if test="m:rem">
883     <m:mo><xsl:call-template name="insert1"/>%</m:mo>
884   </xsl:if>
885   <xsl:if test="m:divide">
886     <m:mo><xsl:call-template name="insert1"/>/</m:mo>
887   </xsl:if>
888   <xsl:apply-templates select = "*[3]" mode = "semantics">
889     <xsl:with-param name="IN_PREC" select="$DIV_PREC"/>
890     <xsl:with-param name="PARAM" select="$PAR_SAME"/>
891     <xsl:with-param name="PAREN" select="$PAREN"/>
892     <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
893   </xsl:apply-templates>
894 </xsl:template>
895
896 <xsl:template match = "m:apply[m:times[1]]">
897   <xsl:param name="IN_PREC" select="$NO_PREC"/>
898   <xsl:param name="PARAM" select="$NO_PARAM"/>
899   <xsl:param name="PAREN" select="$PAR_NO"/>
900   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
901   <xsl:choose>
902     <xsl:when test="$IN_PREC &gt; $MUL_PREC or $IN_PREC=$MUL_PREC and $PARAM=$PAR_SAME">
903       <m:mfenced separators="">
904         <xsl:call-template name="insert_xref"/>
905         <xsl:apply-templates select="." mode="times">
906           <xsl:with-param name="PARAM" select="$IN_PREC"/>
907           <xsl:with-param name="PAREN" select="$PAR_YES"/>
908           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
909         </xsl:apply-templates>
910       </m:mfenced>
911     </xsl:when>
912     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC and not($SEM_SW=2)">
913       <xsl:apply-templates select="." mode="times">
914         <xsl:with-param name="PARAM" select="$PARAM"/>
915         <xsl:with-param name="PAREN" select="$PAREN"/>
916         <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
917       </xsl:apply-templates>
918     </xsl:when>
919     <xsl:otherwise>
920       <m:mrow>
921          <xsl:call-template name="insert_xref"/>
922         <xsl:apply-templates select="." mode="times">
923           <xsl:with-param name="PARAM" select="$IN_PREC"/>
924           <xsl:with-param name="PAREN" select="$PAREN"/>
925           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
926         </xsl:apply-templates>
927       </m:mrow>
928     </xsl:otherwise>
929   </xsl:choose>
930 </xsl:template>
931
932 <xsl:template match = "m:apply[m:times[1]]" mode="times">
933   <xsl:param name="PARAM" select="$NO_PARAM"/>
934   <xsl:param name="PAREN" select="$PAR_NO"/>
935   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
936   <xsl:apply-templates select="*[2]" mode = "semantics">
937     <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
938     <xsl:with-param name="PARAM" select="$PARAM"/>
939     <xsl:with-param name="PAREN" select="$PAREN"/>
940     <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
941   </xsl:apply-templates>
942   <xsl:if test="*[3]">
943     <xsl:for-each select = "*[position()>2]">
944 <!-- HELM: to distinguish between * and the application -->
945 <!--      <m:mo><xsl:call-template name="insert2"/>
946                 <mchar name="InvisibleTimes"/> </m:mo> -->
947       <m:mo><xsl:call-template name="insert2"/>*</m:mo>
948       <xsl:apply-templates select="." mode = "semantics">
949         <xsl:with-param name="IN_PREC" select="$MUL_PREC"/>
950         <xsl:with-param name="PAREN" select="$PAREN"/>
951         <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
952       </xsl:apply-templates>
953     </xsl:for-each>
954   </xsl:if>
955 </xsl:template>
956
957
958 <xsl:template match = "m:apply[m:root[1]]">
959   <m:msqrt>
960     <xsl:call-template name="insert1"/>
961     <xsl:call-template name="insert_xref"/>
962     <xsl:if test="*[2]=m:degree">
963       <xsl:apply-templates select="*[3]" mode = "semantics"/>
964       <xsl:apply-templates select="*[2]" mode = "semantics"/>
965     </xsl:if>
966     <xsl:if test="not(*[2]=m:degree)">
967       <xsl:apply-templates select="*[2]" mode = "semantics"/>
968       <m:mn>2</m:mn>
969     </xsl:if>
970   </m:msqrt>
971 </xsl:template>
972
973 <xsl:template match = "m:apply[m:gcd[1]]">
974   <m:mrow>
975     <xsl:call-template name="insert_xref"/>
976     <xsl:if test="not(parent::m:apply[m:power[1]])">
977       <m:mo><xsl:call-template name="insert1"/>gcd</m:mo>
978     </xsl:if>
979     <xsl:if test="parent::m:apply[m:power[1]]">
980       <m:msup>
981         <m:mo><xsl:call-template name="insert1"/>gcd</m:mo>
982         <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
983       </m:msup>
984     </xsl:if>
985     <m:mfenced separators=",">
986       <xsl:for-each select = "*[position()>1]">
987         <xsl:apply-templates select = "." mode="semantics"/>
988       </xsl:for-each>
989     </m:mfenced>
990   </m:mrow>
991 </xsl:template>
992
993 <xsl:template match = "m:apply[m:and[1]]">
994   <xsl:param name="IN_PREC" select="$NO_PREC"/>
995   <xsl:param name="PAREN" select="$PAR_NO"/>
996   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
997   <xsl:choose>
998     <xsl:when test="$IN_PREC &gt; $AND_PREC">
999       <m:mfenced separators="">
1000         <xsl:call-template name="insert_xref"/>
1001         <xsl:apply-templates select="." mode="and">
1002           <xsl:with-param name="PARAM" select="$IN_PREC"/>
1003           <xsl:with-param name="PAREN" select="$PAR_YES"/>
1004         </xsl:apply-templates>
1005       </m:mfenced>
1006     </xsl:when>
1007     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC and not($SEM_SW=2)">
1008       <xsl:apply-templates select="." mode="and">
1009         <xsl:with-param name="PARAM" select="$IN_PREC"/>
1010         <xsl:with-param name="PAREN" select="$PAREN"/>
1011         <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1012       </xsl:apply-templates>
1013     </xsl:when>
1014     <xsl:otherwise>
1015       <m:mrow>
1016         <xsl:call-template name="insert_xref"/>
1017         <xsl:apply-templates select="." mode="and">
1018           <xsl:with-param name="PARAM" select="$IN_PREC"/>
1019           <xsl:with-param name="PAREN" select="$PAREN"/>
1020           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1021         </xsl:apply-templates>
1022       </m:mrow>
1023     </xsl:otherwise>
1024   </xsl:choose>
1025 </xsl:template>
1026
1027 <xsl:template match = "m:apply[m:and[1]]" mode="and">
1028   <xsl:param name="PARAM" select="$NO_PARAM"/>
1029   <xsl:param name="PAREN" select="$PAR_NO"/>
1030   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1031   <xsl:apply-templates select="*[2]" mode = "semantics">
1032     <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
1033     <xsl:with-param name="PARAM" select="$PARAM"/>
1034     <xsl:with-param name="PAREN" select="$PAREN"/>
1035     <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1036   </xsl:apply-templates>
1037   <xsl:for-each select = "*[position()>2]">
1038     <m:mo><xsl:call-template name="insert2"/> <mchar name="wedge"/> </m:mo>
1039     <xsl:apply-templates select="." mode = "semantics">
1040       <xsl:with-param name="IN_PREC" select="$AND_PREC"/>
1041       <xsl:with-param name="PAREN" select="$PAREN"/>
1042       <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1043     </xsl:apply-templates>
1044   </xsl:for-each>
1045 </xsl:template>
1046
1047 <xsl:template match = "m:apply[m:or[1]]">
1048   <xsl:param name="IN_PREC" select="$NO_PREC"/>
1049   <xsl:param name="PAREN" select="$PAR_NO"/>
1050   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1051   <xsl:choose>
1052     <xsl:when test="$IN_PREC &gt; $OR_PREC">
1053       <m:mfenced separators="">
1054          <xsl:call-template name="insert_xref"/>
1055         <xsl:apply-templates select="." mode="or">
1056           <xsl:with-param name="PARAM" select="$IN_PREC"/>
1057           <xsl:with-param name="PAREN" select="$PAR_YES"/>
1058         </xsl:apply-templates>
1059       </m:mfenced>
1060     </xsl:when>
1061     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC and not($SEM_SW=2)">
1062       <xsl:apply-templates select="." mode="or">
1063         <xsl:with-param name="PARAM" select="$IN_PREC"/>
1064         <xsl:with-param name="PAREN" select="$PAREN"/>
1065         <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1066       </xsl:apply-templates>
1067     </xsl:when>
1068     <xsl:otherwise>
1069       <m:mrow>
1070         <xsl:call-template name="insert_xref"/>
1071         <xsl:apply-templates select="." mode="or">
1072           <xsl:with-param name="PARAM" select="$IN_PREC"/>
1073           <xsl:with-param name="PAREN" select="$PAREN"/>
1074           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1075         </xsl:apply-templates>
1076       </m:mrow>
1077     </xsl:otherwise>
1078   </xsl:choose>
1079 </xsl:template>
1080
1081 <xsl:template match = "m:apply[m:or[1]]" mode="or">
1082   <xsl:param name="PARAM" select="$NO_PARAM"/>
1083   <xsl:param name="PAREN" select="$PAR_NO"/>
1084   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1085   <xsl:apply-templates select="*[2]" mode = "semantics">
1086     <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1087     <xsl:with-param name="PARAM" select="$PARAM"/>
1088     <xsl:with-param name="PAREN" select="$PAREN"/>
1089     <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1090   </xsl:apply-templates>
1091   <xsl:for-each select = "*[position()>2]">
1092     <m:mo><xsl:call-template name="insert2"/> <mchar name="vee"/> </m:mo>
1093     <xsl:apply-templates select="." mode = "semantics">
1094       <xsl:with-param name="IN_PREC" select="$OR_PREC"/>
1095       <xsl:with-param name="PAREN" select="$PAREN"/>
1096       <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1097     </xsl:apply-templates>
1098   </xsl:for-each>
1099 </xsl:template>
1100
1101 <xsl:template match = "m:apply[m:xor[1]]">
1102   <xsl:param name="IN_PREC" select="$NO_PREC"/>
1103   <xsl:param name="PAREN" select="$PAR_NO"/>
1104   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1105   <xsl:choose>
1106     <xsl:when test="$IN_PREC &gt; $XOR_PREC">
1107       <m:mfenced separators="">
1108         <xsl:call-template name="insert_xref"/>
1109         <xsl:apply-templates select="." mode="xor">
1110           <xsl:with-param name="PARAM" select="$IN_PREC"/>
1111           <xsl:with-param name="PAREN" select="$PAR_YES"/>
1112           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1113         </xsl:apply-templates>
1114       </m:mfenced>
1115     </xsl:when>
1116     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC and not($SEM_SW=2)">
1117       <xsl:apply-templates select="." mode="xor">
1118         <xsl:with-param name="PARAM" select="$IN_PREC"/>
1119         <xsl:with-param name="PAREN" select="$PAREN"/>
1120       </xsl:apply-templates>
1121     </xsl:when>
1122     <xsl:otherwise>
1123       <m:mrow>
1124         <xsl:call-template name="insert_xref"/>
1125         <xsl:apply-templates select="." mode="xor">
1126           <xsl:with-param name="PARAM" select="$IN_PREC"/>
1127           <xsl:with-param name="PAREN" select="$PAREN"/>
1128           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1129         </xsl:apply-templates>
1130       </m:mrow>
1131     </xsl:otherwise>
1132   </xsl:choose>
1133 </xsl:template>
1134
1135 <xsl:template match = "m:apply[m:xor[1]]" mode="xor">
1136   <xsl:param name="PARAM" select="$NO_PARAM"/>
1137   <xsl:param name="PAREN" select="$PAR_NO"/>
1138   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1139   <xsl:apply-templates select="*[2]" mode = "semantics">
1140     <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1141     <xsl:with-param name="PARAM" select="$PARAM"/>
1142     <xsl:with-param name="PAREN" select="$PAREN"/>
1143     <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1144   </xsl:apply-templates>
1145   <xsl:for-each select = "*[position()>2]">
1146     <m:mo><xsl:call-template name="insert2"/> <mchar name="xor"/> </m:mo>
1147     <xsl:apply-templates select="." mode = "semantics">
1148       <xsl:with-param name="IN_PREC" select="$XOR_PREC"/>
1149       <xsl:with-param name="PAREN" select="$PAREN"/>
1150       <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1151     </xsl:apply-templates>
1152   </xsl:for-each>
1153 </xsl:template>
1154
1155 <xsl:template match = "m:apply[m:not[1]]">
1156   <m:mrow>
1157     <xsl:call-template name="insert_xref"/>
1158 <!-- CSC, per estetica!
1159     <m:mo><xsl:call-template name="insert1"/>not</m:mo>
1160 -->
1161     <m:mo><xsl:call-template name="insert1"/><m:mchar name="not"/></m:mo>
1162     <xsl:apply-templates select = "*[2]" mode = "semantics">
1163       <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1164     </xsl:apply-templates>
1165   </m:mrow>
1166 </xsl:template>
1167
1168 <xsl:template match = "m:apply[m:forall[1]]">
1169   <m:mrow>
1170     <xsl:call-template name="insert_xref"/>
1171     <m:mo><xsl:call-template name="insert1"/>for all</m:mo>
1172     <m:mfenced separators=",">
1173       <xsl:for-each select = "m:bvar">
1174         <xsl:apply-templates select = "." mode="semantics"/>
1175       </xsl:for-each>
1176     </m:mfenced>
1177     <xsl:if test="m:condition">
1178       <m:mo>:</m:mo>
1179       <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1180       <m:mo>,</m:mo>
1181     </xsl:if>
1182     <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and not(self::m:condition)]" mode = "semantics"/>
1183   </m:mrow>
1184 </xsl:template>
1185
1186 <xsl:template match = "m:apply[m:exists[1]]">
1187   <m:mrow>
1188     <xsl:call-template name="insert_xref"/>
1189     <m:mo><xsl:call-template name="insert1"/> <mchar name="Exists"/> </m:mo>
1190     <m:mfenced separators=",">
1191       <xsl:for-each select = "m:bvar">
1192         <xsl:apply-templates select = "." mode="semantics"/>
1193       </xsl:for-each>
1194     </m:mfenced>
1195     <xsl:if test="m:condition">
1196       <m:mo>,</m:mo>
1197       <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1198     </xsl:if>
1199     <m:mo>:</m:mo>
1200     <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and not(self::m:condition)]" mode = "semantics"/>
1201   </m:mrow>
1202 </xsl:template>
1203
1204 <xsl:template match = "m:apply[m:abs[1]]">
1205   <xsl:if test="not(parent::m:apply[m:power[1]])">
1206     <m:mfenced open="|" close="|" separators="">
1207       <xsl:call-template name="insert_xref"/>
1208       <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1209     </m:mfenced>
1210   </xsl:if>
1211   <xsl:if test="parent::m:apply[m:power[1]]">
1212     <m:msup>
1213       <m:mfenced open="|" close="|" separators="">
1214         <xsl:call-template name="insert_xref"/>
1215         <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1216       </m:mfenced>
1217       <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1218     </m:msup>
1219   </xsl:if>
1220 </xsl:template>
1221
1222 <xsl:template match = "m:apply[m:conjugate[1]]">
1223   <m:mover>
1224     <m:mrow>
1225       <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1226     </m:mrow>
1227     <m:mo><xsl:call-template name="insert1"/> <mchar name="UnderBar"/> </m:mo>
1228   </m:mover>
1229 </xsl:template>
1230
1231 <xsl:template match = "m:apply[m:arg[1] | m:real[1] | m:imaginary[1]]">
1232   <m:mrow>
1233     <xsl:call-template name="insert_xref"/>
1234     <xsl:choose>
1235       <xsl:when test="m:arg">
1236         <m:mo><xsl:call-template name="insert1"/>arg</m:mo>
1237       </xsl:when>
1238       <xsl:when test="m:real">
1239         <m:mo><xsl:call-template name="insert1"/>Real</m:mo>
1240       </xsl:when>
1241       <xsl:when test="m:imaginary">
1242         <m:mo><xsl:call-template name="insert1"/>Imaginary</m:mo>
1243       </xsl:when>
1244     </xsl:choose>
1245     <m:mfenced separators="">
1246       <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1247     </m:mfenced>
1248   </m:mrow>
1249 </xsl:template>
1250
1251
1252 <!-- RELATIONS -->
1253
1254 <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]">
1255   <m:mrow>
1256     <xsl:call-template name="insert_xref"/>
1257     <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">
1258       <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1259       <xsl:if test="*[1]=m:neq">
1260         <m:mo><xsl:call-template name="insert1"/> <mchar name="NotEqual"/> </m:mo>
1261       </xsl:if>
1262       <xsl:if test="*[1]=m:approx">
1263         <m:mo><xsl:call-template name="insert1"/> <mchar name="approxeq"/> </m:mo>
1264       </xsl:if>
1265       <xsl:if test="*[1]=m:tendsto">
1266         <m:mo><xsl:call-template name="insert1"/> <mchar name="RightArrow"/> </m:mo>
1267       </xsl:if>
1268       <xsl:if test="*[1]=m:implies">
1269         <m:mo><xsl:call-template name="insert1"/> <mchar name="DoubleRightArrow"/> </m:mo>
1270       </xsl:if>
1271       <xsl:if test="*[1]=m:in">
1272         <m:mo><xsl:call-template name="insert1"/>
1273         <mchar name="Element"/> 
1274        </m:mo>
1275       </xsl:if>
1276       <xsl:if test="*[1]=m:notin">
1277         <m:mo><xsl:call-template name="insert1"/> <mchar name="NotElement"/> </m:mo>
1278       </xsl:if>
1279       <xsl:if test="*[1]=m:notsubset">
1280         <m:mo> <xsl:call-template name="insert1"/> <mchar name="NotSubset"/> </m:mo>
1281       </xsl:if>
1282       <xsl:if test="*[1]=m:notprsubset">
1283         <m:mo> <xsl:call-template name="insert1"/> <mchar name="NotSubsetEqual"/> </m:mo>
1284       </xsl:if>
1285       <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1286       <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='below']">
1287         <m:mo><xsl:call-template name="insert1"/>-</m:mo>
1288       </xsl:if>
1289       <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='above']">
1290         <m:mo><xsl:call-template name="insert1"/>+</m:mo>
1291       </xsl:if>
1292     </xsl:if>
1293     <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">
1294       <xsl:apply-templates select = "*[2]" mode="semantics"/>
1295       <xsl:for-each select = "*[position()>2]">
1296         <xsl:if test="../*[self::m:subset][1]">
1297           <m:mo> <xsl:call-template name="insert2"/> <mchar name="SubsetEqual"/> </m:mo>
1298         </xsl:if>
1299         <xsl:if test="../*[self::m:prsubset][1]">
1300           <m:mo> <xsl:call-template name="insert2"/><mchar name="subset"/> </m:mo>
1301         </xsl:if>
1302         <xsl:if test="../*[self::m:eq][1]">
1303           <m:mo><xsl:call-template name="insert2"/>=</m:mo>
1304         </xsl:if>
1305         <xsl:if test="../*[self::m:gt][1]">
1306           <m:mo><xsl:call-template name="insert2"/>&gt;</m:mo>
1307         </xsl:if>
1308         <xsl:if test="../*[self::m:lt][1]">
1309           <m:mo><xsl:call-template name="insert2"/>&lt;</m:mo>
1310         </xsl:if>
1311         <xsl:if test="../*[self::m:geq][1]">
1312           <m:mo><xsl:call-template name="insert2"/> <mchar name="geq"/> </m:mo>
1313         </xsl:if>
1314         <xsl:if test="../*[self::m:leq][1]">
1315           <m:mo><xsl:call-template name="insert2"/> <mchar name="leq"/> </m:mo>
1316         </xsl:if>
1317         <xsl:if test="../*[self::m:equivalent][1]">
1318           <m:mo><xsl:call-template name="insert2"/> <mchar name="Congruent"/> </m:mo>
1319         </xsl:if>
1320         <xsl:apply-templates select = "." mode="semantics"/>
1321       </xsl:for-each>
1322     </xsl:if>
1323   </m:mrow>
1324 </xsl:template>
1325
1326
1327 <!-- CALCULUS -->
1328
1329 <xsl:template match = "m:apply[*[1][self::m:ln]]">
1330   <m:mrow>
1331     <xsl:call-template name="insert_xref"/>
1332     <xsl:choose>
1333       <xsl:when test="parent::m:apply[m:power[1]]">
1334         <m:msup>
1335           <m:mo><xsl:call-template name="insert1"/>ln</m:mo>
1336           <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1337         </m:msup>
1338       </xsl:when>
1339       <xsl:otherwise>
1340         <m:mo><xsl:call-template name="insert1"/>ln</m:mo>
1341       </xsl:otherwise>
1342     </xsl:choose>
1343     <xsl:apply-templates select = "*[2]" mode = "semantics">
1344       <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1345     </xsl:apply-templates>
1346   </m:mrow>
1347 </xsl:template>
1348
1349 <xsl:template match = "m:apply[m:log[1]]">
1350   <m:mrow>
1351     <xsl:call-template name="insert_xref"/>
1352     <xsl:choose>
1353       <xsl:when test="parent::m:apply[m:power[1]]">
1354         <xsl:if test="not(*[2]=m:logbase)">
1355           <m:msup>
1356             <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1357             <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1358           </m:msup>
1359         </xsl:if>
1360         <xsl:if test="*[2]=m:logbase">
1361           <m:msubsup>
1362             <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1363             <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1364             <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
1365           </m:msubsup>
1366         </xsl:if>
1367       </xsl:when>
1368       <xsl:otherwise>
1369         <xsl:if test="not(*[2]=m:logbase)">
1370           <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1371         </xsl:if>
1372         <xsl:if test="*[2]=m:logbase">
1373           <m:msub>
1374             <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1375             <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
1376           </m:msub>
1377         </xsl:if>
1378       </xsl:otherwise>
1379     </xsl:choose>
1380     <xsl:if test="*[2]=m:logbase">
1381       <xsl:apply-templates select = "*[3]" mode = "semantics">
1382         <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1383       </xsl:apply-templates>
1384     </xsl:if>
1385     <xsl:if test="not(*[2]=m:logbase)">
1386       <xsl:apply-templates select = "*[2]" mode = "semantics">
1387         <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1388       </xsl:apply-templates>
1389     </xsl:if>
1390   </m:mrow>
1391 </xsl:template>
1392
1393 <xsl:template match = "m:apply[m:diff[1]]">
1394   <m:mrow>
1395     <xsl:call-template name="insert_xref"/>
1396     <xsl:if test="*[2]=m:bvar and m:bvar[*[2]=m:degree]">
1397       <m:mfrac><xsl:call-template name="insert1"/>
1398         <m:msup>
1399           <m:mo>d</m:mo>
1400           <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
1401         </m:msup>
1402         <m:mrow>
1403           <m:mo>d</m:mo>
1404           <m:msup>
1405             <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
1406             <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
1407           </m:msup>
1408         </m:mrow>
1409       </m:mfrac>
1410     </xsl:if>
1411     <xsl:if test="*[2]=m:bvar and not(m:bvar[*[2]=m:degree])">
1412       <m:mfrac><xsl:call-template name="insert1"/>
1413         <m:mo>d</m:mo>
1414         <m:mrow>
1415           <m:mo>d</m:mo>
1416           <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
1417         </m:mrow>
1418       </m:mfrac>
1419     </xsl:if>
1420     <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1421   </m:mrow>
1422 </xsl:template>
1423
1424 <xsl:template match = "m:apply[m:partialdiff[1]]">
1425   <m:mrow>
1426     <xsl:call-template name="insert_xref"/>
1427     <xsl:for-each select = "m:bvar">
1428       <xsl:if test="*[last()]=m:degree">
1429         <m:mfrac><xsl:call-template name="insert1"/>
1430           <m:msup>
1431              <m:mo>d</m:mo>
1432              <xsl:apply-templates select = "m:degree" mode = "semantics"/>
1433           </m:msup>
1434           <m:mrow>
1435             <m:mo>d</m:mo>
1436             <m:msup>
1437               <xsl:apply-templates select = "*[1]" mode = "semantics"/>
1438               <xsl:apply-templates select = "m:degree" mode = "semantics"/>
1439             </m:msup>
1440           </m:mrow>
1441         </m:mfrac>
1442       </xsl:if>
1443       <xsl:if test="not(*[last()]=m:degree)">
1444         <m:mfrac><xsl:call-template name="insert1"/>
1445           <m:mo>d</m:mo>
1446           <m:mrow>
1447             <m:mo>d</m:mo>
1448             <xsl:apply-templates select = "*[1]" mode = "semantics"/>
1449           </m:mrow>
1450         </m:mfrac>
1451       </xsl:if>
1452     </xsl:for-each>
1453     <xsl:apply-templates select = "*[last()]" mode = "semantics"/>
1454   </m:mrow>
1455 </xsl:template>
1456
1457 <xsl:template match = "m:lowlimit | m:uplimit | m:bvar | m:degree | m:logbase">
1458   <xsl:apply-templates mode = "semantics"/>
1459 </xsl:template>
1460
1461 <xsl:template match = "m:apply[m:divergence[1] | m:grad[1] | m:curl[1]]">
1462   <m:mrow>
1463     <xsl:call-template name="insert_xref"/>
1464     <xsl:if test="*[1]=m:divergence">
1465       <m:mo><xsl:call-template name="insert1"/>div</m:mo>
1466     </xsl:if>
1467     <xsl:if test="*[1]=m:grad">
1468     <m:mo><xsl:call-template name="insert1"/>grad</m:mo>
1469     </xsl:if>
1470     <xsl:if test="*[1]=m:curl">
1471     <m:mo><xsl:call-template name="insert1"/>curl</m:mo>
1472     </xsl:if>
1473     <xsl:choose>
1474       <xsl:when test="*[2]=m:ci">
1475         <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1476       </xsl:when>
1477       <xsl:otherwise>
1478         <m:mfenced separators="">
1479           <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1480         </m:mfenced>
1481       </xsl:otherwise>
1482     </xsl:choose>
1483   </m:mrow>
1484 </xsl:template>
1485
1486 <xsl:template match = "m:apply[m:laplacian[1]]">
1487   <m:mrow>
1488     <xsl:call-template name="insert_xref"/>
1489     <m:msup><xsl:call-template name="insert1"/>
1490       <m:mo> &#x0394; </m:mo>
1491       <m:mn>2</m:mn>
1492     </m:msup>
1493     <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1494   </m:mrow>
1495 </xsl:template>
1496
1497
1498 <!-- SET THEORY -->
1499
1500 <xsl:template match = "m:set | m:list">
1501   <m:mfenced open="{{" close="}}" separators="">
1502     <xsl:call-template name="insert_xref"/>
1503     <xsl:if test="*[1]=m:bvar and *[2]=m:condition">
1504       <xsl:apply-templates select="m:bvar" mode = "semantics"/>
1505       <m:mo>|</m:mo>
1506       <xsl:apply-templates select="m:condition" mode = "semantics"/>
1507     </xsl:if>
1508     <xsl:if test="*[1]=m:condition and not(child::m:bvar)">
1509       <m:mfenced open="" close="" separators=",">
1510         <xsl:for-each select = "*[not(self::m:condition) and not(self::m:bvar)]">
1511           <xsl:apply-templates select = "." mode="semantics"/>
1512         </xsl:for-each>
1513       </m:mfenced>
1514       <m:mo>|</m:mo>
1515       <xsl:apply-templates select="m:condition" mode = "semantics"/>
1516     </xsl:if>
1517     <xsl:if test="not(child::m:bvar) and not(child::m:condition)">
1518       <m:mfenced open="" close="" separators=",">
1519         <xsl:for-each select = "*">
1520           <xsl:apply-templates select = "." mode="semantics"/>
1521         </xsl:for-each>
1522       </m:mfenced>
1523     </xsl:if>
1524   </m:mfenced>
1525 </xsl:template>
1526
1527 <xsl:template match = "m:apply[m:union[1]]">
1528   <xsl:param name="IN_PREC" select="$NO_PREC"/>
1529   <xsl:param name="PARAM" select="$NO_PARAM"/>
1530   <xsl:param name="PAREN" select="$PAR_NO"/>
1531   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1532   <xsl:choose>
1533     <xsl:when test="$IN_PREC &gt; $UNION_PREC or $IN_PREC=$UNION_PREC and $PARAM=$PAR_SAME">
1534       <m:mfenced separators="" helm:xref="{@helm:xref}">
1535         <xsl:call-template name="insert_xref"/>
1536         <xsl:apply-templates select="." mode="union">
1537           <xsl:with-param name="PARAM" select="$PARAM"/>
1538           <xsl:with-param name="PAREN" select="$PAREN"/>
1539           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1540         </xsl:apply-templates>
1541       </m:mfenced>
1542     </xsl:when>
1543     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC and not($SEM_SW=2)">
1544       <xsl:apply-templates select="." mode="union">
1545         <xsl:with-param name="PARAM" select="$PARAM"/>
1546         <xsl:with-param name="PAREN" select="$PAREN"/>
1547         <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1548       </xsl:apply-templates>
1549     </xsl:when>
1550     <xsl:otherwise>
1551       <m:mrow>
1552         <xsl:call-template name="insert_xref"/>
1553         <xsl:apply-templates select="." mode="union">
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       </m:mrow>
1559     </xsl:otherwise>
1560   </xsl:choose>
1561 </xsl:template>
1562
1563 <xsl:template match = "m:apply[m:union[1]]" mode="union">
1564   <xsl:param name="PARAM" select="$NO_PARAM"/>
1565   <xsl:param name="PAREN" select="$PAR_NO"/>
1566   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1567   <xsl:apply-templates select = "*[2]" mode="semantics">
1568     <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
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>
1573   <xsl:for-each select = "*[position()>2]">
1574     <m:mo><xsl:call-template name="insert2"/> <mchar name="Union"/> </m:mo>
1575     <xsl:apply-templates select = "." mode="semantics">
1576       <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
1577       <xsl:with-param name="PAREN" select="$PAREN"/>
1578       <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1579     </xsl:apply-templates>
1580   </xsl:for-each>
1581 </xsl:template>
1582
1583 <xsl:template match = "m:apply[m:intersect[1]]">
1584   <xsl:param name="IN_PREC" select="$NO_PREC"/>
1585   <xsl:param name="PARAM" select="$NO_PARAM"/>
1586   <xsl:param name="PAREN" select="$PAR_NO"/>
1587   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1588   <xsl:choose>
1589     <xsl:when test="$IN_PREC &gt; $INTERSECT_PREC">
1590       <m:mfenced separators="" helm:xref="{@helm:xref}">
1591         <xsl:call-template name="insert_xref"/>
1592         <xsl:apply-templates select="." mode="intersect">
1593           <xsl:with-param name="PARAM" select="$PARAM"/>
1594           <xsl:with-param name="PAREN" select="$PAREN"/>
1595           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1596         </xsl:apply-templates>
1597       </m:mfenced>
1598     </xsl:when>
1599     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC and not($SEM_SW=2)">
1600       <xsl:apply-templates select="." mode="intersect">
1601         <xsl:with-param name="PARAM" select="$PARAM"/>
1602         <xsl:with-param name="PAREN" select="$PAREN"/>
1603         <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1604       </xsl:apply-templates>
1605     </xsl:when>
1606     <xsl:otherwise>
1607       <m:mrow>
1608         <xsl:call-template name="insert_xref"/>
1609         <xsl:apply-templates select="." mode="intersect">
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       </m:mrow>
1615     </xsl:otherwise>
1616   </xsl:choose>
1617 </xsl:template>
1618
1619 <xsl:template match = "m:apply[m:intersect[1]]" mode="intersect">
1620   <xsl:param name="PARAM" select="$NO_PARAM"/>
1621   <xsl:param name="PAREN" select="$PAR_NO"/>
1622   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1623   <xsl:apply-templates select = "*[2]" mode="semantics">
1624     <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
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>
1629   <xsl:for-each select = "*[position()>2]">
1630     <m:mo><xsl:call-template name="insert2"/> <mchar name="Intersection"/> </m:mo>
1631     <xsl:apply-templates select = "." mode="semantics">
1632       <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
1633       <xsl:with-param name="PAREN" select="$PAREN"/>
1634       <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1635     </xsl:apply-templates>
1636   </xsl:for-each>
1637 </xsl:template>
1638
1639 <xsl:template match = "m:apply[m:setdiff[1]]">
1640   <xsl:param name="IN_PREC" select="$NO_PREC"/>
1641   <xsl:param name="PARAM" select="$NO_PARAM"/>
1642   <xsl:param name="PAREN" select="$PAR_NO"/>
1643   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1644   <xsl:choose>
1645     <xsl:when test="$IN_PREC &gt; $SETDIFF_PREC or $IN_PREC=$SETDIFF_PREC and $PARAM=$PAR_SAME">
1646       <m:mfenced separators="">
1647         <xsl:call-template name="insert_xref"/>
1648         <xsl:apply-templates select="." mode="setdiff">
1649           <xsl:with-param name="PARAM" select="$PARAM"/>
1650           <xsl:with-param name="PAREN" select="$PAREN"/>
1651           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1652         </xsl:apply-templates>
1653       </m:mfenced>
1654     </xsl:when>
1655     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC and not($SEM_SW=2)">
1656       <xsl:apply-templates select="." mode="setdiff">
1657         <xsl:with-param name="PARAM" select="$PARAM"/>
1658         <xsl:with-param name="PAREN" select="$PAREN"/>
1659         <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1660       </xsl:apply-templates>
1661     </xsl:when>
1662     <xsl:otherwise>
1663       <m:mrow>
1664         <xsl:call-template name="insert_xref"/>
1665         <xsl:apply-templates select="." mode="setdiff">
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:mrow>
1671     </xsl:otherwise>
1672   </xsl:choose>
1673 </xsl:template>
1674
1675 <xsl:template match = "m:apply[m:setdiff[1]]" mode="setdiff">
1676   <xsl:param name="PARAM" select="$NO_PARAM"/>
1677   <xsl:param name="PAREN" select="$PAR_NO"/>
1678   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1679   <xsl:apply-templates select = "*[2]" mode = "semantics">
1680     <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
1681     <xsl:with-param name="PARAM" select="$PARAM"/>
1682     <xsl:with-param name="PAREN" select="$PAREN"/>
1683     <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1684   </xsl:apply-templates>
1685   <m:mo><xsl:call-template name="insert1"/>\</m:mo>
1686   <xsl:apply-templates select = "*[3]" mode = "semantics">
1687     <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
1688     <xsl:with-param name="PARAM" select="$PAR_SAME"/>
1689     <xsl:with-param name="PAREN" select="$PAREN"/>
1690     <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1691   </xsl:apply-templates>
1692 </xsl:template>
1693
1694 <xsl:template match = "m:apply[m:card[1]]">
1695   <m:mfenced open="|" close="|" separators=",">
1696     <xsl:call-template name="insert_xref"/>
1697     <xsl:for-each select = "*[position()>1]">
1698       <xsl:apply-templates select = "." mode="semantics"/>
1699     </xsl:for-each>
1700   </m:mfenced>
1701 </xsl:template>
1702
1703
1704 <!-- SEQUENCES AND SERIES -->
1705
1706 <xsl:template match = "m:apply[m:sum[1] | m:product[1]]">
1707   <m:mrow>
1708     <xsl:call-template name="insert_xref"/>
1709     <xsl:choose>
1710       <xsl:when test="*[2]=m:bvar and m:lowlimit and m:uplimit">
1711         <m:munderover>
1712           <xsl:if test="*[1]=m:sum">
1713             <m:mo><xsl:call-template name="insert1"/> <mchar name="Sum"/> </m:mo>
1714           </xsl:if>
1715           <xsl:if test="*[1]=m:product">
1716             <m:mo><xsl:call-template name="insert1"/> <mchar name="Product"/> </m:mo>
1717           </xsl:if>
1718           <m:mrow>
1719             <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1720             <m:mo>=</m:mo>
1721             <xsl:apply-templates select = "m:lowlimit" mode = "semantics"/>
1722           </m:mrow>
1723           <xsl:apply-templates select = "m:uplimit" mode = "semantics"/>
1724         </m:munderover>
1725         <xsl:apply-templates select = "*[5]" mode = "semantics"/>
1726       </xsl:when>
1727       <xsl:when test="*[2]=m:bvar and *[3]=m:condition">
1728         <m:munder>
1729           <xsl:if test="*[1]=m:sum">
1730             <m:mo><xsl:call-template name="insert1"/> <mchar name="Sum"/> </m:mo>
1731           </xsl:if>
1732           <xsl:if test="*[1]=m:product">
1733             <m:mo><xsl:call-template name="insert1"/> <mchar name="Product"/> </m:mo>
1734           </xsl:if>
1735           <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1736         </m:munder>
1737         <xsl:apply-templates select = "*[4]" mode = "semantics"/>
1738       </xsl:when>
1739     </xsl:choose>
1740   </m:mrow>
1741 </xsl:template>
1742
1743 <xsl:template match = "m:apply[m:limit[1]]">
1744   <m:mrow>
1745     <xsl:call-template name="insert_xref"/>
1746     <m:munder>
1747       <m:mo><xsl:call-template name="insert1"/>lim</m:mo>
1748       <m:mrow>
1749         <xsl:if test="*[2]=m:bvar and *[3]=m:lowlimit">
1750             <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1751             <m:mo> <mchar name="RightArrow"/> </m:mo>
1752             <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1753         </xsl:if>
1754         <xsl:if test="*[2]=m:bvar and *[3]=m:condition">
1755           <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1756         </xsl:if>
1757       </m:mrow>
1758     </m:munder>
1759     <xsl:apply-templates select = "*[4]" mode = "semantics"/>
1760   </m:mrow>
1761 </xsl:template>
1762
1763
1764 <!-- TRIGONOMETRY -->
1765
1766 <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]]">
1767   <m:mrow>
1768     <xsl:call-template name="insert_xref"/>
1769     <xsl:if test="not(parent::m:apply[m:power[1]])">
1770       <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
1771     </xsl:if>
1772     <xsl:if test="parent::m:apply[m:power[1]]">
1773       <m:msup>
1774         <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
1775         <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1776       </m:msup>
1777     </xsl:if>
1778     <xsl:apply-templates select = "*[2]" mode = "semantics">
1779       <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1780       <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1781     </xsl:apply-templates>
1782   </m:mrow>
1783 </xsl:template>
1784
1785 <xsl:template match = "m:*" mode = "trigonometry">
1786     <xsl:choose>
1787       <xsl:when test="self::m:sin">
1788         <m:mo>sin</m:mo>
1789       </xsl:when>
1790       <xsl:when test="self::m:cos">
1791         <m:mo>cos</m:mo>
1792       </xsl:when>
1793       <xsl:when test="self::m:tan">
1794         <m:mo>tan</m:mo>
1795       </xsl:when>
1796       <xsl:when test="self::m:sec">
1797         <m:mo>sec</m:mo>
1798       </xsl:when>
1799       <xsl:when test="self::m:csc">
1800         <m:mo>csc</m:mo>
1801       </xsl:when>
1802       <xsl:when test="self::m:cot">
1803         <m:mo>cot</m:mo>
1804       </xsl:when>
1805       <xsl:when test="self::m:sinh">
1806         <m:mo>sinh</m:mo>
1807       </xsl:when>
1808       <xsl:when test="self::m:cosh">
1809         <m:mo>cosh</m:mo>
1810       </xsl:when>
1811       <xsl:when test="self::m:tanh">
1812         <m:mo>tanh</m:mo>
1813       </xsl:when>
1814       <xsl:when test="self::m:sech">
1815         <m:mo>sech</m:mo>
1816       </xsl:when>
1817       <xsl:when test="self::m:csch">
1818         <m:mo>csch</m:mo>
1819       </xsl:when>
1820       <xsl:when test="self::m:coth">
1821         <m:mo>coth</m:mo>
1822       </xsl:when>
1823       <xsl:when test="self::m:arcsin">
1824         <m:mo>arcsin</m:mo>
1825       </xsl:when>
1826       <xsl:when test="self::m:arccos">
1827         <m:mo>arccos</m:mo>
1828       </xsl:when>
1829       <xsl:when test="self::m:arctan">
1830         <m:mo>arctan</m:mo>
1831       </xsl:when>
1832     </xsl:choose>
1833 </xsl:template>
1834
1835
1836 <!-- STATISTICS -->
1837
1838 <xsl:template match = "m:apply[m:mean[1]]">
1839   <m:mfenced open="&lt;" close="&gt;" separators=",">
1840     <xsl:call-template name="insert_xref"/>
1841     <xsl:for-each select = "*[position()>1]">
1842       <xsl:apply-templates select = "." mode="semantics"/>
1843     </xsl:for-each>
1844   </m:mfenced>
1845 </xsl:template>
1846
1847 <xsl:template match = "m:apply[m:sdev[1]]">
1848   <m:mrow>
1849     <xsl:call-template name="insert_xref"/>
1850     <m:mo><xsl:call-template name="insert1"/> &#x03c3; </m:mo>
1851     <m:mfenced separators=",">
1852       <xsl:for-each select = "*[position()>1]">
1853         <xsl:apply-templates select = "." mode="semantics"/>
1854       </xsl:for-each>
1855     </m:mfenced>
1856   </m:mrow>
1857 </xsl:template>
1858
1859 <xsl:template match = "m:apply[m:variance[1]]">
1860   <m:mrow>
1861     <xsl:call-template name="insert_xref"/>
1862     <m:mo><xsl:call-template name="insert1"/> &#x03c3; </m:mo>
1863     <m:msup>
1864       <m:mfenced separators=",">
1865         <xsl:for-each select = "*[position()>1]">
1866           <xsl:apply-templates select = "." mode="semantics"/>
1867         </xsl:for-each>
1868       </m:mfenced>
1869       <m:mn>2</m:mn>
1870     </m:msup>
1871   </m:mrow>
1872 </xsl:template>
1873
1874 <xsl:template match = "m:apply[m:median[1]]">
1875   <m:mrow>
1876     <xsl:call-template name="insert_xref"/>
1877     <m:mo><xsl:call-template name="insert1"/>median</m:mo>
1878     <m:mfenced separators=",">
1879       <xsl:for-each select = "*[position()>1]">
1880         <xsl:apply-templates select = "." mode="semantics"/>
1881       </xsl:for-each>
1882     </m:mfenced>
1883   </m:mrow>
1884 </xsl:template>
1885
1886 <xsl:template match = "m:apply[m:mode[1]]">
1887   <m:mrow>
1888     <xsl:call-template name="insert_xref"/>
1889     <m:mo><xsl:call-template name="insert1"/>mode</m:mo>
1890     <m:mfenced separators=",">
1891       <xsl:for-each select = "*[position()>1]">
1892         <xsl:apply-templates select = "." mode="semantics"/>
1893       </xsl:for-each>
1894     </m:mfenced>
1895   </m:mrow>
1896 </xsl:template>
1897
1898 <xsl:template match = "m:apply[m:moment[1]]">
1899   <xsl:call-template name="insert_xref"/>
1900   <m:mfenced open="&lt;" close="&gt;" separators="">
1901     <xsl:if test="*[2]=m:degree">
1902       <m:msup>
1903         <xsl:apply-templates select="*[3]" mode = "semantics"/>
1904         <xsl:apply-templates select="*[2]" mode = "semantics"/>
1905       </m:msup>
1906     </xsl:if>
1907     <xsl:if test="not(*[2]=m:degree)">
1908       <xsl:for-each select = "*[position()>1]">
1909         <xsl:apply-templates select = "." mode="semantics"/>
1910       </xsl:for-each>
1911     </xsl:if>
1912   </m:mfenced>
1913 </xsl:template>
1914
1915
1916 <!-- LINEAR ALGEBRA -->
1917
1918 <xsl:template match="m:vector">
1919   <m:mfenced separators="">
1920     <m:mtable>
1921       <xsl:for-each select="*">
1922         <m:mtd>
1923           <xsl:apply-templates select="." mode = "semantics"/>
1924         </m:mtd>
1925       </xsl:for-each>
1926     </m:mtable>
1927   </m:mfenced>
1928 </xsl:template>
1929
1930 <xsl:template match = "m:matrix">
1931   <m:mfenced separators="">
1932     <m:mtable>
1933       <xsl:apply-templates mode = "semantics"/>
1934     </m:mtable>
1935   </m:mfenced>
1936 </xsl:template>
1937
1938 <xsl:template match = "m:matrixrow">
1939   <m:mtr>
1940     <xsl:for-each select="*">
1941       <m:mtd>
1942         <xsl:apply-templates select="." mode = "semantics"/>
1943       </m:mtd>
1944     </xsl:for-each>
1945   </m:mtr>
1946 </xsl:template>
1947
1948 <xsl:template match = "m:apply[m:determinant[1]]">
1949   <m:mrow>
1950     <xsl:call-template name="insert_xref"/>
1951     <m:mo><xsl:call-template name="insert1"/>det</m:mo>
1952     <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1953   </m:mrow>
1954 </xsl:template>
1955
1956 <xsl:template match = "m:apply[m:transpose[1]]">
1957   <m:msup>
1958     <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1959     <m:mo>T</m:mo>
1960   </m:msup>
1961 </xsl:template>
1962
1963 <xsl:template match = "m:apply[m:selector[1]]">
1964   <xsl:if test="*[2]=m:matrix and *[3]=m:cn">
1965       <xsl:variable name="m" select = "*[3]"/>
1966       <xsl:choose>
1967         <xsl:when test="*[4]=m:cn">
1968           <xsl:variable name="n" select = "*[4]"/>
1969           <xsl:copy-of select = "m:matrix/*[position()=$m]/*[position()=$n]"/>
1970         </xsl:when>
1971         <xsl:otherwise>
1972           <xsl:copy-of select = "m:matrix/*[position()=$m]"/>
1973         </xsl:otherwise>
1974       </xsl:choose>
1975   </xsl:if>
1976   <xsl:if test="(*[2]=m:vector or *[2]=m:list) and *[3]=m:cn">
1977     <xsl:variable name="m" select = "*[3]"/>
1978     <xsl:copy-of select = "*[2]/*[position()=$m]"/>
1979   </xsl:if>
1980 </xsl:template>
1981
1982 <xsl:template match = "m:apply[m:vectorproduct[1] | m:scalarproduct[1] | m:outerproduct[1]]">
1983   <m:mrow>
1984     <xsl:call-template name="insert_xref"/>
1985     <xsl:apply-templates select="*[2]" mode = "semantics"/>
1986     <xsl:choose>
1987       <xsl:when test="m:vectorproduct[1]">
1988         <m:mo><xsl:call-template name="insert1"/> <mchar name="Cross"/> </m:mo>
1989       </xsl:when>
1990       <xsl:when test="m:scalarproduct[1] | m:outerproduct[1]">
1991         <m:mo><xsl:call-template name="insert1"/>.</m:mo>
1992       </xsl:when>
1993     </xsl:choose>
1994     <xsl:apply-templates select="*[3]" mode = "semantics"/>
1995   </m:mrow>
1996 </xsl:template>
1997
1998 </xsl:stylesheet>
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014