]> matita.cs.unibo.it Git - helm.git/blob - helm/style/mml2mmlv1_0.xsl
This commit was manufactured by cvs2svn to create tag 'V6-2'.
[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     <m:mo><xsl:call-template name="insert1"/>not</m:mo>
1159     <xsl:apply-templates select = "*[2]" mode = "semantics">
1160       <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1161     </xsl:apply-templates>
1162   </m:mrow>
1163 </xsl:template>
1164
1165 <xsl:template match = "m:apply[m:forall[1]]">
1166   <m:mrow>
1167     <xsl:call-template name="insert_xref"/>
1168     <m:mo><xsl:call-template name="insert1"/>for all</m:mo>
1169     <m:mfenced separators=",">
1170       <xsl:for-each select = "m:bvar">
1171         <xsl:apply-templates select = "." mode="semantics"/>
1172       </xsl:for-each>
1173     </m:mfenced>
1174     <xsl:if test="m:condition">
1175       <m:mo>:</m:mo>
1176       <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1177       <m:mo>,</m:mo>
1178     </xsl:if>
1179     <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and not(self::m:condition)]" mode = "semantics"/>
1180   </m:mrow>
1181 </xsl:template>
1182
1183 <xsl:template match = "m:apply[m:exists[1]]">
1184   <m:mrow>
1185     <xsl:call-template name="insert_xref"/>
1186     <m:mo><xsl:call-template name="insert1"/> <mchar name="Exists"/> </m:mo>
1187     <m:mfenced separators=",">
1188       <xsl:for-each select = "m:bvar">
1189         <xsl:apply-templates select = "." mode="semantics"/>
1190       </xsl:for-each>
1191     </m:mfenced>
1192     <xsl:if test="m:condition">
1193       <m:mo>,</m:mo>
1194       <xsl:apply-templates select = "m:condition/*" mode = "semantics"/>
1195     </xsl:if>
1196     <m:mo>:</m:mo>
1197     <xsl:apply-templates select = "*[position()>1 and not(self::m:bvar) and not(self::m:condition)]" mode = "semantics"/>
1198   </m:mrow>
1199 </xsl:template>
1200
1201 <xsl:template match = "m:apply[m:abs[1]]">
1202   <xsl:if test="not(parent::m:apply[m:power[1]])">
1203     <m:mfenced open="|" close="|" separators="">
1204       <xsl:call-template name="insert_xref"/>
1205       <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1206     </m:mfenced>
1207   </xsl:if>
1208   <xsl:if test="parent::m:apply[m:power[1]]">
1209     <m:msup>
1210       <m:mfenced open="|" close="|" separators="">
1211         <xsl:call-template name="insert_xref"/>
1212         <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1213       </m:mfenced>
1214       <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1215     </m:msup>
1216   </xsl:if>
1217 </xsl:template>
1218
1219 <xsl:template match = "m:apply[m:conjugate[1]]">
1220   <m:mover>
1221     <m:mrow>
1222       <xsl:apply-templates select = "*[position()>1]" mode = "semantics"/>
1223     </m:mrow>
1224     <m:mo><xsl:call-template name="insert1"/> <mchar name="UnderBar"/> </m:mo>
1225   </m:mover>
1226 </xsl:template>
1227
1228 <xsl:template match = "m:apply[m:arg[1] | m:real[1] | m:imaginary[1]]">
1229   <m:mrow>
1230     <xsl:call-template name="insert_xref"/>
1231     <xsl:choose>
1232       <xsl:when test="m:arg">
1233         <m:mo><xsl:call-template name="insert1"/>arg</m:mo>
1234       </xsl:when>
1235       <xsl:when test="m:real">
1236         <m:mo><xsl:call-template name="insert1"/>Real</m:mo>
1237       </xsl:when>
1238       <xsl:when test="m:imaginary">
1239         <m:mo><xsl:call-template name="insert1"/>Imaginary</m:mo>
1240       </xsl:when>
1241     </xsl:choose>
1242     <m:mfenced separators="">
1243       <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1244     </m:mfenced>
1245   </m:mrow>
1246 </xsl:template>
1247
1248
1249 <!-- RELATIONS -->
1250
1251 <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]">
1252   <m:mrow>
1253     <xsl:call-template name="insert_xref"/>
1254     <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">
1255       <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1256       <xsl:if test="*[1]=m:neq">
1257         <m:mo><xsl:call-template name="insert1"/> <mchar name="NotEqual"/> </m:mo>
1258       </xsl:if>
1259       <xsl:if test="*[1]=m:approx">
1260         <m:mo><xsl:call-template name="insert1"/> <mchar name="approxeq"/> </m:mo>
1261       </xsl:if>
1262       <xsl:if test="*[1]=m:tendsto">
1263         <m:mo><xsl:call-template name="insert1"/> <mchar name="RightArrow"/> </m:mo>
1264       </xsl:if>
1265       <xsl:if test="*[1]=m:implies">
1266         <m:mo><xsl:call-template name="insert1"/> <mchar name="DoubleRightArrow"/> </m:mo>
1267       </xsl:if>
1268       <xsl:if test="*[1]=m:in">
1269         <m:mo><xsl:call-template name="insert1"/>
1270         <mchar name="Element"/> 
1271        </m:mo>
1272       </xsl:if>
1273       <xsl:if test="*[1]=m:notin">
1274         <m:mo><xsl:call-template name="insert1"/> <mchar name="NotElement"/> </m:mo>
1275       </xsl:if>
1276       <xsl:if test="*[1]=m:notsubset">
1277         <m:mo> <xsl:call-template name="insert1"/> <mchar name="NotSubset"/> </m:mo>
1278       </xsl:if>
1279       <xsl:if test="*[1]=m:notprsubset">
1280         <m:mo> <xsl:call-template name="insert1"/> <mchar name="NotSubsetEqual"/> </m:mo>
1281       </xsl:if>
1282       <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1283       <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='below']">
1284         <m:mo><xsl:call-template name="insert1"/>-</m:mo>
1285       </xsl:if>
1286       <xsl:if test="*[1]=m:tendsto and m:tendsto[1][@type='above']">
1287         <m:mo><xsl:call-template name="insert1"/>+</m:mo>
1288       </xsl:if>
1289     </xsl:if>
1290     <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">
1291       <xsl:apply-templates select = "*[2]" mode="semantics"/>
1292       <xsl:for-each select = "*[position()>2]">
1293         <xsl:if test="../*[self::m:subset][1]">
1294           <m:mo> <xsl:call-template name="insert2"/> <mchar name="SubsetEqual"/> </m:mo>
1295         </xsl:if>
1296         <xsl:if test="../*[self::m:prsubset][1]">
1297           <m:mo> <xsl:call-template name="insert2"/><mchar name="subset"/> </m:mo>
1298         </xsl:if>
1299         <xsl:if test="../*[self::m:eq][1]">
1300           <m:mo><xsl:call-template name="insert2"/>=</m:mo>
1301         </xsl:if>
1302         <xsl:if test="../*[self::m:gt][1]">
1303           <m:mo><xsl:call-template name="insert2"/>&gt;</m:mo>
1304         </xsl:if>
1305         <xsl:if test="../*[self::m:lt][1]">
1306           <m:mo><xsl:call-template name="insert2"/>&lt;</m:mo>
1307         </xsl:if>
1308         <xsl:if test="../*[self::m:geq][1]">
1309           <m:mo><xsl:call-template name="insert2"/> <mchar name="geq"/> </m:mo>
1310         </xsl:if>
1311         <xsl:if test="../*[self::m:leq][1]">
1312           <m:mo><xsl:call-template name="insert2"/> <mchar name="leq"/> </m:mo>
1313         </xsl:if>
1314         <xsl:if test="../*[self::m:equivalent][1]">
1315           <m:mo><xsl:call-template name="insert2"/> <mchar name="Congruent"/> </m:mo>
1316         </xsl:if>
1317         <xsl:apply-templates select = "." mode="semantics"/>
1318       </xsl:for-each>
1319     </xsl:if>
1320   </m:mrow>
1321 </xsl:template>
1322
1323
1324 <!-- CALCULUS -->
1325
1326 <xsl:template match = "m:apply[*[1][self::m:ln]]">
1327   <m:mrow>
1328     <xsl:call-template name="insert_xref"/>
1329     <xsl:choose>
1330       <xsl:when test="parent::m:apply[m:power[1]]">
1331         <m:msup>
1332           <m:mo><xsl:call-template name="insert1"/>ln</m:mo>
1333           <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1334         </m:msup>
1335       </xsl:when>
1336       <xsl:otherwise>
1337         <m:mo><xsl:call-template name="insert1"/>ln</m:mo>
1338       </xsl:otherwise>
1339     </xsl:choose>
1340     <xsl:apply-templates select = "*[2]" mode = "semantics">
1341       <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1342     </xsl:apply-templates>
1343   </m:mrow>
1344 </xsl:template>
1345
1346 <xsl:template match = "m:apply[m:log[1]]">
1347   <m:mrow>
1348     <xsl:call-template name="insert_xref"/>
1349     <xsl:choose>
1350       <xsl:when test="parent::m:apply[m:power[1]]">
1351         <xsl:if test="not(*[2]=m:logbase)">
1352           <m:msup>
1353             <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1354             <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1355           </m:msup>
1356         </xsl:if>
1357         <xsl:if test="*[2]=m:logbase">
1358           <m:msubsup>
1359             <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1360             <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1361             <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
1362           </m:msubsup>
1363         </xsl:if>
1364       </xsl:when>
1365       <xsl:otherwise>
1366         <xsl:if test="not(*[2]=m:logbase)">
1367           <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1368         </xsl:if>
1369         <xsl:if test="*[2]=m:logbase">
1370           <m:msub>
1371             <m:mo><xsl:call-template name="insert1"/>log</m:mo>
1372             <xsl:apply-templates select = "m:logbase" mode = "semantics"/>
1373           </m:msub>
1374         </xsl:if>
1375       </xsl:otherwise>
1376     </xsl:choose>
1377     <xsl:if test="*[2]=m:logbase">
1378       <xsl:apply-templates select = "*[3]" mode = "semantics">
1379         <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1380       </xsl:apply-templates>
1381     </xsl:if>
1382     <xsl:if test="not(*[2]=m:logbase)">
1383       <xsl:apply-templates select = "*[2]" mode = "semantics">
1384         <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1385       </xsl:apply-templates>
1386     </xsl:if>
1387   </m:mrow>
1388 </xsl:template>
1389
1390 <xsl:template match = "m:apply[m:diff[1]]">
1391   <m:mrow>
1392     <xsl:call-template name="insert_xref"/>
1393     <xsl:if test="*[2]=m:bvar and m:bvar[*[2]=m:degree]">
1394       <m:mfrac><xsl:call-template name="insert1"/>
1395         <m:msup>
1396           <m:mo>d</m:mo>
1397           <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
1398         </m:msup>
1399         <m:mrow>
1400           <m:mo>d</m:mo>
1401           <m:msup>
1402             <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
1403             <xsl:apply-templates select = "m:bvar/m:degree" mode = "semantics"/>
1404           </m:msup>
1405         </m:mrow>
1406       </m:mfrac>
1407     </xsl:if>
1408     <xsl:if test="*[2]=m:bvar and not(m:bvar[*[2]=m:degree])">
1409       <m:mfrac><xsl:call-template name="insert1"/>
1410         <m:mo>d</m:mo>
1411         <m:mrow>
1412           <m:mo>d</m:mo>
1413           <xsl:apply-templates select = "m:bvar/*[1]" mode = "semantics"/>
1414         </m:mrow>
1415       </m:mfrac>
1416     </xsl:if>
1417     <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1418   </m:mrow>
1419 </xsl:template>
1420
1421 <xsl:template match = "m:apply[m:partialdiff[1]]">
1422   <m:mrow>
1423     <xsl:call-template name="insert_xref"/>
1424     <xsl:for-each select = "m:bvar">
1425       <xsl:if test="*[last()]=m:degree">
1426         <m:mfrac><xsl:call-template name="insert1"/>
1427           <m:msup>
1428              <m:mo>d</m:mo>
1429              <xsl:apply-templates select = "m:degree" mode = "semantics"/>
1430           </m:msup>
1431           <m:mrow>
1432             <m:mo>d</m:mo>
1433             <m:msup>
1434               <xsl:apply-templates select = "*[1]" mode = "semantics"/>
1435               <xsl:apply-templates select = "m:degree" mode = "semantics"/>
1436             </m:msup>
1437           </m:mrow>
1438         </m:mfrac>
1439       </xsl:if>
1440       <xsl:if test="not(*[last()]=m:degree)">
1441         <m:mfrac><xsl:call-template name="insert1"/>
1442           <m:mo>d</m:mo>
1443           <m:mrow>
1444             <m:mo>d</m:mo>
1445             <xsl:apply-templates select = "*[1]" mode = "semantics"/>
1446           </m:mrow>
1447         </m:mfrac>
1448       </xsl:if>
1449     </xsl:for-each>
1450     <xsl:apply-templates select = "*[last()]" mode = "semantics"/>
1451   </m:mrow>
1452 </xsl:template>
1453
1454 <xsl:template match = "m:lowlimit | m:uplimit | m:bvar | m:degree | m:logbase">
1455   <xsl:apply-templates mode = "semantics"/>
1456 </xsl:template>
1457
1458 <xsl:template match = "m:apply[m:divergence[1] | m:grad[1] | m:curl[1]]">
1459   <m:mrow>
1460     <xsl:call-template name="insert_xref"/>
1461     <xsl:if test="*[1]=m:divergence">
1462       <m:mo><xsl:call-template name="insert1"/>div</m:mo>
1463     </xsl:if>
1464     <xsl:if test="*[1]=m:grad">
1465     <m:mo><xsl:call-template name="insert1"/>grad</m:mo>
1466     </xsl:if>
1467     <xsl:if test="*[1]=m:curl">
1468     <m:mo><xsl:call-template name="insert1"/>curl</m:mo>
1469     </xsl:if>
1470     <xsl:choose>
1471       <xsl:when test="*[2]=m:ci">
1472         <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1473       </xsl:when>
1474       <xsl:otherwise>
1475         <m:mfenced separators="">
1476           <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1477         </m:mfenced>
1478       </xsl:otherwise>
1479     </xsl:choose>
1480   </m:mrow>
1481 </xsl:template>
1482
1483 <xsl:template match = "m:apply[m:laplacian[1]]">
1484   <m:mrow>
1485     <xsl:call-template name="insert_xref"/>
1486     <m:msup><xsl:call-template name="insert1"/>
1487       <m:mo> &#x0394; </m:mo>
1488       <m:mn>2</m:mn>
1489     </m:msup>
1490     <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1491   </m:mrow>
1492 </xsl:template>
1493
1494
1495 <!-- SET THEORY -->
1496
1497 <xsl:template match = "m:set | m:list">
1498   <m:mfenced open="{{" close="}}" separators="">
1499     <xsl:call-template name="insert_xref"/>
1500     <xsl:if test="*[1]=m:bvar and *[2]=m:condition">
1501       <xsl:apply-templates select="m:bvar" mode = "semantics"/>
1502       <m:mo>|</m:mo>
1503       <xsl:apply-templates select="m:condition" mode = "semantics"/>
1504     </xsl:if>
1505     <xsl:if test="*[1]=m:condition and not(child::m:bvar)">
1506       <m:mfenced open="" close="" separators=",">
1507         <xsl:for-each select = "*[not(self::m:condition) and not(self::m:bvar)]">
1508           <xsl:apply-templates select = "." mode="semantics"/>
1509         </xsl:for-each>
1510       </m:mfenced>
1511       <m:mo>|</m:mo>
1512       <xsl:apply-templates select="m:condition" mode = "semantics"/>
1513     </xsl:if>
1514     <xsl:if test="not(child::m:bvar) and not(child::m:condition)">
1515       <m:mfenced open="" close="" separators=",">
1516         <xsl:for-each select = "*">
1517           <xsl:apply-templates select = "." mode="semantics"/>
1518         </xsl:for-each>
1519       </m:mfenced>
1520     </xsl:if>
1521   </m:mfenced>
1522 </xsl:template>
1523
1524 <xsl:template match = "m:apply[m:union[1]]">
1525   <xsl:param name="IN_PREC" select="$NO_PREC"/>
1526   <xsl:param name="PARAM" select="$NO_PARAM"/>
1527   <xsl:param name="PAREN" select="$PAR_NO"/>
1528   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1529   <xsl:choose>
1530     <xsl:when test="$IN_PREC &gt; $UNION_PREC or $IN_PREC=$UNION_PREC and $PARAM=$PAR_SAME">
1531       <m:mfenced separators="" helm:xref="{@helm:xref}">
1532         <xsl:call-template name="insert_xref"/>
1533         <xsl:apply-templates select="." mode="union">
1534           <xsl:with-param name="PARAM" select="$PARAM"/>
1535           <xsl:with-param name="PAREN" select="$PAREN"/>
1536           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1537         </xsl:apply-templates>
1538       </m:mfenced>
1539     </xsl:when>
1540     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC and not($SEM_SW=2)">
1541       <xsl:apply-templates select="." mode="union">
1542         <xsl:with-param name="PARAM" select="$PARAM"/>
1543         <xsl:with-param name="PAREN" select="$PAREN"/>
1544         <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1545       </xsl:apply-templates>
1546     </xsl:when>
1547     <xsl:otherwise>
1548       <m:mrow>
1549         <xsl:call-template name="insert_xref"/>
1550         <xsl:apply-templates select="." mode="union">
1551           <xsl:with-param name="PARAM" select="$PARAM"/>
1552           <xsl:with-param name="PAREN" select="$PAREN"/>
1553           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1554         </xsl:apply-templates>
1555       </m:mrow>
1556     </xsl:otherwise>
1557   </xsl:choose>
1558 </xsl:template>
1559
1560 <xsl:template match = "m:apply[m:union[1]]" mode="union">
1561   <xsl:param name="PARAM" select="$NO_PARAM"/>
1562   <xsl:param name="PAREN" select="$PAR_NO"/>
1563   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1564   <xsl:apply-templates select = "*[2]" mode="semantics">
1565     <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
1566     <xsl:with-param name="PARAM" select="$PARAM"/>
1567     <xsl:with-param name="PAREN" select="$PAREN"/>
1568     <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1569   </xsl:apply-templates>
1570   <xsl:for-each select = "*[position()>2]">
1571     <m:mo><xsl:call-template name="insert2"/> <mchar name="Union"/> </m:mo>
1572     <xsl:apply-templates select = "." mode="semantics">
1573       <xsl:with-param name="IN_PREC" select="$UNION_PREC"/>
1574       <xsl:with-param name="PAREN" select="$PAREN"/>
1575       <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1576     </xsl:apply-templates>
1577   </xsl:for-each>
1578 </xsl:template>
1579
1580 <xsl:template match = "m:apply[m:intersect[1]]">
1581   <xsl:param name="IN_PREC" select="$NO_PREC"/>
1582   <xsl:param name="PARAM" select="$NO_PARAM"/>
1583   <xsl:param name="PAREN" select="$PAR_NO"/>
1584   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1585   <xsl:choose>
1586     <xsl:when test="$IN_PREC &gt; $INTERSECT_PREC">
1587       <m:mfenced separators="" helm:xref="{@helm:xref}">
1588         <xsl:call-template name="insert_xref"/>
1589         <xsl:apply-templates select="." mode="intersect">
1590           <xsl:with-param name="PARAM" select="$PARAM"/>
1591           <xsl:with-param name="PAREN" select="$PAREN"/>
1592           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1593         </xsl:apply-templates>
1594       </m:mfenced>
1595     </xsl:when>
1596     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC and not($SEM_SW=2)">
1597       <xsl:apply-templates select="." mode="intersect">
1598         <xsl:with-param name="PARAM" select="$PARAM"/>
1599         <xsl:with-param name="PAREN" select="$PAREN"/>
1600         <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1601       </xsl:apply-templates>
1602     </xsl:when>
1603     <xsl:otherwise>
1604       <m:mrow>
1605         <xsl:call-template name="insert_xref"/>
1606         <xsl:apply-templates select="." mode="intersect">
1607           <xsl:with-param name="PARAM" select="$PARAM"/>
1608           <xsl:with-param name="PAREN" select="$PAREN"/>
1609           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1610         </xsl:apply-templates>
1611       </m:mrow>
1612     </xsl:otherwise>
1613   </xsl:choose>
1614 </xsl:template>
1615
1616 <xsl:template match = "m:apply[m:intersect[1]]" mode="intersect">
1617   <xsl:param name="PARAM" select="$NO_PARAM"/>
1618   <xsl:param name="PAREN" select="$PAR_NO"/>
1619   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1620   <xsl:apply-templates select = "*[2]" mode="semantics">
1621     <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
1622     <xsl:with-param name="PARAM" select="$PARAM"/>
1623     <xsl:with-param name="PAREN" select="$PAREN"/>
1624     <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1625   </xsl:apply-templates>
1626   <xsl:for-each select = "*[position()>2]">
1627     <m:mo><xsl:call-template name="insert2"/> <mchar name="Intersection"/> </m:mo>
1628     <xsl:apply-templates select = "." mode="semantics">
1629       <xsl:with-param name="IN_PREC" select="$INTERSECT_PREC"/>
1630       <xsl:with-param name="PAREN" select="$PAREN"/>
1631       <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1632     </xsl:apply-templates>
1633   </xsl:for-each>
1634 </xsl:template>
1635
1636 <xsl:template match = "m:apply[m:setdiff[1]]">
1637   <xsl:param name="IN_PREC" select="$NO_PREC"/>
1638   <xsl:param name="PARAM" select="$NO_PARAM"/>
1639   <xsl:param name="PAREN" select="$PAR_NO"/>
1640   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1641   <xsl:choose>
1642     <xsl:when test="$IN_PREC &gt; $SETDIFF_PREC or $IN_PREC=$SETDIFF_PREC and $PARAM=$PAR_SAME">
1643       <m:mfenced separators="">
1644         <xsl:call-template name="insert_xref"/>
1645         <xsl:apply-templates select="." mode="setdiff">
1646           <xsl:with-param name="PARAM" select="$PARAM"/>
1647           <xsl:with-param name="PAREN" select="$PAREN"/>
1648           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1649         </xsl:apply-templates>
1650       </m:mfenced>
1651     </xsl:when>
1652     <xsl:when test="$IN_PREC &gt; $NO_PREC and $IN_PREC &lt; $FUNCTION_PREC and not($SEM_SW=2)">
1653       <xsl:apply-templates select="." mode="setdiff">
1654         <xsl:with-param name="PARAM" select="$PARAM"/>
1655         <xsl:with-param name="PAREN" select="$PAREN"/>
1656         <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1657       </xsl:apply-templates>
1658     </xsl:when>
1659     <xsl:otherwise>
1660       <m:mrow>
1661         <xsl:call-template name="insert_xref"/>
1662         <xsl:apply-templates select="." mode="setdiff">
1663           <xsl:with-param name="PARAM" select="$PARAM"/>
1664           <xsl:with-param name="PAREN" select="$PAREN"/>
1665           <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1666         </xsl:apply-templates>
1667       </m:mrow>
1668     </xsl:otherwise>
1669   </xsl:choose>
1670 </xsl:template>
1671
1672 <xsl:template match = "m:apply[m:setdiff[1]]" mode="setdiff">
1673   <xsl:param name="PARAM" select="$NO_PARAM"/>
1674   <xsl:param name="PAREN" select="$PAR_NO"/>
1675   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
1676   <xsl:apply-templates select = "*[2]" mode = "semantics">
1677     <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
1678     <xsl:with-param name="PARAM" select="$PARAM"/>
1679     <xsl:with-param name="PAREN" select="$PAREN"/>
1680     <xsl:with-param name="PAR_NO_IGNORE" select="$PAR_NO_IGNORE"/>
1681   </xsl:apply-templates>
1682   <m:mo><xsl:call-template name="insert1"/>\</m:mo>
1683   <xsl:apply-templates select = "*[3]" mode = "semantics">
1684     <xsl:with-param name="IN_PREC" select="$SETDIFF_PREC"/>
1685     <xsl:with-param name="PARAM" select="$PAR_SAME"/>
1686     <xsl:with-param name="PAREN" select="$PAREN"/>
1687     <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1688   </xsl:apply-templates>
1689 </xsl:template>
1690
1691 <xsl:template match = "m:apply[m:card[1]]">
1692   <m:mfenced open="|" close="|" separators=",">
1693     <xsl:call-template name="insert_xref"/>
1694     <xsl:for-each select = "*[position()>1]">
1695       <xsl:apply-templates select = "." mode="semantics"/>
1696     </xsl:for-each>
1697   </m:mfenced>
1698 </xsl:template>
1699
1700
1701 <!-- SEQUENCES AND SERIES -->
1702
1703 <xsl:template match = "m:apply[m:sum[1] | m:product[1]]">
1704   <m:mrow>
1705     <xsl:call-template name="insert_xref"/>
1706     <xsl:choose>
1707       <xsl:when test="*[2]=m:bvar and m:lowlimit and m:uplimit">
1708         <m:munderover>
1709           <xsl:if test="*[1]=m:sum">
1710             <m:mo><xsl:call-template name="insert1"/> <mchar name="Sum"/> </m:mo>
1711           </xsl:if>
1712           <xsl:if test="*[1]=m:product">
1713             <m:mo><xsl:call-template name="insert1"/> <mchar name="Product"/> </m:mo>
1714           </xsl:if>
1715           <m:mrow>
1716             <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1717             <m:mo>=</m:mo>
1718             <xsl:apply-templates select = "m:lowlimit" mode = "semantics"/>
1719           </m:mrow>
1720           <xsl:apply-templates select = "m:uplimit" mode = "semantics"/>
1721         </m:munderover>
1722         <xsl:apply-templates select = "*[5]" mode = "semantics"/>
1723       </xsl:when>
1724       <xsl:when test="*[2]=m:bvar and *[3]=m:condition">
1725         <m:munder>
1726           <xsl:if test="*[1]=m:sum">
1727             <m:mo><xsl:call-template name="insert1"/> <mchar name="Sum"/> </m:mo>
1728           </xsl:if>
1729           <xsl:if test="*[1]=m:product">
1730             <m:mo><xsl:call-template name="insert1"/> <mchar name="Product"/> </m:mo>
1731           </xsl:if>
1732           <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1733         </m:munder>
1734         <xsl:apply-templates select = "*[4]" mode = "semantics"/>
1735       </xsl:when>
1736     </xsl:choose>
1737   </m:mrow>
1738 </xsl:template>
1739
1740 <xsl:template match = "m:apply[m:limit[1]]">
1741   <m:mrow>
1742     <xsl:call-template name="insert_xref"/>
1743     <m:munder>
1744       <m:mo><xsl:call-template name="insert1"/>lim</m:mo>
1745       <m:mrow>
1746         <xsl:if test="*[2]=m:bvar and *[3]=m:lowlimit">
1747             <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1748             <m:mo> <mchar name="RightArrow"/> </m:mo>
1749             <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1750         </xsl:if>
1751         <xsl:if test="*[2]=m:bvar and *[3]=m:condition">
1752           <xsl:apply-templates select = "*[3]" mode = "semantics"/>
1753         </xsl:if>
1754       </m:mrow>
1755     </m:munder>
1756     <xsl:apply-templates select = "*[4]" mode = "semantics"/>
1757   </m:mrow>
1758 </xsl:template>
1759
1760
1761 <!-- TRIGONOMETRY -->
1762
1763 <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]]">
1764   <m:mrow>
1765     <xsl:call-template name="insert_xref"/>
1766     <xsl:if test="not(parent::m:apply[m:power[1]])">
1767       <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
1768     </xsl:if>
1769     <xsl:if test="parent::m:apply[m:power[1]]">
1770       <m:msup>
1771         <xsl:apply-templates select = "*[1]" mode = "trigonometry"/>
1772         <xsl:apply-templates select = "../*[3]" mode = "semantics"/>
1773       </m:msup>
1774     </xsl:if>
1775     <xsl:apply-templates select = "*[2]" mode = "semantics">
1776       <xsl:with-param name="IN_PREC" select="$FUNCTION_PREC"/>
1777       <xsl:with-param name="PAR_NO_IGNORE" select="$NO"/>
1778     </xsl:apply-templates>
1779   </m:mrow>
1780 </xsl:template>
1781
1782 <xsl:template match = "m:*" mode = "trigonometry">
1783     <xsl:choose>
1784       <xsl:when test="self::m:sin">
1785         <m:mo>sin</m:mo>
1786       </xsl:when>
1787       <xsl:when test="self::m:cos">
1788         <m:mo>cos</m:mo>
1789       </xsl:when>
1790       <xsl:when test="self::m:tan">
1791         <m:mo>tan</m:mo>
1792       </xsl:when>
1793       <xsl:when test="self::m:sec">
1794         <m:mo>sec</m:mo>
1795       </xsl:when>
1796       <xsl:when test="self::m:csc">
1797         <m:mo>csc</m:mo>
1798       </xsl:when>
1799       <xsl:when test="self::m:cot">
1800         <m:mo>cot</m:mo>
1801       </xsl:when>
1802       <xsl:when test="self::m:sinh">
1803         <m:mo>sinh</m:mo>
1804       </xsl:when>
1805       <xsl:when test="self::m:cosh">
1806         <m:mo>cosh</m:mo>
1807       </xsl:when>
1808       <xsl:when test="self::m:tanh">
1809         <m:mo>tanh</m:mo>
1810       </xsl:when>
1811       <xsl:when test="self::m:sech">
1812         <m:mo>sech</m:mo>
1813       </xsl:when>
1814       <xsl:when test="self::m:csch">
1815         <m:mo>csch</m:mo>
1816       </xsl:when>
1817       <xsl:when test="self::m:coth">
1818         <m:mo>coth</m:mo>
1819       </xsl:when>
1820       <xsl:when test="self::m:arcsin">
1821         <m:mo>arcsin</m:mo>
1822       </xsl:when>
1823       <xsl:when test="self::m:arccos">
1824         <m:mo>arccos</m:mo>
1825       </xsl:when>
1826       <xsl:when test="self::m:arctan">
1827         <m:mo>arctan</m:mo>
1828       </xsl:when>
1829     </xsl:choose>
1830 </xsl:template>
1831
1832
1833 <!-- STATISTICS -->
1834
1835 <xsl:template match = "m:apply[m:mean[1]]">
1836   <m:mfenced open="&lt;" close="&gt;" separators=",">
1837     <xsl:call-template name="insert_xref"/>
1838     <xsl:for-each select = "*[position()>1]">
1839       <xsl:apply-templates select = "." mode="semantics"/>
1840     </xsl:for-each>
1841   </m:mfenced>
1842 </xsl:template>
1843
1844 <xsl:template match = "m:apply[m:sdev[1]]">
1845   <m:mrow>
1846     <xsl:call-template name="insert_xref"/>
1847     <m:mo><xsl:call-template name="insert1"/> &#x03c3; </m:mo>
1848     <m:mfenced separators=",">
1849       <xsl:for-each select = "*[position()>1]">
1850         <xsl:apply-templates select = "." mode="semantics"/>
1851       </xsl:for-each>
1852     </m:mfenced>
1853   </m:mrow>
1854 </xsl:template>
1855
1856 <xsl:template match = "m:apply[m:variance[1]]">
1857   <m:mrow>
1858     <xsl:call-template name="insert_xref"/>
1859     <m:mo><xsl:call-template name="insert1"/> &#x03c3; </m:mo>
1860     <m:msup>
1861       <m:mfenced separators=",">
1862         <xsl:for-each select = "*[position()>1]">
1863           <xsl:apply-templates select = "." mode="semantics"/>
1864         </xsl:for-each>
1865       </m:mfenced>
1866       <m:mn>2</m:mn>
1867     </m:msup>
1868   </m:mrow>
1869 </xsl:template>
1870
1871 <xsl:template match = "m:apply[m:median[1]]">
1872   <m:mrow>
1873     <xsl:call-template name="insert_xref"/>
1874     <m:mo><xsl:call-template name="insert1"/>median</m:mo>
1875     <m:mfenced separators=",">
1876       <xsl:for-each select = "*[position()>1]">
1877         <xsl:apply-templates select = "." mode="semantics"/>
1878       </xsl:for-each>
1879     </m:mfenced>
1880   </m:mrow>
1881 </xsl:template>
1882
1883 <xsl:template match = "m:apply[m:mode[1]]">
1884   <m:mrow>
1885     <xsl:call-template name="insert_xref"/>
1886     <m:mo><xsl:call-template name="insert1"/>mode</m:mo>
1887     <m:mfenced separators=",">
1888       <xsl:for-each select = "*[position()>1]">
1889         <xsl:apply-templates select = "." mode="semantics"/>
1890       </xsl:for-each>
1891     </m:mfenced>
1892   </m:mrow>
1893 </xsl:template>
1894
1895 <xsl:template match = "m:apply[m:moment[1]]">
1896   <xsl:call-template name="insert_xref"/>
1897   <m:mfenced open="&lt;" close="&gt;" separators="">
1898     <xsl:if test="*[2]=m:degree">
1899       <m:msup>
1900         <xsl:apply-templates select="*[3]" mode = "semantics"/>
1901         <xsl:apply-templates select="*[2]" mode = "semantics"/>
1902       </m:msup>
1903     </xsl:if>
1904     <xsl:if test="not(*[2]=m:degree)">
1905       <xsl:for-each select = "*[position()>1]">
1906         <xsl:apply-templates select = "." mode="semantics"/>
1907       </xsl:for-each>
1908     </xsl:if>
1909   </m:mfenced>
1910 </xsl:template>
1911
1912
1913 <!-- LINEAR ALGEBRA -->
1914
1915 <xsl:template match="m:vector">
1916   <m:mfenced separators="">
1917     <m:mtable>
1918       <xsl:for-each select="*">
1919         <m:mtd>
1920           <xsl:apply-templates select="." mode = "semantics"/>
1921         </m:mtd>
1922       </xsl:for-each>
1923     </m:mtable>
1924   </m:mfenced>
1925 </xsl:template>
1926
1927 <xsl:template match = "m:matrix">
1928   <m:mfenced separators="">
1929     <m:mtable>
1930       <xsl:apply-templates mode = "semantics"/>
1931     </m:mtable>
1932   </m:mfenced>
1933 </xsl:template>
1934
1935 <xsl:template match = "m:matrixrow">
1936   <m:mtr>
1937     <xsl:for-each select="*">
1938       <m:mtd>
1939         <xsl:apply-templates select="." mode = "semantics"/>
1940       </m:mtd>
1941     </xsl:for-each>
1942   </m:mtr>
1943 </xsl:template>
1944
1945 <xsl:template match = "m:apply[m:determinant[1]]">
1946   <m:mrow>
1947     <xsl:call-template name="insert_xref"/>
1948     <m:mo><xsl:call-template name="insert1"/>det</m:mo>
1949     <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1950   </m:mrow>
1951 </xsl:template>
1952
1953 <xsl:template match = "m:apply[m:transpose[1]]">
1954   <m:msup>
1955     <xsl:apply-templates select = "*[2]" mode = "semantics"/>
1956     <m:mo>T</m:mo>
1957   </m:msup>
1958 </xsl:template>
1959
1960 <xsl:template match = "m:apply[m:selector[1]]">
1961   <xsl:if test="*[2]=m:matrix and *[3]=m:cn">
1962       <xsl:variable name="m" select = "*[3]"/>
1963       <xsl:choose>
1964         <xsl:when test="*[4]=m:cn">
1965           <xsl:variable name="n" select = "*[4]"/>
1966           <xsl:copy-of select = "m:matrix/*[position()=$m]/*[position()=$n]"/>
1967         </xsl:when>
1968         <xsl:otherwise>
1969           <xsl:copy-of select = "m:matrix/*[position()=$m]"/>
1970         </xsl:otherwise>
1971       </xsl:choose>
1972   </xsl:if>
1973   <xsl:if test="(*[2]=m:vector or *[2]=m:list) and *[3]=m:cn">
1974     <xsl:variable name="m" select = "*[3]"/>
1975     <xsl:copy-of select = "*[2]/*[position()=$m]"/>
1976   </xsl:if>
1977 </xsl:template>
1978
1979 <xsl:template match = "m:apply[m:vectorproduct[1] | m:scalarproduct[1] | m:outerproduct[1]]">
1980   <m:mrow>
1981     <xsl:call-template name="insert_xref"/>
1982     <xsl:apply-templates select="*[2]" mode = "semantics"/>
1983     <xsl:choose>
1984       <xsl:when test="m:vectorproduct[1]">
1985         <m:mo><xsl:call-template name="insert1"/> <mchar name="Cross"/> </m:mo>
1986       </xsl:when>
1987       <xsl:when test="m:scalarproduct[1] | m:outerproduct[1]">
1988         <m:mo><xsl:call-template name="insert1"/>.</m:mo>
1989       </xsl:when>
1990     </xsl:choose>
1991     <xsl:apply-templates select="*[3]" mode = "semantics"/>
1992   </m:mrow>
1993 </xsl:template>
1994
1995 </xsl:stylesheet>
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011