[PLUGINS] +set de base
[lhc/web/www.git] / www / plugins / odt2spip_30 / inc / xsltml / cmarkup.xsl
1 <?xml version='1.0' encoding="UTF-8"?>
2 <xsl:stylesheet
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:m="http://www.w3.org/1998/Math/MathML"
5 version='1.0'>
6
7 <!-- ====================================================================== -->
8 <!-- $id: tokens.xsl, 2002/22/11 Exp $
9 This file is part of the XSLT MathML Library distribution.
10 See ./README or http://www.raleigh.ru/MathML/mmltex for
11 copyright and other information -->
12 <!-- ====================================================================== -->
13
14 <!-- 4.4.1.1 cn -->
15 <xsl:template match="m:cn"><xsl:apply-templates/></xsl:template>
16
17 <xsl:template match="m:cn[@type='complex-cartesian']">
18 <xsl:apply-templates select="text()[1]"/>
19 <xsl:text>+</xsl:text>
20 <xsl:apply-templates select="text()[2]"/>
21 <xsl:text>i</xsl:text>
22 </xsl:template>
23
24 <xsl:template match="m:cn[@type='rational']">
25 <xsl:apply-templates select="text()[1]"/>
26 <xsl:text>/</xsl:text>
27 <xsl:apply-templates select="text()[2]"/>
28 </xsl:template>
29
30 <xsl:template match="m:cn[@type='integer' and @base!=10]">
31 <xsl:apply-templates/>
32 <xsl:text>_{</xsl:text><xsl:value-of select="@base"/><xsl:text>}</xsl:text>
33 </xsl:template>
34
35 <xsl:template match="m:cn[@type='complex-polar']">
36 <xsl:apply-templates select="text()[1]"/>
37 <xsl:text>e^{i </xsl:text>
38 <xsl:apply-templates select="text()[2]"/>
39 <xsl:text>}</xsl:text>
40 </xsl:template>
41
42 <xsl:template match="m:cn[@type='e-notation']">
43 <xsl:apply-templates select="text()[1]"/>
44 <xsl:text>E</xsl:text>
45 <xsl:apply-templates select="text()[2]"/>
46 </xsl:template>
47
48 <!-- 4.4.1.1 ci 4.4.1.2 csymbol -->
49 <xsl:template match="m:ci | m:csymbol">
50 <xsl:choose>
51 <xsl:when test="string-length(normalize-space(text()))>1">
52 <xsl:text>\mathrm{</xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text>
53 </xsl:when>
54 <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
55 </xsl:choose>
56 </xsl:template>
57
58 <!-- 4.4.2.1 apply 4.4.2.2 reln -->
59 <xsl:template match="m:apply | m:reln">
60 <xsl:apply-templates select="*[1]">
61 <!-- <? -->
62 <xsl:with-param name="p" select="10"/>
63 </xsl:apply-templates>
64 <!-- ?> -->
65 <xsl:text>(</xsl:text>
66 <xsl:for-each select="*[position()>1]">
67 <xsl:apply-templates select="."/>
68 <xsl:if test="not(position()=last())"><xsl:text>, </xsl:text></xsl:if>
69 </xsl:for-each>
70 <xsl:text>)</xsl:text>
71 </xsl:template>
72
73 <!-- 4.4.2.3 fn -->
74 <xsl:template match="m:fn[m:apply[1]]"> <!-- for m:fn using default rule -->
75 <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
76 </xsl:template>
77
78 <!-- 4.4.2.4 interval -->
79 <xsl:template match="m:interval[*[2]]">
80 <xsl:choose>
81 <xsl:when test="@closure='open' or @closure='open-closed'">
82 <xsl:text>\left(</xsl:text>
83 </xsl:when>
84 <xsl:otherwise><xsl:text>\left[</xsl:text></xsl:otherwise>
85 </xsl:choose>
86 <xsl:apply-templates select="*[1]"/>
87 <xsl:text> , </xsl:text>
88 <xsl:apply-templates select="*[2]"/>
89 <xsl:choose>
90 <xsl:when test="@closure='open' or @closure='closed-open'">
91 <xsl:text>\right)</xsl:text>
92 </xsl:when>
93 <xsl:otherwise><xsl:text>\right]</xsl:text></xsl:otherwise>
94 </xsl:choose>
95 </xsl:template>
96
97 <xsl:template match="m:interval">
98 <xsl:text>\left\{</xsl:text><xsl:apply-templates/><xsl:text>\right\}</xsl:text>
99 </xsl:template>
100
101 <!-- 4.4.2.5 inverse -->
102 <xsl:template match="m:apply[*[1][self::m:inverse]]">
103 <xsl:apply-templates select="*[2]"/><xsl:text>^{(-1)}</xsl:text>
104 </xsl:template>
105
106 <!-- 4.4.2.6 sep 4.4.2.7 condition -->
107 <xsl:template match="m:sep | m:condition"><xsl:apply-templates/></xsl:template>
108
109 <!-- 4.4.2.9 lambda -->
110 <xsl:template match="m:lambda">
111 <xsl:text>\mathrm{lambda}\: </xsl:text>
112 <xsl:apply-templates select="m:bvar/*"/>
113 <xsl:text>.\: </xsl:text>
114 <xsl:apply-templates select="*[last()]"/>
115 </xsl:template>
116
117 <!-- 4.4.2.10 compose -->
118 <xsl:template match="m:apply[*[1][self::m:compose]]">
119 <xsl:param name="p" select="0"/>
120 <xsl:call-template name="infix">
121 <xsl:with-param name="this-p" select="1"/>
122 <xsl:with-param name="p" select="$p"/>
123 <xsl:with-param name="mo">\circ </xsl:with-param>
124 </xsl:call-template>
125 </xsl:template>
126
127 <!-- 4.4.2.11 ident -->
128 <xsl:template match="m:ident"><xsl:text>\mathrm{id}</xsl:text></xsl:template>
129
130 <!-- 4.4.2.12 domain 4.4.2.13 codomain 4.4.2.14 image 4.4.3.21 arg 4.4.3.24 lcm
131 4.4.5.9 grad 4.4.5.10 curl 4.4.9.4 median 4.4.9.5 mode-->
132 <xsl:template match="m:domain | m:codomain | m:image | m:arg | m:lcm | m:grad |
133 m:curl | m:median | m:mode">
134 <xsl:text>\mathop{\mathrm{</xsl:text>
135 <xsl:value-of select="local-name()"/>
136 <xsl:text>}}</xsl:text>
137 </xsl:template>
138
139 <!-- 4.4.2.15 domainofapplication -->
140 <xsl:template match="m:domainofapplication"/>
141
142 <!-- 4.4.2.16 piecewise -->
143 <xsl:template match="m:piecewise">
144 <xsl:text>\begin{cases}</xsl:text>
145 <xsl:apply-templates select="m:piece"/>
146 <xsl:apply-templates select="m:otherwise"/>
147 <xsl:text>\end{cases}</xsl:text>
148 </xsl:template>
149
150 <xsl:template match="m:piece">
151 <xsl:apply-templates select="*[1]"/>
152 <xsl:text> &amp; \text{if $</xsl:text>
153 <xsl:apply-templates select="*[2]"/>
154 <xsl:text>$}</xsl:text>
155 <xsl:if test="not(position()=last()) or ../m:otherwise"><xsl:text>\\ </xsl:text></xsl:if>
156 </xsl:template>
157
158 <xsl:template match="m:otherwise">
159 <xsl:apply-templates select="*[1]"/>
160 <xsl:text> &amp; \text{otherwise}</xsl:text>
161 </xsl:template>
162
163 <!-- 4.4.3.1 quotient -->
164 <xsl:template match="m:apply[*[1][self::m:quotient]]">
165 <xsl:text>\left\lfloor\frac{</xsl:text>
166 <xsl:apply-templates select="*[2]"/>
167 <xsl:text>}{</xsl:text>
168 <xsl:apply-templates select="*[3]"/>
169 <xsl:text>}\right\rfloor </xsl:text>
170 </xsl:template>
171
172 <!-- 4.4.3.2 factorial -->
173 <xsl:template match="m:apply[*[1][self::m:factorial]]">
174 <xsl:apply-templates select="*[2]">
175 <xsl:with-param name="p" select="7"/>
176 </xsl:apply-templates>
177 <xsl:text>!</xsl:text>
178 </xsl:template>
179
180 <!-- 4.4.3.3 divide -->
181 <xsl:template match="m:apply[*[1][self::m:divide]]">
182 <xsl:param name="p" select="0"/>
183 <xsl:param name="this-p" select="3"/>
184 <xsl:if test="$this-p &lt; $p"><xsl:text>\left(</xsl:text></xsl:if>
185 <xsl:text>\frac{</xsl:text>
186 <xsl:apply-templates select="*[2]"/>
187 <!-- <xsl:with-param name="p" select="$this-p"/>
188 </xsl:apply-templates>-->
189 <xsl:text>}{</xsl:text>
190 <xsl:apply-templates select="*[3]"/>
191 <!-- <xsl:with-param name="p" select="$this-p"/>
192 </xsl:apply-templates>-->
193 <xsl:text>}</xsl:text>
194 <xsl:if test="$this-p &lt; $p"><xsl:text>\right)</xsl:text></xsl:if>
195 </xsl:template>
196
197 <!-- 4.4.3.4 max min -->
198 <xsl:template match="m:apply[*[1][self::m:max or self::m:min]]">
199 <xsl:text>\</xsl:text>
200 <xsl:value-of select="local-name(*[1])"/>
201 <xsl:text>\{</xsl:text>
202 <xsl:choose>
203 <xsl:when test="m:condition">
204 <xsl:apply-templates select="*[last()]"/>
205 <xsl:text>, </xsl:text>
206 <xsl:apply-templates select="m:condition/node()"/>
207 </xsl:when>
208 <xsl:otherwise>
209 <xsl:for-each select="*[position() &gt; 1]">
210 <xsl:apply-templates select="."/>
211 <xsl:if test="position() !=last()"><xsl:text> , </xsl:text></xsl:if>
212 </xsl:for-each>
213 </xsl:otherwise>
214 </xsl:choose>
215 <xsl:text>\}</xsl:text>
216 </xsl:template>
217
218 <!-- 4.4.3.5 minus-->
219 <xsl:template match="m:apply[*[1][self::m:minus] and count(*)=2]">
220 <xsl:text>-</xsl:text>
221 <xsl:apply-templates select="*[2]">
222 <xsl:with-param name="p" select="5"/>
223 </xsl:apply-templates>
224 </xsl:template>
225
226 <xsl:template match="m:apply[*[1][self::m:minus] and count(*)&gt;2]">
227 <xsl:param name="p" select="0"/>
228 <xsl:call-template name="binary">
229 <xsl:with-param name="mo">-</xsl:with-param>
230 <xsl:with-param name="p" select="$p"/>
231 <xsl:with-param name="this-p" select="2"/>
232 </xsl:call-template>
233 </xsl:template>
234
235 <!-- 4.4.3.6 plus-->
236 <xsl:template match="m:apply[*[1][self::m:plus]]">
237 <xsl:param name="p" select="0"/>
238 <xsl:if test="$p &gt; 2">
239 <xsl:text>(</xsl:text>
240 </xsl:if>
241 <xsl:for-each select="*[position()&gt;1]">
242 <xsl:if test="position() &gt; 1">
243 <xsl:choose>
244 <xsl:when test="self::m:apply[*[1][self::m:times] and
245 *[2][self::m:apply/*[1][self::m:minus] or self::m:cn[not(m:sep) and
246 (number(.) &lt; 0)]]]">-</xsl:when>
247 <xsl:otherwise>+</xsl:otherwise>
248 </xsl:choose>
249 </xsl:if>
250 <xsl:choose>
251 <xsl:when test="self::m:apply[*[1][self::m:times] and
252 *[2][self::m:cn[not(m:sep) and (number(.) &lt;0)]]]">
253 <xsl:value-of select="-(*[2])"/>
254 <xsl:apply-templates select=".">
255 <xsl:with-param name="first" select="2"/>
256 <xsl:with-param name="p" select="2"/>
257 </xsl:apply-templates>
258 </xsl:when>
259 <xsl:when test="self::m:apply[*[1][self::m:times] and
260 *[2][self::m:apply/*[1][self::m:minus]]]">
261 <xsl:apply-templates select="./*[2]/*[2]"/>
262 <xsl:apply-templates select=".">
263 <xsl:with-param name="first" select="2"/>
264 <xsl:with-param name="p" select="2"/>
265 </xsl:apply-templates>
266 </xsl:when>
267 <xsl:otherwise>
268 <xsl:apply-templates select=".">
269 <xsl:with-param name="p" select="2"/>
270 </xsl:apply-templates>
271 </xsl:otherwise>
272 </xsl:choose>
273 </xsl:for-each>
274 <xsl:if test="$p &gt; 2">
275 <xsl:text>)</xsl:text>
276 </xsl:if>
277 </xsl:template>
278
279 <!-- 4.4.3.7 power -->
280 <xsl:template match="m:apply[*[1][self::m:power]]">
281 <xsl:apply-templates select="*[2]">
282 <xsl:with-param name="p" select="5"/>
283 </xsl:apply-templates>
284 <xsl:text>^{</xsl:text>
285 <xsl:apply-templates select="*[3]">
286 <xsl:with-param name="p" select="5"/>
287 </xsl:apply-templates>
288 <xsl:text>}</xsl:text>
289 </xsl:template>
290
291 <!-- 4.4.3.8 remainder -->
292 <xsl:template match="m:apply[*[1][self::m:rem]]">
293 <xsl:param name="p" select="0"/>
294 <xsl:call-template name="binary">
295 <xsl:with-param name="mo">\mod </xsl:with-param>
296 <xsl:with-param name="p" select="$p"/>
297 <xsl:with-param name="this-p" select="3"/>
298 </xsl:call-template>
299 </xsl:template>
300
301 <!-- 4.4.3.9 times-->
302 <xsl:template match="m:apply[*[1][self::m:times]]" name="times">
303 <xsl:param name="p" select="0"/>
304 <xsl:param name="first" select="1"/>
305 <xsl:if test="$p &gt; 3"><xsl:text>(</xsl:text></xsl:if>
306 <xsl:for-each select="*[position()&gt;1]">
307 <xsl:if test="position() &gt; 1">
308 <xsl:choose>
309 <xsl:when test="self::m:cn">\times <!-- times --></xsl:when>
310 <xsl:otherwise><!--invisible times--></xsl:otherwise>
311 </xsl:choose>
312 </xsl:if>
313 <xsl:if test="position()&gt;= $first">
314 <xsl:apply-templates select=".">
315 <xsl:with-param name="p" select="3"/>
316 </xsl:apply-templates>
317 </xsl:if>
318 </xsl:for-each>
319 <xsl:if test="$p &gt; 3"><xsl:text>)</xsl:text></xsl:if>
320 </xsl:template>
321
322 <!-- 4.4.3.10 root -->
323 <xsl:template match="m:apply[*[1][self::m:root]]">
324 <xsl:text>\sqrt</xsl:text>
325 <xsl:if test="m:degree!=2">
326 <xsl:text>[</xsl:text>
327 <xsl:apply-templates select="m:degree/*"/>
328 <xsl:text>]</xsl:text>
329 </xsl:if>
330 <xsl:text>{</xsl:text>
331 <xsl:apply-templates select="*[position()&gt;1 and not(self::m:degree)]"/>
332 <xsl:text>}</xsl:text>
333 </xsl:template>
334
335 <!-- 4.4.3.11 gcd -->
336 <xsl:template match="m:gcd"><xsl:text>\gcd </xsl:text></xsl:template>
337
338 <!-- 4.4.3.12 and -->
339 <xsl:template match="m:apply[*[1][self::m:and]]">
340 <xsl:param name="p" select="0"/>
341 <xsl:call-template name="infix">
342 <xsl:with-param name="this-p" select="2"/>
343 <xsl:with-param name="p" select="$p"/>
344 <xsl:with-param name="mo">\land <!-- and --></xsl:with-param>
345 </xsl:call-template>
346 </xsl:template>
347
348 <!-- 4.4.3.13 or -->
349 <xsl:template match="m:apply[*[1][self::m:or]]">
350 <xsl:param name="p" select="0"/>
351 <xsl:call-template name="infix">
352 <xsl:with-param name="this-p" select="3"/>
353 <xsl:with-param name="p" select="$p"/>
354 <xsl:with-param name="mo">\lor </xsl:with-param>
355 </xsl:call-template>
356 </xsl:template>
357
358 <!-- 4.4.3.14 xor -->
359 <xsl:template match="m:apply[*[1][self::m:xor]]">
360 <xsl:param name="p" select="0"/>
361 <xsl:call-template name="infix">
362 <xsl:with-param name="this-p" select="3"/>
363 <xsl:with-param name="p" select="$p"/>
364 <xsl:with-param name="mo">\mathop{\mathrm{xor}}</xsl:with-param>
365 </xsl:call-template>
366 </xsl:template>
367
368 <!-- 4.4.3.15 not -->
369 <xsl:template match="m:apply[*[1][self::m:not]]">
370 <xsl:text>\neg </xsl:text>
371 <xsl:apply-templates select="*[2]">
372 <xsl:with-param name="p" select="7"/>
373 </xsl:apply-templates>
374 </xsl:template>
375
376 <!-- 4.4.3.16 implies -->
377 <xsl:template match="m:apply[*[1][self::m:implies]]">
378 <xsl:param name="p" select="0"/>
379 <xsl:call-template name="binary">
380 <xsl:with-param name="mo">\implies </xsl:with-param>
381 <xsl:with-param name="p" select="$p"/>
382 <xsl:with-param name="this-p" select="3"/>
383 </xsl:call-template>
384 </xsl:template>
385
386 <!-- 4.4.3.17 forall 4.4.3.18 exists -->
387 <xsl:template match="m:apply[*[1][self::m:forall or self::m:exists]]">
388 <xsl:text>\</xsl:text>
389 <xsl:value-of select="local-name(*[1])"/>
390 <xsl:text> </xsl:text>
391 <xsl:apply-templates select="m:bvar"/>
392 <xsl:if test="m:condition">
393 <xsl:text>, </xsl:text><xsl:apply-templates select="m:condition"/>
394 </xsl:if>
395 <xsl:if test="*[last()][local-name()!='condition'][local-name()!='bvar']">
396 <xsl:text>\colon </xsl:text>
397 <xsl:apply-templates select="*[last()]"/>
398 </xsl:if>
399 </xsl:template>
400
401 <!-- 4.4.3.19 abs -->
402 <xsl:template match="m:apply[*[1][self::m:abs]]">
403 <xsl:text>\left|</xsl:text>
404 <xsl:apply-templates select="*[2]"/>
405 <xsl:text>\right|</xsl:text>
406 </xsl:template>
407
408 <!-- 4.4.3.20 conjugate -->
409 <xsl:template match="m:apply[*[1][self::m:conjugate]]">
410 <xsl:text>\overline{</xsl:text><xsl:apply-templates select="*[2]"/><xsl:text>}</xsl:text>
411 </xsl:template>
412
413 <!-- 4.4.3.22 real -->
414 <xsl:template match="m:real"><xsl:text>\Re </xsl:text></xsl:template>
415
416 <!-- 4.4.3.23 imaginary -->
417 <xsl:template match="m:imaginary"><xsl:text>\Im </xsl:text></xsl:template>
418
419 <!-- 4.4.3.25 floor -->
420 <xsl:template match="m:apply[*[1][self::m:floor]]">
421 <xsl:text>\lfloor </xsl:text>
422 <xsl:apply-templates select="*[2]"/>
423 <xsl:text>\rfloor </xsl:text>
424 </xsl:template>
425
426 <!-- 4.4.3.25 ceiling -->
427 <xsl:template match="m:apply[*[1][self::m:ceiling]]">
428 <xsl:text>\lceil </xsl:text>
429 <xsl:apply-templates select="*[2]"/>
430 <xsl:text>\rceil </xsl:text>
431 </xsl:template>
432
433 <!-- 4.4.4.1 eq -->
434 <xsl:template match="m:apply[*[1][self::m:eq]]">
435 <xsl:param name="p" select="0"/>
436 <xsl:call-template name="infix">
437 <xsl:with-param name="this-p" select="1"/>
438 <xsl:with-param name="p" select="$p"/>
439 <xsl:with-param name="mo">=</xsl:with-param>
440 </xsl:call-template>
441 </xsl:template>
442
443 <!-- 4.4.4.2 neq -->
444 <xsl:template match="m:apply[*[1][self::m:neq]]">
445 <xsl:param name="p" select="0"/>
446 <xsl:call-template name="infix">
447 <xsl:with-param name="this-p" select="1"/>
448 <xsl:with-param name="p" select="$p"/>
449 <xsl:with-param name="mo">\neq </xsl:with-param>
450 </xsl:call-template>
451 </xsl:template>
452
453 <!-- 4.4.4.3 gt -->
454 <xsl:template match="m:apply[*[1][self::m:gt]]">
455 <xsl:param name="p" select="0"/>
456 <xsl:call-template name="infix">
457 <xsl:with-param name="this-p" select="1"/>
458 <xsl:with-param name="p" select="$p"/>
459 <xsl:with-param name="mo">&gt; </xsl:with-param>
460 </xsl:call-template>
461 </xsl:template>
462
463 <!-- 4.4.4.4 lt -->
464 <xsl:template match="m:apply[*[1][self::m:lt]]">
465 <xsl:param name="p" select="0"/>
466 <xsl:call-template name="infix">
467 <xsl:with-param name="this-p" select="1"/>
468 <xsl:with-param name="p" select="$p"/>
469 <xsl:with-param name="mo">&lt; </xsl:with-param>
470 </xsl:call-template>
471 </xsl:template>
472
473 <!-- 4.4.4.5 geq -->
474 <xsl:template match="m:apply[*[1][self::m:geq]]">
475 <xsl:param name="p" select="0"/>
476 <xsl:call-template name="infix">
477 <xsl:with-param name="this-p" select="1"/>
478 <xsl:with-param name="p" select="$p"/>
479 <xsl:with-param name="mo">\ge </xsl:with-param>
480 </xsl:call-template>
481 </xsl:template>
482
483 <!-- 4.4.4.6 leq -->
484 <xsl:template match="m:apply[*[1][self::m:leq]]">
485 <xsl:param name="p" select="0"/>
486 <xsl:call-template name="infix">
487 <xsl:with-param name="this-p" select="1"/>
488 <xsl:with-param name="p" select="$p"/>
489 <xsl:with-param name="mo">\le </xsl:with-param>
490 </xsl:call-template>
491 </xsl:template>
492
493 <!-- 4.4.4.7 equivalent -->
494 <xsl:template match="m:apply[*[1][self::m:equivalent]]">
495 <xsl:param name="p" select="0"/>
496 <xsl:call-template name="infix">
497 <xsl:with-param name="this-p" select="1"/>
498 <xsl:with-param name="p" select="$p"/>
499 <xsl:with-param name="mo">\equiv </xsl:with-param>
500 </xsl:call-template>
501 </xsl:template>
502
503 <!-- 4.4.4.8 approx -->
504 <xsl:template match="m:apply[*[1][self::m:approx]]">
505 <xsl:param name="p" select="0"/>
506 <xsl:call-template name="infix">
507 <xsl:with-param name="this-p" select="1"/>
508 <xsl:with-param name="p" select="$p"/>
509 <xsl:with-param name="mo">\approx </xsl:with-param>
510 </xsl:call-template>
511 </xsl:template>
512
513 <!-- 4.4.4.9 factorof -->
514 <xsl:template match="m:apply[*[1][self::m:factorof]]">
515 <xsl:param name="p" select="0"/>
516 <xsl:call-template name="binary">
517 <xsl:with-param name="mo"> | </xsl:with-param>
518 <xsl:with-param name="p" select="$p"/>
519 <xsl:with-param name="this-p" select="3"/>
520 </xsl:call-template>
521 </xsl:template>
522
523 <!-- 4.4.5.1 int -->
524 <xsl:template match="m:apply[*[1][self::m:int]]">
525 <xsl:text>\int</xsl:text>
526 <xsl:if test="m:lowlimit/*|m:interval/*[1]|m:condition/*">
527 <xsl:text>_{</xsl:text>
528 <xsl:apply-templates select="m:lowlimit/*|m:interval/*[1]|m:condition/*"/>
529 <xsl:text>}</xsl:text>
530 </xsl:if>
531 <xsl:if test="m:uplimit/*|m:interval/*[2]">
532 <xsl:text>^{</xsl:text>
533 <xsl:apply-templates select="m:uplimit/*|m:interval/*[2]"/>
534 <xsl:text>}</xsl:text>
535 </xsl:if>
536 <xsl:text> </xsl:text>
537 <xsl:apply-templates select="*[last()]"/>
538 <xsl:text>\,d </xsl:text>
539 <xsl:apply-templates select="m:bvar"/>
540 </xsl:template>
541
542 <!-- 4.4.5.2 diff -->
543 <xsl:template match="m:apply[*[1][self::m:diff] and m:ci and count(*)=2]" priority="2">
544 <xsl:apply-templates select="*[2]"/>
545 <xsl:text>^\prime </xsl:text>
546 </xsl:template>
547
548 <xsl:template match="m:apply[*[1][self::m:diff]]" priority="1">
549 <xsl:text>\frac{</xsl:text>
550 <xsl:choose>
551 <xsl:when test="m:bvar/m:degree">
552 <xsl:text>d^{</xsl:text>
553 <xsl:apply-templates select="m:bvar/m:degree/node()"/>
554 <xsl:text>}</xsl:text>
555 <xsl:apply-templates select="*[last()]"/>
556 <xsl:text>}{d</xsl:text>
557 <xsl:apply-templates select="m:bvar/node()"/>
558 <xsl:text>^{</xsl:text>
559 <xsl:apply-templates select="m:bvar/m:degree/node()"/>
560 <xsl:text>}</xsl:text>
561 </xsl:when>
562 <xsl:otherwise>
563 <xsl:text>d </xsl:text>
564 <xsl:apply-templates select="*[last()]"/>
565 <xsl:text>}{d </xsl:text>
566 <xsl:apply-templates select="m:bvar"/>
567 <xsl:text>}</xsl:text>
568 </xsl:otherwise>
569 </xsl:choose>
570 <xsl:text>}</xsl:text>
571 </xsl:template>
572
573 <!-- 4.4.5.3 partialdiff -->
574 <xsl:template match="m:apply[*[1][self::m:partialdiff] and m:list and m:ci and count(*)=3]" priority="2">
575 <xsl:text>D_{</xsl:text>
576 <xsl:for-each select="m:list[1]/*">
577 <xsl:apply-templates select="."/>
578 <xsl:if test="position()&lt;last()"><xsl:text>, </xsl:text></xsl:if>
579 </xsl:for-each>
580 <xsl:text>}</xsl:text>
581 <xsl:apply-templates select="*[3]"/>
582 </xsl:template>
583
584 <xsl:template match="m:apply[*[1][self::m:partialdiff]]" priority="1">
585 <xsl:text>\frac{\partial^{</xsl:text>
586 <xsl:choose>
587 <xsl:when test="m:degree">
588 <xsl:apply-templates select="m:degree/node()"/>
589 </xsl:when>
590 <xsl:when test="m:bvar/m:degree[string(number(.))='NaN']">
591 <xsl:for-each select="m:bvar/m:degree">
592 <xsl:apply-templates select="node()"/>
593 <xsl:if test="position()&lt;last()"><xsl:text>+</xsl:text></xsl:if>
594 </xsl:for-each>
595 <xsl:if test="count(m:bvar[not(m:degree)])&gt;0">
596 <xsl:text>+</xsl:text>
597 <xsl:value-of select="count(m:bvar[not(m:degree)])"/>
598 </xsl:if>
599 </xsl:when>
600 <xsl:otherwise>
601 <xsl:value-of select="sum(m:bvar/m:degree)+count(m:bvar[not(m:degree)])"/>
602 </xsl:otherwise>
603 </xsl:choose>
604 <xsl:text>}</xsl:text>
605 <xsl:apply-templates select="*[last()]"/>
606 <xsl:text>}{</xsl:text>
607 <xsl:for-each select="m:bvar">
608 <xsl:text>\partial </xsl:text>
609 <xsl:apply-templates select="node()"/>
610 <xsl:if test="m:degree">
611 <xsl:text>^{</xsl:text>
612 <xsl:apply-templates select="m:degree/node()"/>
613 <xsl:text>}</xsl:text>
614 </xsl:if>
615 </xsl:for-each>
616 <xsl:text>}</xsl:text>
617 </xsl:template>
618
619 <!-- 4.4.2.8 declare 4.4.5.4 lowlimit 4.4.5.5 uplimit 4.4.5.7 degree 4.4.9.5 momentabout -->
620 <xsl:template match="m:declare | m:lowlimit | m:uplimit | m:degree | m:momentabout"/>
621
622 <!-- 4.4.5.6 bvar-->
623 <xsl:template match="m:bvar">
624 <xsl:apply-templates/>
625 <xsl:if test="following-sibling::m:bvar"><xsl:text>, </xsl:text></xsl:if>
626 </xsl:template>
627
628 <!-- 4.4.5.8 divergence-->
629 <xsl:template match="m:divergence"><xsl:text>\mathop{\mathrm{div}}</xsl:text></xsl:template>
630
631 <!-- 4.4.5.11 laplacian-->
632 <xsl:template match="m:laplacian"><xsl:text>\nabla^2 </xsl:text></xsl:template>
633
634 <!-- 4.4.6.1 set -->
635 <xsl:template match="m:set">
636 <xsl:text>\{</xsl:text><xsl:call-template name="set"/><xsl:text>\}</xsl:text>
637 </xsl:template>
638
639 <!-- 4.4.6.2 list -->
640 <xsl:template match="m:list">
641 <xsl:text>\left[</xsl:text><xsl:call-template name="set"/><xsl:text>\right]</xsl:text>
642 </xsl:template>
643
644 <xsl:template name="set">
645 <xsl:choose>
646 <xsl:when test="m:condition">
647 <xsl:apply-templates select="m:bvar/*[not(self::bvar or self::condition)]"/>
648 <xsl:text>\colon </xsl:text>
649 <xsl:apply-templates select="m:condition/node()"/>
650 </xsl:when>
651 <xsl:otherwise>
652 <xsl:for-each select="*">
653 <xsl:apply-templates select="."/>
654 <xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if>
655 </xsl:for-each>
656 </xsl:otherwise>
657 </xsl:choose>
658 </xsl:template>
659
660 <!-- 4.4.6.3 union -->
661 <xsl:template match="m:apply[*[1][self::m:union]]">
662 <xsl:param name="p" select="0"/>
663 <xsl:call-template name="infix">
664 <xsl:with-param name="this-p" select="2"/>
665 <xsl:with-param name="p" select="$p"/>
666 <xsl:with-param name="mo">\cup </xsl:with-param>
667 </xsl:call-template>
668 </xsl:template>
669
670 <!-- 4.4.6.4 intersect -->
671 <xsl:template match="m:apply[*[1][self::m:intersect]]">
672 <xsl:param name="p" select="0"/>
673 <xsl:call-template name="infix">
674 <xsl:with-param name="this-p" select="3"/>
675 <xsl:with-param name="p" select="$p"/>
676 <xsl:with-param name="mo">\cap </xsl:with-param>
677 </xsl:call-template>
678 </xsl:template>
679
680 <!-- 4.4.6.5 in -->
681 <xsl:template match="m:apply[*[1][self::m:in]]">
682 <xsl:param name="p" select="0"/>
683 <xsl:call-template name="binary">
684 <xsl:with-param name="mo">\in </xsl:with-param>
685 <xsl:with-param name="p" select="$p"/>
686 <xsl:with-param name="this-p" select="3"/>
687 </xsl:call-template>
688 </xsl:template>
689
690 <!-- 4.4.6.5 notin -->
691 <xsl:template match="m:apply[*[1][self::m:notin]]">
692 <xsl:param name="p" select="0"/>
693 <xsl:call-template name="binary">
694 <xsl:with-param name="mo">\notin </xsl:with-param>
695 <xsl:with-param name="p" select="$p"/>
696 <xsl:with-param name="this-p" select="3"/>
697 </xsl:call-template>
698 </xsl:template>
699
700 <!-- 4.4.6.7 subset -->
701 <xsl:template match="m:apply[*[1][self::m:subset]]">
702 <xsl:param name="p" select="0"/>
703 <xsl:call-template name="infix">
704 <xsl:with-param name="this-p" select="2"/>
705 <xsl:with-param name="p" select="$p"/>
706 <xsl:with-param name="mo">\subseteq </xsl:with-param>
707 </xsl:call-template>
708 </xsl:template>
709
710 <!-- 4.4.6.8 prsubset -->
711 <xsl:template match="m:apply[*[1][self::m:prsubset]]">
712 <xsl:param name="p" select="0"/>
713 <xsl:call-template name="infix">
714 <xsl:with-param name="this-p" select="2"/>
715 <xsl:with-param name="p" select="$p"/>
716 <xsl:with-param name="mo">\subset </xsl:with-param>
717 </xsl:call-template>
718 </xsl:template>
719
720 <!-- 4.4.6.9 notsubset -->
721 <xsl:template match="m:apply[*[1][self::m:notsubset]]">
722 <xsl:param name="p" select="0"/>
723 <xsl:call-template name="binary">
724 <xsl:with-param name="this-p" select="2"/>
725 <xsl:with-param name="p" select="$p"/>
726 <xsl:with-param name="mo">\nsubseteq </xsl:with-param>
727 </xsl:call-template>
728 </xsl:template>
729
730 <!-- 4.4.6.10 notprsubset -->
731 <xsl:template match="m:apply[*[1][self::m:notprsubset]]">
732 <xsl:param name="p" select="0"/>
733 <xsl:call-template name="binary">
734 <xsl:with-param name="this-p" select="2"/>
735 <xsl:with-param name="p" select="$p"/>
736 <xsl:with-param name="mo">\not\subset </xsl:with-param>
737 </xsl:call-template>
738 </xsl:template>
739
740 <!-- 4.4.6.11 setdiff -->
741 <xsl:template match="m:apply[*[1][self::m:setdiff]]">
742 <xsl:param name="p" select="0"/>
743 <xsl:call-template name="binary">
744 <xsl:with-param name="this-p" select="2"/>
745 <xsl:with-param name="p" select="$p"/>
746 <xsl:with-param name="mo">\setminus </xsl:with-param>
747 </xsl:call-template>
748 </xsl:template>
749
750 <!-- 4.4.6.12 card -->
751 <xsl:template match="m:apply[*[1][self::m:card]]">
752 <xsl:text>|</xsl:text>
753 <xsl:apply-templates select="*[2]"/>
754 <xsl:text>|</xsl:text>
755 </xsl:template>
756
757 <!-- 4.4.6.13 cartesianproduct 4.4.10.6 vectorproduct -->
758 <xsl:template match="m:apply[*[1][self::m:cartesianproduct or self::m:vectorproduct]]">
759 <xsl:param name="p" select="0"/>
760 <xsl:call-template name="infix">
761 <xsl:with-param name="this-p" select="2"/>
762 <xsl:with-param name="p" select="$p"/>
763 <xsl:with-param name="mo">\times </xsl:with-param>
764 </xsl:call-template>
765 </xsl:template>
766
767 <xsl:template
768 match="m:apply[*[1][self::m:cartesianproduct][count(following-sibling::m:reals)=count(following-sibling::*)]]"
769 priority="2">
770 <xsl:apply-templates select="*[2]">
771 <xsl:with-param name="p" select="5"/>
772 </xsl:apply-templates>
773 <xsl:text>^{</xsl:text>
774 <xsl:value-of select="count(*)-1"/>
775 <xsl:text>}</xsl:text>
776 </xsl:template>
777
778 <!-- 4.4.7.1 sum -->
779 <xsl:template match="m:apply[*[1][self::m:sum]]">
780 <xsl:text>\sum</xsl:text><xsl:call-template name="series"/>
781 </xsl:template>
782
783 <!-- 4.4.7.2 product -->
784 <xsl:template match="m:apply[*[1][self::m:product]]">
785 <xsl:text>\prod</xsl:text><xsl:call-template name="series"/>
786 </xsl:template>
787
788 <xsl:template name="series">
789 <xsl:if test="m:lowlimit/*|m:interval/*[1]|m:condition/*">
790 <xsl:text>_{</xsl:text>
791 <xsl:if test="not(m:condition)">
792 <xsl:apply-templates select="m:bvar"/>
793 <xsl:text>=</xsl:text>
794 </xsl:if>
795 <xsl:apply-templates select="m:lowlimit/*|m:interval/*[1]|m:condition/*"/>
796 <xsl:text>}</xsl:text>
797 </xsl:if>
798 <xsl:if test="m:uplimit/*|m:interval/*[2]">
799 <xsl:text>^{</xsl:text>
800 <xsl:apply-templates select="m:uplimit/*|m:interval/*[2]"/>
801 <xsl:text>}</xsl:text>
802 </xsl:if>
803 <xsl:text> </xsl:text>
804 <xsl:apply-templates select="*[last()]"/>
805 </xsl:template>
806
807 <!-- 4.4.7.3 limit -->
808 <xsl:template match="m:apply[*[1][self::m:limit]]">
809 <xsl:text>\lim_{</xsl:text>
810 <xsl:apply-templates select="m:lowlimit|m:condition/*"/>
811 <xsl:text>}</xsl:text>
812 <xsl:apply-templates select="*[last()]"/>
813 </xsl:template>
814
815 <xsl:template match="m:apply[m:limit]/m:lowlimit" priority="3">
816 <xsl:apply-templates select="../m:bvar/node()"/>
817 <xsl:text>\to </xsl:text>
818 <xsl:apply-templates/>
819 </xsl:template>
820
821 <!-- 4.4.7.4 tendsto -->
822 <xsl:template match="m:apply[*[1][self::m:tendsto]]">
823 <xsl:param name="p"/>
824 <xsl:call-template name="binary">
825 <xsl:with-param name="this-p" select="2"/>
826 <xsl:with-param name="p" select="$p"/>
827 <xsl:with-param name="mo">
828 <xsl:choose>
829 <xsl:when test="@type='above'">\searrow </xsl:when>
830 <xsl:when test="@type='below'">\nearrow </xsl:when>
831 <xsl:when test="@type='two-sided'">\rightarrow </xsl:when>
832 <xsl:otherwise>\to </xsl:otherwise>
833 </xsl:choose>
834 </xsl:with-param>
835 </xsl:call-template>
836 </xsl:template>
837
838 <!-- 4.4.8.1 common tringonometric functions 4.4.8.3 natural logarithm -->
839 <xsl:template match="m:apply[*[1][
840 self::m:sin or self::m:cos or self::m:tan or self::m:sec or
841 self::m:csc or self::m:cot or self::m:sinh or self::m:cosh or
842 self::m:tanh or self::m:coth or self::m:arcsin or self::m:arccos or
843 self::m:arctan or self::m:ln]]">
844 <xsl:text>\</xsl:text>
845 <xsl:value-of select="local-name(*[1])"/>
846 <xsl:text> </xsl:text>
847 <xsl:apply-templates select="*[2]">
848 <xsl:with-param name="p" select="7"/>
849 </xsl:apply-templates>
850 </xsl:template>
851
852 <xsl:template match="m:sin | m:cos | m:tan | m:sec | m:csc |
853 m:cot | m:sinh | m:cosh | m:tanh | m:coth |
854 m:arcsin | m:arccos | m:arctan | m:ln">
855 <xsl:text>\</xsl:text>
856 <xsl:value-of select="local-name(.)"/>
857 <xsl:text> </xsl:text>
858 </xsl:template>
859
860 <xsl:template match="m:apply[*[1][
861 self::m:sech or self::m:csch or self::m:arccosh or
862 self::m:arccot or self::m:arccoth or self::m:arccsc or
863 self::m:arccsch or self::m:arcsec or self::m:arcsech or
864 self::m:arcsinh or self::m:arctanh]]">
865 <xsl:text>\mathrm{</xsl:text>
866 <xsl:value-of select="local-name(*[1])"/>
867 <xsl:text>\,}</xsl:text>
868 <xsl:apply-templates select="*[2]">
869 <xsl:with-param name="p" select="7"/>
870 </xsl:apply-templates>
871 </xsl:template>
872
873 <xsl:template match="m:sech | m:csch | m:arccosh | m:arccot |
874 m:arccoth | m:arccsc |m:arccsch |m:arcsec |
875 m:arcsech | m:arcsinh | m:arctanh">
876 <xsl:text>\mathrm{</xsl:text>
877 <xsl:value-of select="local-name(.)"/>
878 <xsl:text>}</xsl:text>
879 </xsl:template>
880
881 <!-- 4.4.8.2 exp -->
882 <xsl:template match="m:apply[*[1][self::m:exp]]">
883 <xsl:text>e^{</xsl:text><xsl:apply-templates select="*[2]"/><xsl:text>}</xsl:text>
884 </xsl:template>
885
886 <!-- 4.4.8.4 log -->
887 <xsl:template match="m:apply[*[1][self::m:log]]">
888 <xsl:text>\lg </xsl:text>
889 <xsl:apply-templates select="*[last()]">
890 <xsl:with-param name="p" select="7"/>
891 </xsl:apply-templates>
892 </xsl:template>
893
894 <xsl:template match="m:apply[*[1][self::m:log] and m:logbase != 10]">
895 <xsl:text>\log_{</xsl:text>
896 <xsl:apply-templates select="m:logbase/node()"/>
897 <xsl:text>}</xsl:text>
898 <xsl:apply-templates select="*[last()]">
899 <xsl:with-param name="p" select="7"/>
900 </xsl:apply-templates>
901 </xsl:template>
902
903 <!-- 4.4.9.1 mean -->
904 <xsl:template match="m:apply[*[1][self::m:mean]]">
905 <xsl:text>\langle </xsl:text>
906 <xsl:for-each select="*[position()&gt;1]">
907 <xsl:apply-templates select="."/>
908 <xsl:if test="position() !=last()"><xsl:text>, </xsl:text></xsl:if>
909 </xsl:for-each>
910 <xsl:text>\rangle </xsl:text>
911 </xsl:template>
912
913 <!-- 4.4.9.2 sdef -->
914 <xsl:template match="m:sdev"><xsl:text>\sigma </xsl:text></xsl:template>
915
916 <!-- 4.4.9.3 variance -->
917 <xsl:template match="m:apply[*[1][self::m:variance]]">
918 <xsl:text>\sigma(</xsl:text>
919 <xsl:apply-templates select="*[2]"/>
920 <xsl:text>)^2</xsl:text>
921 </xsl:template>
922
923 <!-- 4.4.9.5 moment -->
924 <xsl:template match="m:apply[*[1][self::m:moment]]">
925 <xsl:text>\langle </xsl:text>
926 <xsl:apply-templates select="*[last()]"/>
927 <xsl:text>^{</xsl:text>
928 <xsl:apply-templates select="m:degree/node()"/>
929 <xsl:text>}\rangle</xsl:text>
930 <xsl:if test="m:momentabout">
931 <xsl:text>_{</xsl:text>
932 <xsl:apply-templates select="m:momentabout/node()"/>
933 <xsl:text>}</xsl:text>
934 </xsl:if>
935 <xsl:text> </xsl:text>
936 </xsl:template>
937
938 <!-- 4.4.10.1 vector -->
939 <xsl:template match="m:vector">
940 <xsl:text>\left(\begin{array}{c}</xsl:text>
941 <xsl:for-each select="*">
942 <xsl:apply-templates select="."/>
943 <xsl:if test="position()!=last()"><xsl:text>\\ </xsl:text></xsl:if>
944 </xsl:for-each>
945 <xsl:text>\end{array}\right)</xsl:text>
946 </xsl:template>
947
948 <!-- 4.4.10.2 matrix -->
949 <xsl:template match="m:matrix">
950 <xsl:text>\begin{pmatrix}</xsl:text>
951 <xsl:apply-templates/>
952 <xsl:text>\end{pmatrix}</xsl:text>
953 </xsl:template>
954
955 <!-- 4.4.10.3 matrixrow -->
956 <xsl:template match="m:matrixrow">
957 <xsl:for-each select="*">
958 <xsl:apply-templates select="."/>
959 <xsl:if test="position()!=last()"><xsl:text> &amp; </xsl:text></xsl:if>
960 </xsl:for-each>
961 <xsl:if test="position()!=last()"><xsl:text>\\ </xsl:text></xsl:if>
962 </xsl:template>
963
964 <!-- 4.4.10.4 determinant -->
965 <xsl:template match="m:apply[*[1][self::m:determinant]]">
966 <xsl:text>\det </xsl:text>
967 <xsl:apply-templates select="*[2]">
968 <xsl:with-param name="p" select="7"/>
969 </xsl:apply-templates>
970 </xsl:template>
971
972 <xsl:template match="m:apply[*[1][self::m:determinant]][*[2][self::m:matrix]]" priority="2">
973 <xsl:text>\begin{vmatrix}</xsl:text>
974 <xsl:apply-templates select="m:matrix/*"/>
975 <xsl:text>\end{vmatrix}</xsl:text>
976 </xsl:template>
977
978 <!-- 4.4.10.5 transpose -->
979 <xsl:template match="m:apply[*[1][self::m:transpose]]">
980 <xsl:apply-templates select="*[2]">
981 <xsl:with-param name="p" select="7"/>
982 </xsl:apply-templates>
983 <xsl:text>^T</xsl:text>
984 </xsl:template>
985
986 <!-- 4.4.10.5 selector -->
987 <xsl:template match="m:apply[*[1][self::m:selector]]">
988 <xsl:apply-templates select="*[2]">
989 <xsl:with-param name="p" select="7"/>
990 </xsl:apply-templates>
991 <xsl:text>_{</xsl:text>
992 <xsl:for-each select="*[position()&gt;2]">
993 <xsl:apply-templates select="."/>
994 <xsl:if test="position() !=last()"><xsl:text>, </xsl:text></xsl:if>
995 </xsl:for-each>
996 <xsl:text>}</xsl:text>
997 </xsl:template>
998
999 <!-- 4.4.10.7 scalarproduct 4.4.10.8 outerproduct -->
1000 <xsl:template match="m:apply[*[1][self::m:scalarproduct or self::m:outerproduct]]">
1001 <xsl:param name="p" select="0"/>
1002 <xsl:call-template name="infix">
1003 <xsl:with-param name="this-p" select="2"/>
1004 <xsl:with-param name="p" select="$p"/>
1005 <xsl:with-param name="mo">\dot </xsl:with-param>
1006 </xsl:call-template>
1007 </xsl:template>
1008
1009 <!-- 4.4.11.2 semantics -->
1010 <xsl:template match="m:semantics"><xsl:apply-templates select="*[1]"/></xsl:template>
1011
1012 <xsl:template match="m:semantics[m:annotation/@encoding='TeX']">
1013 <xsl:apply-templates select="m:annotation[@encoding='TeX']/node()"/>
1014 </xsl:template>
1015
1016 <!-- 4.4.12.1 integers -->
1017 <xsl:template match="m:integers"><xsl:text>\mathbb{Z}</xsl:text></xsl:template>
1018
1019 <!-- 4.4.12.2 reals -->
1020 <xsl:template match="m:reals"><xsl:text>\mathbb{R}</xsl:text></xsl:template>
1021
1022 <!-- 4.4.12.3 rationals -->
1023 <xsl:template match="m:rationals"><xsl:text>\mathbb{Q}</xsl:text></xsl:template>
1024
1025 <!-- 4.4.12.4 naturalnumbers -->
1026 <xsl:template match="m:naturalnumbers"><xsl:text>\mathbb{N}</xsl:text></xsl:template>
1027
1028 <!-- 4.4.12.5 complexes -->
1029 <xsl:template match="m:complexes"><xsl:text>\mathbb{C}</xsl:text></xsl:template>
1030
1031 <!-- 4.4.12.6 primes -->
1032 <xsl:template match="m:primes"><xsl:text>\mathbb{P}</xsl:text></xsl:template>
1033
1034 <!-- 4.4.12.7 exponentiale -->
1035 <xsl:template match="m:exponentiale"><xsl:text>e</xsl:text></xsl:template>
1036
1037 <!-- 4.4.12.8 imaginaryi -->
1038 <xsl:template match="m:imaginaryi"><xsl:text>i</xsl:text></xsl:template>
1039
1040 <!-- 4.4.12.9 notanumber -->
1041 <xsl:template match="m:notanumber"><xsl:text>NaN</xsl:text></xsl:template>
1042
1043 <!-- 4.4.12.10 true -->
1044 <xsl:template match="m:true"><xsl:text>\mbox{true}</xsl:text></xsl:template>
1045
1046 <!-- 4.4.12.11 false -->
1047 <xsl:template match="m:false"><xsl:text>\mbox{false}</xsl:text></xsl:template>
1048
1049 <!-- 4.4.12.12 emptyset -->
1050 <xsl:template match="m:emptyset"><xsl:text>\emptyset </xsl:text></xsl:template>
1051
1052 <!-- 4.4.12.13 pi -->
1053 <xsl:template match="m:pi"><xsl:text>\pi </xsl:text></xsl:template>
1054
1055 <!-- 4.4.12.14 eulergamma -->
1056 <xsl:template match="m:eulergamma"><xsl:text>\gamma </xsl:text></xsl:template>
1057
1058 <!-- 4.4.12.15 infinity -->
1059 <xsl:template match="m:infinity"><xsl:text>\infty </xsl:text></xsl:template>
1060
1061 <!-- ****************************** -->
1062 <xsl:template name="infix" >
1063 <xsl:param name="mo"/>
1064 <xsl:param name="p" select="0"/>
1065 <xsl:param name="this-p" select="0"/>
1066 <xsl:if test="$this-p &lt; $p"><xsl:text>(</xsl:text></xsl:if>
1067 <xsl:for-each select="*[position()&gt;1]">
1068 <xsl:if test="position() &gt; 1">
1069 <xsl:copy-of select="$mo"/>
1070 </xsl:if>
1071 <xsl:apply-templates select=".">
1072 <xsl:with-param name="p" select="$this-p"/>
1073 </xsl:apply-templates>
1074 </xsl:for-each>
1075 <xsl:if test="$this-p &lt; $p"><xsl:text>)</xsl:text></xsl:if>
1076 </xsl:template>
1077
1078 <xsl:template name="binary" >
1079 <xsl:param name="mo"/>
1080 <xsl:param name="p" select="0"/>
1081 <xsl:param name="this-p" select="0"/>
1082 <xsl:if test="$this-p &lt; $p"><xsl:text>(</xsl:text></xsl:if>
1083 <xsl:apply-templates select="*[2]">
1084 <xsl:with-param name="p" select="$this-p"/>
1085 </xsl:apply-templates>
1086 <xsl:value-of select="$mo"/>
1087 <xsl:apply-templates select="*[3]">
1088 <xsl:with-param name="p" select="$this-p"/>
1089 </xsl:apply-templates>
1090 <xsl:if test="$this-p &lt; $p"><xsl:text>)</xsl:text></xsl:if>
1091 </xsl:template>
1092
1093 </xsl:stylesheet>