Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <!-- saved from url=(0013)about:internet -->\r |
2 | <xsl:stylesheet\r | |
3 | version="1.0"\r | |
4 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r | |
5 | xmlns:mml="http://www.w3.org/1998/Math/MathML"\r | |
6 | >\r | |
7 | \r | |
8 | <!--\r | |
9 | $Id: ctop.xsl,v 1.3 2002/09/20 08:41:39 davidc Exp $\r | |
10 | \r | |
11 | Copyright David Carlisle 2001, 2002.\r | |
12 | \r | |
13 | Use and distribution of this code are permitted under the terms of the <a\r | |
14 | href="http://www.w3.org/Consortium/Legal/copyright-software-19980720"\r | |
15 | >W3C Software Notice and License</a>.\r | |
16 | -->\r | |
17 | \r | |
18 | <xsl:output method="xml" />\r | |
19 | \r | |
20 | <xsl:template mode="c2p" match="*">\r | |
21 | <xsl:copy>\r | |
22 | <xsl:copy-of select="@*"/>\r | |
23 | <xsl:apply-templates mode="c2p"/>\r | |
24 | </xsl:copy>\r | |
25 | </xsl:template>\r | |
26 | \r | |
27 | \r | |
28 | <!-- 4.4.1.1 cn -->\r | |
29 | \r | |
30 | <xsl:template mode="c2p" match="mml:cn">\r | |
31 | <mml:mn><xsl:apply-templates mode="c2p"/></mml:mn>\r | |
32 | </xsl:template>\r | |
33 | \r | |
34 | <xsl:template mode="c2p" match="mml:cn[@type='complex-cartesian']">\r | |
35 | <mml:mrow>\r | |
36 | <mml:mn><xsl:apply-templates mode="c2p" select="text()[1]"/></mml:mn>\r | |
37 | <mml:mo>+</mml:mo>\r | |
38 | <mml:mn><xsl:apply-templates mode="c2p" select="text()[2]"/></mml:mn>\r | |
39 | <mml:mo><!--⁢--><!--invisible times--></mml:mo>\r | |
40 | <mml:mi>i<!-- imaginary i --></mml:mi>\r | |
41 | </mml:mrow>\r | |
42 | </xsl:template>\r | |
43 | \r | |
44 | <xsl:template mode="c2p" match="mml:cn[@type='rational']">\r | |
45 | <mml:mrow>\r | |
46 | <mml:mn><xsl:apply-templates mode="c2p" select="text()[1]"/></mml:mn>\r | |
47 | <mml:mo>/</mml:mo>\r | |
48 | <mml:mn><xsl:apply-templates mode="c2p" select="text()[2]"/></mml:mn>\r | |
49 | </mml:mrow>\r | |
50 | </xsl:template>\r | |
51 | \r | |
52 | <xsl:template mode="c2p" match="mml:cn[@type='integer']">\r | |
53 | <xsl:choose>\r | |
54 | <xsl:when test="not(@base) or @base=10">\r | |
55 | <mml:mn><xsl:apply-templates mode="c2p"/></mml:mn>\r | |
56 | </xsl:when>\r | |
57 | <xsl:otherwise>\r | |
58 | <mml:msub>\r | |
59 | <mml:mn><xsl:apply-templates mode="c2p"/></mml:mn>\r | |
60 | <mml:mn><xsl:value-of select="@base"/></mml:mn>\r | |
61 | </mml:msub>\r | |
62 | </xsl:otherwise>\r | |
63 | </xsl:choose>\r | |
64 | </xsl:template>\r | |
65 | \r | |
66 | <xsl:template mode="c2p" match="mml:cn[@type='complex-polar']">\r | |
67 | <mml:mrow>\r | |
68 | <mml:mn><xsl:apply-templates mode="c2p" select="text()[1]"/></mml:mn>\r | |
69 | <mml:mo><!--⁢--><!--invisible times--></mml:mo>\r | |
70 | <mml:msup>\r | |
71 | <mml:mi>e<!-- exponential e--></mml:mi>\r | |
72 | <mml:mrow>\r | |
73 | <mml:mi>i<!-- imaginary i--></mml:mi>\r | |
74 | <mml:mo><!--⁢--><!--invisible times--></mml:mo>\r | |
75 | <mml:mn><xsl:apply-templates mode="c2p" select="text()[2]"/></mml:mn>\r | |
76 | </mml:mrow>\r | |
77 | </mml:msup>\r | |
78 | </mml:mrow>\r | |
79 | </xsl:template>\r | |
80 | \r | |
81 | <xsl:template mode="c2p" match="mml:cn[@type='e-notation']">\r | |
82 | <mml:mn><xsl:apply-templates mode="c2p" select="text()[1]"/>E<xsl:apply-templates mode="c2p" select="text()[2]"/></mml:mn>\r | |
83 | </xsl:template>\r | |
84 | \r | |
85 | <!-- 4.4.1.1 ci -->\r | |
86 | \r | |
87 | <xsl:template mode="c2p" match="mml:ci/text()">\r | |
88 | <mml:mi><xsl:value-of select="."/></mml:mi>\r | |
89 | </xsl:template>\r | |
90 | \r | |
91 | <xsl:template mode="c2p" match="mml:ci">\r | |
92 | <mml:mrow><xsl:apply-templates mode="c2p"/></mml:mrow>\r | |
93 | </xsl:template>\r | |
94 | \r | |
95 | <!-- 4.4.1.2 csymbol -->\r | |
96 | \r | |
97 | <xsl:template mode="c2p" match="mml:csymbol/text()">\r | |
98 | <mml:mo><xsl:apply-templates mode="c2p"/></mml:mo>\r | |
99 | </xsl:template>\r | |
100 | \r | |
101 | <xsl:template mode="c2p" match="mml:csymbol">\r | |
102 | <mml:mrow><xsl:apply-templates mode="c2p"/></mml:mrow>\r | |
103 | </xsl:template>\r | |
104 | \r | |
105 | <!-- 4.4.2.1 apply 4.4.2.2 reln -->\r | |
106 | \r | |
107 | <xsl:template mode="c2p" match="mml:apply|mml:reln">\r | |
108 | <mml:mrow>\r | |
109 | <xsl:apply-templates mode="c2p" select="*[1]">\r | |
110 | <xsl:with-param name="p" select="10"/>\r | |
111 | </xsl:apply-templates>\r | |
112 | <mml:mo><!--⁢--><!--invisible times--></mml:mo>\r | |
113 | <mml:mfenced open="(" close=")" separators=",">\r | |
114 | <xsl:apply-templates mode="c2p" select="*[position()>1]"/>\r | |
115 | </mml:mfenced>\r | |
116 | </mml:mrow>\r | |
117 | </xsl:template>\r | |
118 | \r | |
119 | <!-- 4.4.2.3 fn -->\r | |
120 | <xsl:template mode="c2p" match="mml:fn">\r | |
121 | <mml:mrow><xsl:apply-templates mode="c2p"/></mml:mrow>\r | |
122 | </xsl:template>\r | |
123 | \r | |
124 | <!-- 4.4.2.4 interval -->\r | |
125 | <xsl:template mode="c2p" match="mml:interval[*[2]]">\r | |
126 | <mml:mfenced open="[" close="]"><xsl:apply-templates mode="c2p"/></mml:mfenced>\r | |
127 | </xsl:template>\r | |
128 | <xsl:template mode="c2p" match="mml:interval[*[2]][@closure='open']">\r | |
129 | <mml:mfenced open="(" close=")"><xsl:apply-templates mode="c2p"/></mml:mfenced>\r | |
130 | </xsl:template>\r | |
131 | <xsl:template mode="c2p" match="mml:interval[*[2]][@closure='open-closed']">\r | |
132 | <mml:mfenced open="(" close="]"><xsl:apply-templates mode="c2p"/></mml:mfenced>\r | |
133 | </xsl:template>\r | |
134 | <xsl:template mode="c2p" match="mml:interval[*[2]][@closure='closed-open']">\r | |
135 | <mml:mfenced open="[" close=")"><xsl:apply-templates mode="c2p"/></mml:mfenced>\r | |
136 | </xsl:template>\r | |
137 | \r | |
138 | <xsl:template mode="c2p" match="mml:interval">\r | |
139 | <mml:mfenced open="{{" close="}}"><xsl:apply-templates mode="c2p"/></mml:mfenced>\r | |
140 | </xsl:template>\r | |
141 | \r | |
142 | <!-- 4.4.2.5 inverse -->\r | |
143 | \r | |
144 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:inverse]]">\r | |
145 | <mml:msup>\r | |
146 | <xsl:apply-templates mode="c2p" select="*[2]"/>\r | |
147 | <mml:mrow><mml:mo>(</mml:mo><mml:mn>-1</mml:mn><mml:mo>)</mml:mo></mml:mrow>\r | |
148 | </mml:msup>\r | |
149 | </xsl:template>\r | |
150 | \r | |
151 | <!-- 4.4.2.6 sep -->\r | |
152 | \r | |
153 | <!-- 4.4.2.7 condition -->\r | |
154 | <xsl:template mode="c2p" match="mml:condition">\r | |
155 | <mml:mrow><xsl:apply-templates mode="c2p"/></mml:mrow>\r | |
156 | </xsl:template>\r | |
157 | \r | |
158 | <!-- 4.4.2.8 declare -->\r | |
159 | <xsl:template mode="c2p" match="mml:declare"/>\r | |
160 | \r | |
161 | <!-- 4.4.2.9 lambda -->\r | |
162 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:lambda]]">\r | |
163 | <mml:mrow>\r | |
164 | <mml:mi>λ<!--lambda--></mml:mi>\r | |
165 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:bvar/*"/></mml:mrow>\r | |
166 | <mml:mo>.</mml:mo>\r | |
167 | <mml:mfenced>\r | |
168 | <xsl:apply-templates mode="c2p" select="*[last()]"/>\r | |
169 | </mml:mfenced>\r | |
170 | </mml:mrow>\r | |
171 | </xsl:template>\r | |
172 | \r | |
173 | \r | |
174 | <!-- 4.4.2.10 compose -->\r | |
175 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:compose]]">\r | |
176 | <xsl:param name="p" select="0"/>\r | |
177 | <xsl:call-template name="infix">\r | |
178 | <xsl:with-param name="this-p" select="1"/>\r | |
179 | <xsl:with-param name="p" select="$p"/>\r | |
180 | <xsl:with-param name="mo"><mml:mo>∘<!-- o --></mml:mo></xsl:with-param>\r | |
181 | </xsl:call-template>\r | |
182 | </xsl:template>\r | |
183 | \r | |
184 | \r | |
185 | <!-- 4.4.2.11` ident -->\r | |
186 | <xsl:template mode="c2p" match="mml:ident">\r | |
187 | <mml:mo>id</mml:mo>\r | |
188 | </xsl:template>\r | |
189 | \r | |
190 | <!-- 4.4.2.12` domain -->\r | |
191 | <xsl:template mode="c2p" match="mml:domain">\r | |
192 | <mml:mo>domain</mml:mo>\r | |
193 | </xsl:template>\r | |
194 | \r | |
195 | <!-- 4.4.2.13` codomain -->\r | |
196 | <xsl:template mode="c2p" match="mml:codomain">\r | |
197 | <mml:mo>codomain</mml:mo>\r | |
198 | </xsl:template>\r | |
199 | \r | |
200 | <!-- 4.4.2.14` image -->\r | |
201 | <xsl:template mode="c2p" match="mml:image">\r | |
202 | <mml:mo>image</mml:mo>\r | |
203 | </xsl:template>\r | |
204 | \r | |
205 | <!-- 4.4.2.15` domainofapplication -->\r | |
206 | <xsl:template mode="c2p" match="mml:domainofapplication">\r | |
207 | <mml:error/>\r | |
208 | </xsl:template>\r | |
209 | \r | |
210 | <!-- 4.4.2.16` piecewise -->\r | |
211 | <xsl:template mode="c2p" match="mml:piecewise">\r | |
212 | <mml:mrow>\r | |
213 | <mml:mo>{</mml:mo>\r | |
214 | <mml:mtable>\r | |
215 | <xsl:for-each select="mml:piece|mml:otherwise">\r | |
216 | <mml:mtr>\r | |
217 | <mml:mtd><xsl:apply-templates mode="c2p" select="*[1]"/></mml:mtd>\r | |
218 | <mml:mtd><mml:mtext>  if  </mml:mtext></mml:mtd>\r | |
219 | <mml:mtd><xsl:apply-templates mode="c2p" select="*[2]"/></mml:mtd>\r | |
220 | </mml:mtr>\r | |
221 | </xsl:for-each>\r | |
222 | </mml:mtable>\r | |
223 | </mml:mrow>\r | |
224 | </xsl:template>\r | |
225 | \r | |
226 | \r | |
227 | <!-- 4.4.3.1 quotient -->\r | |
228 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:quotient]]">\r | |
229 | <mml:mrow>\r | |
230 | <mml:mo>⌊<!-- lfloor--></mml:mo>\r | |
231 | <xsl:apply-templates mode="c2p" select="*[2]"/>\r | |
232 | <mml:mo>/</mml:mo>\r | |
233 | <xsl:apply-templates mode="c2p" select="*[3]"/>\r | |
234 | <mml:mo>⌋<!-- rfloor--></mml:mo>\r | |
235 | </mml:mrow>\r | |
236 | </xsl:template>\r | |
237 | \r | |
238 | \r | |
239 | \r | |
240 | <!-- 4.4.3.2 factorial -->\r | |
241 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:factorial]]">\r | |
242 | <mml:mrow>\r | |
243 | <xsl:apply-templates mode="c2p" select="*[2]">\r | |
244 | <xsl:with-param name="p" select="7"/>\r | |
245 | </xsl:apply-templates>\r | |
246 | <mml:mo>!</mml:mo>\r | |
247 | </mml:mrow>\r | |
248 | </xsl:template>\r | |
249 | \r | |
250 | \r | |
251 | <!-- 4.4.3.3 divide -->\r | |
252 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:divide]]">\r | |
253 | <xsl:param name="p" select="0"/>\r | |
254 | <xsl:call-template name="binary">\r | |
255 | <xsl:with-param name="mo"><mml:mo>/</mml:mo></xsl:with-param>\r | |
256 | <xsl:with-param name="p" select="$p"/>\r | |
257 | <xsl:with-param name="this-p" select="3"/>\r | |
258 | </xsl:call-template>\r | |
259 | </xsl:template>\r | |
260 | \r | |
261 | \r | |
262 | <!-- 4.4.3.4 max min-->\r | |
263 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:max]]">\r | |
264 | <mml:mrow>\r | |
265 | <mml:mo>max</mml:mo>\r | |
266 | <xsl:call-template name="set"/>\r | |
267 | </mml:mrow>\r | |
268 | </xsl:template>\r | |
269 | \r | |
270 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:min]]">\r | |
271 | <mml:mrow>\r | |
272 | <mml:mo>max</mml:mo>\r | |
273 | <xsl:call-template name="set"/>\r | |
274 | </mml:mrow>\r | |
275 | </xsl:template>\r | |
276 | \r | |
277 | <!-- 4.4.3.5 minus-->\r | |
278 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:minus] and count(*)=2]">\r | |
279 | <mml:mrow>\r | |
280 | <mml:mo>−<!--minus--></mml:mo>\r | |
281 | <xsl:apply-templates mode="c2p" select="*[2]">\r | |
282 | <xsl:with-param name="p" select="5"/>\r | |
283 | </xsl:apply-templates>\r | |
284 | </mml:mrow>\r | |
285 | </xsl:template>\r | |
286 | \r | |
287 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:minus] and count(*)>2]">\r | |
288 | <xsl:param name="p" select="0"/>\r | |
289 | <xsl:call-template name="binary">\r | |
290 | <xsl:with-param name="mo"><mml:mo>−<!--minus--></mml:mo></xsl:with-param>\r | |
291 | <xsl:with-param name="p" select="$p"/>\r | |
292 | <xsl:with-param name="this-p" select="2"/>\r | |
293 | </xsl:call-template>\r | |
294 | </xsl:template>\r | |
295 | \r | |
296 | <!-- 4.4.3.6 plus-->\r | |
297 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:plus]]">\r | |
298 | <xsl:param name="p" select="0"/>\r | |
299 | <mml:mrow>\r | |
300 | <xsl:if test="$p > 2"><mml:mo>(</mml:mo></xsl:if>\r | |
301 | <xsl:for-each select="*[position()>1]">\r | |
302 | <xsl:if test="position() > 1">\r | |
303 | <mml:mo>\r | |
304 | <xsl:choose>\r | |
305 | <xsl:when test="self::mml:apply[*[1][self::mml:times] and\r | |
306 | *[2][self::mml:apply/*[1][self::mml:minus] or self::mml:cn[not(mml:sep) and\r | |
307 | (number(.) < 0)]]]">−<!--minus--></xsl:when>\r | |
308 | <xsl:otherwise>+</xsl:otherwise>\r | |
309 | </xsl:choose>\r | |
310 | </mml:mo>\r | |
311 | </xsl:if>\r | |
312 | <xsl:choose>\r | |
313 | <xsl:when test="self::mml:apply[*[1][self::mml:times] and\r | |
314 | *[2][self::mml:cn[not(mml:sep) and (number(.) <0)]]]">\r | |
315 | <mml:mrow>\r | |
316 | <mml:mn><xsl:value-of select="-(*[2])"/></mml:mn>\r | |
317 | <mml:mo><!--⁢--><!--invisible times--></mml:mo>\r | |
318 | <xsl:apply-templates mode="c2p" select=".">\r | |
319 | <xsl:with-param name="first" select="2"/>\r | |
320 | <xsl:with-param name="p" select="2"/>\r | |
321 | </xsl:apply-templates>\r | |
322 | </mml:mrow>\r | |
323 | </xsl:when>\r | |
324 | <xsl:when test="self::mml:apply[*[1][self::mml:times] and\r | |
325 | *[2][self::mml:apply/*[1][self::mml:minus]]]">\r | |
326 | <mml:mrow>\r | |
327 | <xsl:apply-templates mode="c2p" select="./*[2]/*[2]"/>\r | |
328 | <xsl:apply-templates mode="c2p" select=".">\r | |
329 | <xsl:with-param name="first" select="2"/>\r | |
330 | <xsl:with-param name="p" select="2"/>\r | |
331 | </xsl:apply-templates>\r | |
332 | </mml:mrow>\r | |
333 | </xsl:when>\r | |
334 | <xsl:otherwise>\r | |
335 | <xsl:apply-templates mode="c2p" select=".">\r | |
336 | <xsl:with-param name="p" select="2"/>\r | |
337 | </xsl:apply-templates>\r | |
338 | </xsl:otherwise>\r | |
339 | </xsl:choose>\r | |
340 | </xsl:for-each>\r | |
341 | <xsl:if test="$p > 2"><mml:mo>)</mml:mo></xsl:if>\r | |
342 | </mml:mrow>\r | |
343 | </xsl:template>\r | |
344 | \r | |
345 | \r | |
346 | <!-- 4.4.3.7 power -->\r | |
347 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:power]]">\r | |
348 | <mml:msup>\r | |
349 | <xsl:apply-templates mode="c2p" select="*[2]">\r | |
350 | <xsl:with-param name="p" select="5"/>\r | |
351 | </xsl:apply-templates>\r | |
352 | <xsl:apply-templates mode="c2p" select="*[3]">\r | |
353 | <xsl:with-param name="p" select="5"/>\r | |
354 | </xsl:apply-templates>\r | |
355 | </mml:msup>\r | |
356 | </xsl:template>\r | |
357 | \r | |
358 | <!-- 4.4.3.8 remainder -->\r | |
359 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:rem]]">\r | |
360 | <xsl:param name="p" select="0"/>\r | |
361 | <xsl:call-template name="binary">\r | |
362 | <xsl:with-param name="mo"><mml:mo>mod</mml:mo></xsl:with-param>\r | |
363 | <xsl:with-param name="p" select="$p"/>\r | |
364 | <xsl:with-param name="this-p" select="3"/>\r | |
365 | </xsl:call-template>\r | |
366 | </xsl:template>\r | |
367 | \r | |
368 | <!-- 4.4.3.9 times-->\r | |
369 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:times]]" name="times">\r | |
370 | <xsl:param name="p" select="0"/>\r | |
371 | <xsl:param name="first" select="1"/>\r | |
372 | <mml:mrow>\r | |
373 | <xsl:if test="$p > 3"><mml:mo>(</mml:mo></xsl:if>\r | |
374 | <xsl:for-each select="*[position()>1]">\r | |
375 | <xsl:if test="position() > 1">\r | |
376 | <mml:mo>\r | |
377 | <xsl:choose>\r | |
378 | <xsl:when test="self::mml:cn">×<!-- times --></xsl:when>\r | |
379 | <xsl:otherwise><!--⁢--><!--invisible times--></xsl:otherwise>\r | |
380 | </xsl:choose>\r | |
381 | </mml:mo>\r | |
382 | </xsl:if>\r | |
383 | <xsl:if test="position()>= $first">\r | |
384 | <xsl:apply-templates mode="c2p" select=".">\r | |
385 | <xsl:with-param name="p" select="3"/>\r | |
386 | </xsl:apply-templates>\r | |
387 | </xsl:if>\r | |
388 | </xsl:for-each>\r | |
389 | <xsl:if test="$p > 3"><mml:mo>)</mml:mo></xsl:if>\r | |
390 | </mml:mrow>\r | |
391 | </xsl:template>\r | |
392 | \r | |
393 | \r | |
394 | <!-- 4.4.3.10 root -->\r | |
395 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:root] and not(mml:degree) or mml:degree=2]" priority="4">\r | |
396 | <mml:msqrt>\r | |
397 | <xsl:apply-templates mode="c2p" select="*[position()>1]"/>\r | |
398 | </mml:msqrt>\r | |
399 | </xsl:template>\r | |
400 | \r | |
401 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:root]]">\r | |
402 | <mml:mroot>\r | |
403 | <xsl:apply-templates mode="c2p" select="*[position()>1 and not(self::mml:degree)]"/>\r | |
404 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:degree/*"/></mml:mrow>\r | |
405 | </mml:mroot>\r | |
406 | </xsl:template>\r | |
407 | \r | |
408 | <!-- 4.4.3.11 gcd -->\r | |
409 | <xsl:template mode="c2p" match="mml:gcd">\r | |
410 | <mml:mo>gcd</mml:mo>\r | |
411 | </xsl:template>\r | |
412 | \r | |
413 | <!-- 4.4.3.12 and -->\r | |
414 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:and]]">\r | |
415 | <xsl:param name="p" select="0"/>\r | |
416 | <xsl:call-template name="infix">\r | |
417 | <xsl:with-param name="this-p" select="2"/>\r | |
418 | <xsl:with-param name="p" select="$p"/>\r | |
419 | <xsl:with-param name="mo"><mml:mo>∧<!-- and --></mml:mo></xsl:with-param>\r | |
420 | </xsl:call-template>\r | |
421 | </xsl:template>\r | |
422 | \r | |
423 | \r | |
424 | <!-- 4.4.3.13 or -->\r | |
425 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:or]]">\r | |
426 | <xsl:param name="p" select="0"/>\r | |
427 | <xsl:call-template name="infix">\r | |
428 | <xsl:with-param name="this-p" select="3"/>\r | |
429 | <xsl:with-param name="p" select="$p"/>\r | |
430 | <xsl:with-param name="mo"><mml:mo>∨<!-- or --></mml:mo></xsl:with-param>\r | |
431 | </xsl:call-template>\r | |
432 | </xsl:template>\r | |
433 | \r | |
434 | <!-- 4.4.3.14 xor -->\r | |
435 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:xor]]">\r | |
436 | <xsl:param name="p" select="0"/>\r | |
437 | <xsl:call-template name="infix">\r | |
438 | <xsl:with-param name="this-p" select="3"/>\r | |
439 | <xsl:with-param name="p" select="$p"/>\r | |
440 | <xsl:with-param name="mo"><mml:mo>xor</mml:mo></xsl:with-param>\r | |
441 | </xsl:call-template>\r | |
442 | </xsl:template>\r | |
443 | \r | |
444 | \r | |
445 | <!-- 4.4.3.15 not -->\r | |
446 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:not]]">\r | |
447 | <mml:mrow>\r | |
448 | <mml:mo>¬<!-- not --></mml:mo>\r | |
449 | <xsl:apply-templates mode="c2p" select="*[2]">\r | |
450 | <xsl:with-param name="p" select="7"/>\r | |
451 | </xsl:apply-templates>\r | |
452 | </mml:mrow>\r | |
453 | </xsl:template>\r | |
454 | \r | |
455 | \r | |
456 | \r | |
457 | \r | |
458 | <!-- 4.4.3.16 implies -->\r | |
459 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:implies]]">\r | |
460 | <xsl:param name="p" select="0"/>\r | |
461 | <xsl:call-template name="binary">\r | |
462 | <xsl:with-param name="mo"><mml:mo>⇒<!-- Rightarrow --></mml:mo></xsl:with-param>\r | |
463 | <xsl:with-param name="p" select="$p"/>\r | |
464 | <xsl:with-param name="this-p" select="3"/>\r | |
465 | </xsl:call-template>\r | |
466 | </xsl:template>\r | |
467 | \r | |
468 | \r | |
469 | <!-- 4.4.3.17 forall -->\r | |
470 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:forall]]">\r | |
471 | <mml:mrow>\r | |
472 | <mml:mi>∀<!--forall--></mml:mi>\r | |
473 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:bvar[not(current()/mml:condition)]/*|mml:condition/*"/></mml:mrow>\r | |
474 | <mml:mo>.</mml:mo>\r | |
475 | <mml:mfenced>\r | |
476 | <xsl:apply-templates mode="c2p" select="*[last()]"/>\r | |
477 | </mml:mfenced>\r | |
478 | </mml:mrow>\r | |
479 | </xsl:template>\r | |
480 | \r | |
481 | \r | |
482 | \r | |
483 | <!-- 4.4.3.18 exists -->\r | |
484 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:exists]]">\r | |
485 | <mml:mrow>\r | |
486 | <mml:mi>∃<!--exists--></mml:mi>\r | |
487 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:bvar[not(current()/mml:condition)]/*|mml:condition/*"/></mml:mrow>\r | |
488 | <mml:mo>.</mml:mo>\r | |
489 | <mml:mfenced>\r | |
490 | <xsl:apply-templates mode="c2p" select="*[last()]"/>\r | |
491 | </mml:mfenced>\r | |
492 | </mml:mrow>\r | |
493 | </xsl:template>\r | |
494 | \r | |
495 | \r | |
496 | <!-- 4.4.3.19 abs -->\r | |
497 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:abs]]">\r | |
498 | <mml:mrow>\r | |
499 | <mml:mo>|</mml:mo>\r | |
500 | <xsl:apply-templates mode="c2p" select="*[2]"/>\r | |
501 | <mml:mo>|</mml:mo>\r | |
502 | </mml:mrow>\r | |
503 | </xsl:template>\r | |
504 | \r | |
505 | \r | |
506 | \r | |
507 | <!-- 4.4.3.20 conjugate -->\r | |
508 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:conjugate]]">\r | |
509 | <mml:mover>\r | |
510 | <xsl:apply-templates mode="c2p" select="*[2]"/>\r | |
511 | <mml:mo>¯<!-- overline --></mml:mo>\r | |
512 | </mml:mover>\r | |
513 | </xsl:template>\r | |
514 | \r | |
515 | <!-- 4.4.3.21 arg -->\r | |
516 | <xsl:template mode="c2p" match="mml:arg">\r | |
517 | <mml:mo>arg</mml:mo>\r | |
518 | </xsl:template>\r | |
519 | \r | |
520 | \r | |
521 | <!-- 4.4.3.22 real -->\r | |
522 | <xsl:template mode="c2p" match="mml:real">\r | |
523 | <mml:mo>ℛ<!-- real --></mml:mo>\r | |
524 | </xsl:template>\r | |
525 | \r | |
526 | <!-- 4.4.3.23 imaginary -->\r | |
527 | <xsl:template mode="c2p" match="mml:imaginary">\r | |
528 | <mml:mo>ℑ<!-- imaginary --></mml:mo>\r | |
529 | </xsl:template>\r | |
530 | \r | |
531 | <!-- 4.4.3.24 lcm -->\r | |
532 | <xsl:template mode="c2p" match="mml:lcm">\r | |
533 | <mml:mo>lcm</mml:mo>\r | |
534 | </xsl:template>\r | |
535 | \r | |
536 | \r | |
537 | <!-- 4.4.3.25 floor -->\r | |
538 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:floor]]">\r | |
539 | <mml:mrow>\r | |
540 | <mml:mo>⌊<!-- lfloor--></mml:mo>\r | |
541 | <xsl:apply-templates mode="c2p" select="*[2]"/>\r | |
542 | <mml:mo>⌋<!-- rfloor--></mml:mo>\r | |
543 | </mml:mrow>\r | |
544 | </xsl:template>\r | |
545 | \r | |
546 | \r | |
547 | <!-- 4.4.3.25 ceiling -->\r | |
548 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:ceiling]]">\r | |
549 | <mml:mrow>\r | |
550 | <mml:mo>⌈<!-- lceil--></mml:mo>\r | |
551 | <xsl:apply-templates mode="c2p" select="*[2]"/>\r | |
552 | <mml:mo>⌉<!-- rceil--></mml:mo>\r | |
553 | </mml:mrow>\r | |
554 | </xsl:template>\r | |
555 | \r | |
556 | <!-- 4.4.4.1 eq -->\r | |
557 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:eq]]">\r | |
558 | <xsl:param name="p" select="0"/>\r | |
559 | <xsl:call-template name="infix">\r | |
560 | <xsl:with-param name="this-p" select="1"/>\r | |
561 | <xsl:with-param name="p" select="$p"/>\r | |
562 | <xsl:with-param name="mo"><mml:mo>=</mml:mo></xsl:with-param>\r | |
563 | </xsl:call-template>\r | |
564 | </xsl:template>\r | |
565 | \r | |
566 | <!-- 4.4.4.2 neq -->\r | |
567 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:neq]]">\r | |
568 | <xsl:param name="p" select="0"/>\r | |
569 | <xsl:call-template name="infix">\r | |
570 | <xsl:with-param name="this-p" select="1"/>\r | |
571 | <xsl:with-param name="p" select="$p"/>\r | |
572 | <xsl:with-param name="mo"><mml:mo>≠<!-- neq --></mml:mo></xsl:with-param>\r | |
573 | </xsl:call-template>\r | |
574 | </xsl:template>\r | |
575 | \r | |
576 | <!-- 4.4.4.3 eq -->\r | |
577 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:gt]]">\r | |
578 | <xsl:param name="p" select="0"/>\r | |
579 | <xsl:call-template name="infix">\r | |
580 | <xsl:with-param name="this-p" select="1"/>\r | |
581 | <xsl:with-param name="p" select="$p"/>\r | |
582 | <xsl:with-param name="mo"><mml:mo>></mml:mo></xsl:with-param>\r | |
583 | </xsl:call-template>\r | |
584 | </xsl:template>\r | |
585 | \r | |
586 | <!-- 4.4.4.4 lt -->\r | |
587 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:lt]]">\r | |
588 | <xsl:param name="p" select="0"/>\r | |
589 | <xsl:call-template name="infix">\r | |
590 | <xsl:with-param name="this-p" select="1"/>\r | |
591 | <xsl:with-param name="p" select="$p"/>\r | |
592 | <xsl:with-param name="mo"><mml:mo><</mml:mo></xsl:with-param>\r | |
593 | </xsl:call-template>\r | |
594 | </xsl:template>\r | |
595 | \r | |
596 | <!-- 4.4.4.5 geq -->\r | |
597 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:geq]]">\r | |
598 | <xsl:param name="p" select="0"/>\r | |
599 | <xsl:call-template name="infix">\r | |
600 | <xsl:with-param name="this-p" select="1"/>\r | |
601 | <xsl:with-param name="p" select="$p"/>\r | |
602 | <xsl:with-param name="mo"><mml:mo>≥</mml:mo></xsl:with-param>\r | |
603 | </xsl:call-template>\r | |
604 | </xsl:template>\r | |
605 | \r | |
606 | <!-- 4.4.4.6 geq -->\r | |
607 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:leq]]">\r | |
608 | <xsl:param name="p" select="0"/>\r | |
609 | <xsl:call-template name="infix">\r | |
610 | <xsl:with-param name="this-p" select="1"/>\r | |
611 | <xsl:with-param name="p" select="$p"/>\r | |
612 | <xsl:with-param name="mo"><mml:mo>≤</mml:mo></xsl:with-param>\r | |
613 | </xsl:call-template>\r | |
614 | </xsl:template>\r | |
615 | \r | |
616 | <!-- 4.4.4.7 equivalent -->\r | |
617 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:equivalent]]">\r | |
618 | <xsl:param name="p" select="0"/>\r | |
619 | <xsl:call-template name="infix">\r | |
620 | <xsl:with-param name="this-p" select="1"/>\r | |
621 | <xsl:with-param name="p" select="$p"/>\r | |
622 | <xsl:with-param name="mo"><mml:mo>≡</mml:mo></xsl:with-param>\r | |
623 | </xsl:call-template>\r | |
624 | </xsl:template>\r | |
625 | \r | |
626 | <!-- 4.4.4.8 approx -->\r | |
627 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:approx]]">\r | |
628 | <xsl:param name="p" select="0"/>\r | |
629 | <xsl:call-template name="infix">\r | |
630 | <xsl:with-param name="this-p" select="1"/>\r | |
631 | <xsl:with-param name="p" select="$p"/>\r | |
632 | <xsl:with-param name="mo"><mml:mo>≃</mml:mo></xsl:with-param>\r | |
633 | </xsl:call-template>\r | |
634 | </xsl:template>\r | |
635 | \r | |
636 | \r | |
637 | <!-- 4.4.4.9 factorof -->\r | |
638 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:factorof]]">\r | |
639 | <xsl:param name="p" select="0"/>\r | |
640 | <xsl:call-template name="binary">\r | |
641 | <xsl:with-param name="mo"><mml:mo>|</mml:mo></xsl:with-param>\r | |
642 | <xsl:with-param name="p" select="$p"/>\r | |
643 | <xsl:with-param name="this-p" select="3"/>\r | |
644 | </xsl:call-template>\r | |
645 | </xsl:template>\r | |
646 | \r | |
647 | <!-- 4.4.5.1 int -->\r | |
648 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:int]]">\r | |
649 | <mml:mrow>\r | |
650 | <mml:msubsup>\r | |
651 | <mml:mi>∫<!--int--></mml:mi>\r | |
652 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:lowlimit/*|mml:interval/*[1]|mml:condition/*"/></mml:mrow>\r | |
653 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:uplimit/*|mml:interval/*[2]"/></mml:mrow>\r | |
654 | </mml:msubsup>\r | |
655 | <xsl:apply-templates mode="c2p" select="*[last()]"/>\r | |
656 | <mml:mo>d</mml:mo><xsl:apply-templates mode="c2p" select="mml:bvar"/>\r | |
657 | </mml:mrow>\r | |
658 | </xsl:template>\r | |
659 | \r | |
660 | <!-- 4.4.5.2 diff -->\r | |
661 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:diff] and mml:ci and count(*)=2]" priority="2">\r | |
662 | <mml:msup>\r | |
663 | <mml:mrow><xsl:apply-templates mode="c2p" select="*[2]"/></mml:mrow>\r | |
664 | <mml:mo>′<!--prime--></mml:mo>\r | |
665 | </mml:msup>\r | |
666 | </xsl:template>\r | |
667 | \r | |
668 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:diff]]" priority="1">\r | |
669 | <mml:mfrac>\r | |
670 | <xsl:choose>\r | |
671 | <xsl:when test="mml:bvar/mml:degree">\r | |
672 | <mml:mrow><mml:msup><mml:mo>d</mml:mo><xsl:apply-templates mode="c2p" select="mml:bvar/mml:degree/node()"/></mml:msup>\r | |
673 | <xsl:apply-templates mode="c2p" select="*[last()]"/></mml:mrow>\r | |
674 | <mml:mrow><mml:mo>d</mml:mo><mml:msup><xsl:apply-templates mode="c2p"\r | |
675 | select="mml:bvar/node()"/><xsl:apply-templates mode="c2p"\r | |
676 | select="mml:bvar/mml:degree/node()"/></mml:msup>\r | |
677 | </mml:mrow>\r | |
678 | </xsl:when>\r | |
679 | <xsl:otherwise>\r | |
680 | <mml:mrow><mml:mo>d</mml:mo><xsl:apply-templates mode="c2p" select="*[last()]"/></mml:mrow>\r | |
681 | <mml:mrow><mml:mo>d</mml:mo><xsl:apply-templates mode="c2p" select="mml:bvar"/></mml:mrow>\r | |
682 | </xsl:otherwise>\r | |
683 | </xsl:choose>\r | |
684 | </mml:mfrac>\r | |
685 | </xsl:template>\r | |
686 | \r | |
687 | \r | |
688 | <!-- 4.4.5.3 partialdiff -->\r | |
689 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:partialdiff] and mml:list and mml:ci and count(*)=3]" priority="2">\r | |
690 | <mml:mrow>\r | |
691 | <mml:msub><mml:mo>D</mml:mo><mml:mrow>\r | |
692 | <xsl:for-each select="mml:list[1]/*">\r | |
693 | <xsl:apply-templates mode="c2p" select="."/>\r | |
694 | <xsl:if test="position()<last()"><mml:mo>,</mml:mo></xsl:if>\r | |
695 | </xsl:for-each>\r | |
696 | </mml:mrow></mml:msub>\r | |
697 | <mml:mrow><xsl:apply-templates mode="c2p" select="*[3]"/></mml:mrow>\r | |
698 | </mml:mrow>\r | |
699 | </xsl:template>\r | |
700 | \r | |
701 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:partialdiff]]" priority="1">\r | |
702 | <mml:mfrac>\r | |
703 | <mml:mrow><mml:msup><mml:mo>∂<!-- partial --></mml:mo>\r | |
704 | <mml:mrow>\r | |
705 | <xsl:choose>\r | |
706 | <xsl:when test="mml:degree">\r | |
707 | <xsl:apply-templates mode="c2p" select="mml:degree/node()"/>\r | |
708 | </xsl:when>\r | |
709 | <xsl:when test="mml:bvar/mml:degree[string(number(.))='NaN']">\r | |
710 | <xsl:for-each select="mml:bvar/mml:degree">\r | |
711 | <xsl:apply-templates mode="c2p" select="node()"/>\r | |
712 | <xsl:if test="position()<last()"><mml:mo>+</mml:mo></xsl:if>\r | |
713 | </xsl:for-each>\r | |
714 | <xsl:if test="count(mml:bvar[not(mml:degree)])>0">\r | |
715 | <mml:mo>+</mml:mo><mml:mn><xsl:value-of select="count(mml:bvar[not(mml:degree)])"/></mml:mn>\r | |
716 | </xsl:if>\r | |
717 | </xsl:when>\r | |
718 | <xsl:otherwise>\r | |
719 | <mml:mn><xsl:value-of select="sum(mml:bvar/mml:degree)+count(mml:bvar[not(mml:degree)])"/></mml:mn>\r | |
720 | </xsl:otherwise>\r | |
721 | </xsl:choose>\r | |
722 | </mml:mrow>\r | |
723 | </mml:msup>\r | |
724 | <xsl:apply-templates mode="c2p" select="*[last()]"/></mml:mrow>\r | |
725 | <mml:mrow>\r | |
726 | <xsl:for-each select="mml:bvar">\r | |
727 | <mml:mrow>\r | |
728 | <mml:mo>∂<!-- partial --></mml:mo><mml:msup><xsl:apply-templates mode="c2p" select="node()"/>\r | |
729 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:degree/node()"/></mml:mrow>\r | |
730 | </mml:msup>\r | |
731 | </mml:mrow>\r | |
732 | </xsl:for-each>\r | |
733 | </mml:mrow>\r | |
734 | </mml:mfrac>\r | |
735 | </xsl:template>\r | |
736 | \r | |
737 | <!-- 4.4.5.4 lowlimit-->\r | |
738 | <xsl:template mode="c2p" match="mml:lowlimit"/>\r | |
739 | \r | |
740 | <!-- 4.4.5.5 uplimit-->\r | |
741 | <xsl:template mode="c2p" match="mml:uplimit"/>\r | |
742 | \r | |
743 | <!-- 4.4.5.6 bvar-->\r | |
744 | <xsl:template mode="c2p" match="mml:bvar">\r | |
745 | <mml:mi><xsl:apply-templates mode="c2p"/></mml:mi>\r | |
746 | <xsl:if test="following-sibling::mml:bvar"><mml:mo>,</mml:mo></xsl:if>\r | |
747 | </xsl:template>\r | |
748 | \r | |
749 | <!-- 4.4.5.7 degree-->\r | |
750 | <xsl:template mode="c2p" match="mml:degree"/>\r | |
751 | \r | |
752 | <!-- 4.4.5.8 divergence-->\r | |
753 | <xsl:template mode="c2p" match="mml:divergence">\r | |
754 | <mml:mo>div</mml:mo>\r | |
755 | </xsl:template>\r | |
756 | \r | |
757 | <!-- 4.4.5.9 grad-->\r | |
758 | <xsl:template mode="c2p" match="mml:grad">\r | |
759 | <mml:mo>grad</mml:mo>\r | |
760 | </xsl:template>\r | |
761 | \r | |
762 | <!-- 4.4.5.10 curl -->\r | |
763 | <xsl:template mode="c2p" match="mml:curl">\r | |
764 | <mml:mo>curl</mml:mo>\r | |
765 | </xsl:template>\r | |
766 | \r | |
767 | \r | |
768 | <!-- 4.4.5.11 laplacian-->\r | |
769 | <xsl:template mode="c2p" match="mml:laplacian">\r | |
770 | <mml:msup><mml:mo>∇<!-- nabla --></mml:mo><mml:mn>2</mml:mn></mml:msup>\r | |
771 | </xsl:template>\r | |
772 | \r | |
773 | <!-- 4.4.6.1 set -->\r | |
774 | \r | |
775 | <xsl:template mode="c2p" match="mml:set">\r | |
776 | <xsl:call-template name="set"/>\r | |
777 | </xsl:template>\r | |
778 | \r | |
779 | <!-- 4.4.6.2 list -->\r | |
780 | \r | |
781 | <xsl:template mode="c2p" match="mml:list">\r | |
782 | <xsl:call-template name="set">\r | |
783 | <xsl:with-param name="o" select="'('"/>\r | |
784 | <xsl:with-param name="c" select="')'"/>\r | |
785 | </xsl:call-template>\r | |
786 | </xsl:template>\r | |
787 | \r | |
788 | <!-- 4.4.6.3 union -->\r | |
789 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:union]]">\r | |
790 | <xsl:param name="p" select="0"/>\r | |
791 | <xsl:call-template name="infix">\r | |
792 | <xsl:with-param name="this-p" select="2"/>\r | |
793 | <xsl:with-param name="p" select="$p"/>\r | |
794 | <xsl:with-param name="mo"><mml:mo>∪<!-- union --></mml:mo></xsl:with-param>\r | |
795 | </xsl:call-template>\r | |
796 | </xsl:template>\r | |
797 | \r | |
798 | <!-- 4.4.6.4 intersect -->\r | |
799 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:intersect]]">\r | |
800 | <xsl:param name="p" select="0"/>\r | |
801 | <xsl:call-template name="infix">\r | |
802 | <xsl:with-param name="this-p" select="3"/>\r | |
803 | <xsl:with-param name="p" select="$p"/>\r | |
804 | <xsl:with-param name="mo"><mml:mo>∩<!-- intersect --></mml:mo></xsl:with-param>\r | |
805 | </xsl:call-template>\r | |
806 | </xsl:template>\r | |
807 | \r | |
808 | <!-- 4.4.6.5 in -->\r | |
809 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:in]]">\r | |
810 | <xsl:param name="p" select="0"/>\r | |
811 | <xsl:call-template name="binary">\r | |
812 | <xsl:with-param name="mo"><mml:mo>∈<!-- in --></mml:mo></xsl:with-param>\r | |
813 | <xsl:with-param name="p" select="$p"/>\r | |
814 | <xsl:with-param name="this-p" select="3"/>\r | |
815 | </xsl:call-template>\r | |
816 | </xsl:template>\r | |
817 | \r | |
818 | <!-- 4.4.6.5 notin -->\r | |
819 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:notin]]">\r | |
820 | <xsl:param name="p" select="0"/>\r | |
821 | <xsl:call-template name="binary">\r | |
822 | <xsl:with-param name="mo"><mml:mo>∉<!-- not in --></mml:mo></xsl:with-param>\r | |
823 | <xsl:with-param name="p" select="$p"/>\r | |
824 | <xsl:with-param name="this-p" select="3"/>\r | |
825 | </xsl:call-template>\r | |
826 | </xsl:template>\r | |
827 | \r | |
828 | <!-- 4.4.6.7 subset -->\r | |
829 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:subset]]">\r | |
830 | <xsl:param name="p" select="0"/>\r | |
831 | <xsl:call-template name="infix">\r | |
832 | <xsl:with-param name="this-p" select="2"/>\r | |
833 | <xsl:with-param name="p" select="$p"/>\r | |
834 | <xsl:with-param name="mo"><mml:mo>⊆<!-- subseteq --></mml:mo></xsl:with-param>\r | |
835 | </xsl:call-template>\r | |
836 | </xsl:template>\r | |
837 | \r | |
838 | <!-- 4.4.6.8 prsubset -->\r | |
839 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:prsubset]]">\r | |
840 | <xsl:param name="p" select="0"/>\r | |
841 | <xsl:call-template name="infix">\r | |
842 | <xsl:with-param name="this-p" select="2"/>\r | |
843 | <xsl:with-param name="p" select="$p"/>\r | |
844 | <xsl:with-param name="mo"><mml:mo>⊂<!-- prsubset --></mml:mo></xsl:with-param>\r | |
845 | </xsl:call-template>\r | |
846 | </xsl:template>\r | |
847 | \r | |
848 | <!-- 4.4.6.9 notsubset -->\r | |
849 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:notsubset]]">\r | |
850 | <xsl:param name="p" select="0"/>\r | |
851 | <xsl:call-template name="binary">\r | |
852 | <xsl:with-param name="this-p" select="2"/>\r | |
853 | <xsl:with-param name="p" select="$p"/>\r | |
854 | <xsl:with-param name="mo"><mml:mo>⊈<!-- notsubseteq --></mml:mo></xsl:with-param>\r | |
855 | </xsl:call-template>\r | |
856 | </xsl:template>\r | |
857 | \r | |
858 | <!-- 4.4.6.10 notprsubset -->\r | |
859 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:notprsubset]]">\r | |
860 | <xsl:param name="p" select="0"/>\r | |
861 | <xsl:call-template name="binary">\r | |
862 | <xsl:with-param name="this-p" select="2"/>\r | |
863 | <xsl:with-param name="p" select="$p"/>\r | |
864 | <xsl:with-param name="mo"><mml:mo>⊄<!-- prsubset --></mml:mo></xsl:with-param>\r | |
865 | </xsl:call-template>\r | |
866 | </xsl:template>\r | |
867 | \r | |
868 | <!-- 4.4.6.11 setdiff -->\r | |
869 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:setdiff]]">\r | |
870 | <xsl:param name="p" select="0"/>\r | |
871 | <xsl:call-template name="binary">\r | |
872 | <xsl:with-param name="this-p" select="2"/>\r | |
873 | <xsl:with-param name="p" select="$p"/>\r | |
874 | <xsl:with-param name="mo"><mml:mo>∖<!-- setminus --></mml:mo></xsl:with-param>\r | |
875 | </xsl:call-template>\r | |
876 | </xsl:template>\r | |
877 | \r | |
878 | <!-- 4.4.6.12 card -->\r | |
879 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:card]]">\r | |
880 | <mml:mrow>\r | |
881 | <mml:mo>|</mml:mo>\r | |
882 | <xsl:apply-templates mode="c2p" select="*[2]"/>\r | |
883 | <mml:mo>|</mml:mo>\r | |
884 | </mml:mrow>\r | |
885 | </xsl:template>\r | |
886 | \r | |
887 | <!-- 4.4.6.13 cartesianproduct -->\r | |
888 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:cartesianproduct or self::mml:vectorproduct]]">\r | |
889 | <xsl:param name="p" select="0"/>\r | |
890 | <xsl:call-template name="infix">\r | |
891 | <xsl:with-param name="this-p" select="2"/>\r | |
892 | <xsl:with-param name="p" select="$p"/>\r | |
893 | <xsl:with-param name="mo"><mml:mo>×<!-- times --></mml:mo></xsl:with-param>\r | |
894 | </xsl:call-template>\r | |
895 | </xsl:template>\r | |
896 | \r | |
897 | <xsl:template\r | |
898 | match="mml:apply[*[1][self::mml:cartesianproduct][count(following-sibling::mml:reals)=count(following-sibling::*)]]"\r | |
899 | priority="2">\r | |
900 | <mml:msup>\r | |
901 | <xsl:apply-templates mode="c2p" select="*[2]">\r | |
902 | <xsl:with-param name="p" select="5"/>\r | |
903 | </xsl:apply-templates>\r | |
904 | <mml:mn><xsl:value-of select="count(*)-1"/></mml:mn>\r | |
905 | </mml:msup>\r | |
906 | </xsl:template>\r | |
907 | \r | |
908 | \r | |
909 | <!-- 4.4.7.1 sum -->\r | |
910 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:sum]]">\r | |
911 | <mml:mrow>\r | |
912 | <mml:msubsup>\r | |
913 | <mml:mo>∑<!--sum--></mml:mo>\r | |
914 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:lowlimit/*|mml:interval/*[1]|mml:condition/*"/></mml:mrow>\r | |
915 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:uplimit/*|mml:interval/*[2]"/></mml:mrow>\r | |
916 | </mml:msubsup>\r | |
917 | <xsl:apply-templates mode="c2p" select="*[last()]"/>\r | |
918 | </mml:mrow>\r | |
919 | </xsl:template>\r | |
920 | \r | |
921 | <!-- 4.4.7.2 product -->\r | |
922 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:product]]">\r | |
923 | <mml:mrow>\r | |
924 | <mml:msubsup>\r | |
925 | <mml:mo>∏<!--product--></mml:mo>\r | |
926 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:lowlimit/*|mml:interval/*[1]|mml:condition/*"/></mml:mrow>\r | |
927 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:uplimit/*|mml:interval/*[2]"/></mml:mrow>\r | |
928 | </mml:msubsup>\r | |
929 | <xsl:apply-templates mode="c2p" select="*[last()]"/>\r | |
930 | </mml:mrow>\r | |
931 | </xsl:template>\r | |
932 | \r | |
933 | <!-- 4.4.7.3 limit -->\r | |
934 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:limit]]">\r | |
935 | <mml:mrow>\r | |
936 | <mml:munder>\r | |
937 | <mml:mi>limit</mml:mi>\r | |
938 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:lowlimit|mml:condition/*"/></mml:mrow>\r | |
939 | </mml:munder>\r | |
940 | <xsl:apply-templates mode="c2p" select="*[last()]"/>\r | |
941 | </mml:mrow>\r | |
942 | </xsl:template>\r | |
943 | \r | |
944 | <xsl:template mode="c2p" match="mml:apply[mml:limit]/mml:lowlimit" priority="3">\r | |
945 | <mml:mrow>\r | |
946 | <xsl:apply-templates mode="c2p" select="../mml:bvar/node()"/>\r | |
947 | <mml:mo>→<!--rightarrow--></mml:mo>\r | |
948 | <xsl:apply-templates mode="c2p"/>\r | |
949 | </mml:mrow>\r | |
950 | </xsl:template>\r | |
951 | \r | |
952 | \r | |
953 | <!-- 4.4.7.4 tendsto -->\r | |
954 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:tendsto]]">\r | |
955 | <xsl:param name="p"/>\r | |
956 | <xsl:call-template name="binary">\r | |
957 | <xsl:with-param name="this-p" select="2"/>\r | |
958 | <xsl:with-param name="p" select="$p"/>\r | |
959 | <xsl:with-param name="mo"><mml:mo>\r | |
960 | <xsl:choose>\r | |
961 | <xsl:when test="@type='above'">↘<!--searrow--></xsl:when>\r | |
962 | <xsl:when test="@type='below'">↗<!--nearrow--></xsl:when>\r | |
963 | <xsl:when test="@type='two-sided'">→<!--rightarrow--></xsl:when>\r | |
964 | <xsl:otherwise>→<!--rightarrow--></xsl:otherwise>\r | |
965 | </xsl:choose>\r | |
966 | </mml:mo></xsl:with-param>\r | |
967 | </xsl:call-template>\r | |
968 | </xsl:template>\r | |
969 | \r | |
970 | <!-- 4.4.8.1 trig -->\r | |
971 | <xsl:template mode="c2p" match="mml:apply[*[1][\r | |
972 | self::mml:sin or self::mml:cos or self::mml:tan or self::mml:sec or\r | |
973 | self::mml:csc or self::mml:cot or self::mml:sinh or self::mml:cosh or\r | |
974 | self::mml:tanh or self::mml:sech or self::mml:csch or self::mml:coth or\r | |
975 | self::mml:arcsin or self::mml:arccos or self::mml:arctan or self::mml:arccosh\r | |
976 | or self::mml:arccot or self::mml:arccoth or self::mml:arccsc or\r | |
977 | self::mml:arccsch or self::mml:arcsec or self::mml:arcsech or\r | |
978 | self::mml:arcsinh or self::mml:arctanh or self::mml:ln]]">\r | |
979 | <mml:mrow>\r | |
980 | <mml:mi><xsl:value-of select="local-name(*[1])"/></mml:mi>\r | |
981 | <xsl:apply-templates mode="c2p" select="*[2]">\r | |
982 | <xsl:with-param name="p" select="7"/>\r | |
983 | </xsl:apply-templates>\r | |
984 | </mml:mrow>\r | |
985 | </xsl:template>\r | |
986 | \r | |
987 | \r | |
988 | \r | |
989 | \r | |
990 | <!-- 4.4.8.2 exp -->\r | |
991 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:exp]]">\r | |
992 | <mml:msup>\r | |
993 | <mml:mi>e<!-- exponential e--></mml:mi>\r | |
994 | <mml:mrow><xsl:apply-templates mode="c2p" select="*[2]"/></mml:mrow>\r | |
995 | </mml:msup>\r | |
996 | </xsl:template>\r | |
997 | \r | |
998 | <!-- 4.4.8.3 ln -->\r | |
999 | <!-- with trig -->\r | |
1000 | \r | |
1001 | <!-- 4.4.8.4 log -->\r | |
1002 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:log]]">\r | |
1003 | <mml:mrow>\r | |
1004 | <xsl:choose>\r | |
1005 | <xsl:when test="not(mml:logbase) or mml:logbase=10">\r | |
1006 | <mml:mi>log</mml:mi>\r | |
1007 | </xsl:when>\r | |
1008 | <xsl:otherwise>\r | |
1009 | <mml:msub>\r | |
1010 | <mml:mi>log</mml:mi>\r | |
1011 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:logbase/node()"/></mml:mrow>\r | |
1012 | </mml:msub>\r | |
1013 | </xsl:otherwise>\r | |
1014 | </xsl:choose>\r | |
1015 | <xsl:apply-templates mode="c2p" select="*[last()]">\r | |
1016 | <xsl:with-param name="p" select="7"/>\r | |
1017 | </xsl:apply-templates>\r | |
1018 | </mml:mrow>\r | |
1019 | </xsl:template>\r | |
1020 | \r | |
1021 | \r | |
1022 | <!-- 4.4.9.1 mean -->\r | |
1023 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:mean]]">\r | |
1024 | <mml:mrow>\r | |
1025 | <mml:mo>〈<!--langle--></mml:mo>\r | |
1026 | <xsl:for-each select="*[position()>1]">\r | |
1027 | <xsl:apply-templates mode="c2p" select="."/>\r | |
1028 | <xsl:if test="position() !=last()"><mml:mo>,</mml:mo></xsl:if>\r | |
1029 | </xsl:for-each>\r | |
1030 | <mml:mo>〉<!--rangle--></mml:mo>\r | |
1031 | </mml:mrow>\r | |
1032 | </xsl:template>\r | |
1033 | \r | |
1034 | \r | |
1035 | <!-- 4.4.9.2 sdef -->\r | |
1036 | <xsl:template mode="c2p" match="mml:sdev">\r | |
1037 | <mml:mo>σ<!--sigma--></mml:mo>\r | |
1038 | </xsl:template>\r | |
1039 | \r | |
1040 | <!-- 4.4.9.3 variance -->\r | |
1041 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:variance]]">\r | |
1042 | <mml:msup>\r | |
1043 | <mml:mrow>\r | |
1044 | <mml:mo>σ<!--sigma--></mml:mo>\r | |
1045 | <mml:mo>(</mml:mo>\r | |
1046 | <xsl:apply-templates mode="c2p" select="*[2]"/>\r | |
1047 | <mml:mo>)</mml:mo>\r | |
1048 | </mml:mrow>\r | |
1049 | <mml:mn>2</mml:mn>\r | |
1050 | </mml:msup>\r | |
1051 | </xsl:template>\r | |
1052 | \r | |
1053 | \r | |
1054 | <!-- 4.4.9.4 median -->\r | |
1055 | <xsl:template mode="c2p" match="mml:median">\r | |
1056 | <mml:mo>median</mml:mo>\r | |
1057 | </xsl:template>\r | |
1058 | \r | |
1059 | \r | |
1060 | <!-- 4.4.9.5 mode -->\r | |
1061 | <xsl:template mode="c2p" match="mml:mode">\r | |
1062 | <mml:mo>mode</mml:mo>\r | |
1063 | </xsl:template>\r | |
1064 | \r | |
1065 | <!-- 4.4.9.5 moment -->\r | |
1066 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:moment]]">\r | |
1067 | <mml:mrow>\r | |
1068 | <mml:mo>〈<!--langle--></mml:mo>\r | |
1069 | <mml:msup>\r | |
1070 | <xsl:apply-templates mode="c2p" select="*[last()]"/>\r | |
1071 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:degree/node()"/></mml:mrow>\r | |
1072 | </mml:msup>\r | |
1073 | <mml:mo>〉<!--rangle--></mml:mo>\r | |
1074 | </mml:mrow>\r | |
1075 | </xsl:template>\r | |
1076 | \r | |
1077 | <!-- 4.4.9.5 momentabout -->\r | |
1078 | <xsl:template mode="c2p" match="mml:momentabout"/>\r | |
1079 | \r | |
1080 | <!-- 4.4.10.1 vector -->\r | |
1081 | <xsl:template mode="c2p" match="mml:vector">\r | |
1082 | <mml:mrow>\r | |
1083 | <mml:mo>(</mml:mo>\r | |
1084 | <mml:mtable>\r | |
1085 | <xsl:for-each select="*">\r | |
1086 | <mml:mtr><mml:mtd><xsl:apply-templates mode="c2p" select="."/></mml:mtd></mml:mtr>\r | |
1087 | </xsl:for-each>\r | |
1088 | </mml:mtable>\r | |
1089 | <mml:mo>)</mml:mo>\r | |
1090 | </mml:mrow>\r | |
1091 | </xsl:template>\r | |
1092 | \r | |
1093 | <!-- 4.4.10.2 matrix -->\r | |
1094 | <xsl:template mode="c2p" match="mml:matrix">\r | |
1095 | <mml:mrow>\r | |
1096 | <mml:mo>(</mml:mo>\r | |
1097 | <mml:mtable>\r | |
1098 | <xsl:apply-templates mode="c2p"/>\r | |
1099 | </mml:mtable>\r | |
1100 | <mml:mo>)</mml:mo>\r | |
1101 | </mml:mrow>\r | |
1102 | </xsl:template>\r | |
1103 | \r | |
1104 | <!-- 4.4.10.3 matrixrow -->\r | |
1105 | <xsl:template mode="c2p" match="mml:matrixrow">\r | |
1106 | <mml:mtr>\r | |
1107 | <xsl:for-each select="*">\r | |
1108 | <mml:mtd><xsl:apply-templates mode="c2p" select="."/></mml:mtd>\r | |
1109 | </xsl:for-each>\r | |
1110 | </mml:mtr>\r | |
1111 | </xsl:template>\r | |
1112 | \r | |
1113 | <!-- 4.4.10.4 determinant -->\r | |
1114 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:determinant]]">\r | |
1115 | <mml:mrow>\r | |
1116 | <mml:mi>det</mml:mi>\r | |
1117 | <xsl:apply-templates mode="c2p" select="*[2]">\r | |
1118 | <xsl:with-param name="p" select="7"/>\r | |
1119 | </xsl:apply-templates>\r | |
1120 | </mml:mrow>\r | |
1121 | </xsl:template>\r | |
1122 | \r | |
1123 | <xsl:template\r | |
1124 | match="mml:apply[*[1][self::mml:determinant]][*[2][self::mml:matrix]]" priority="2">\r | |
1125 | <mml:mrow>\r | |
1126 | <mml:mo>|</mml:mo>\r | |
1127 | <mml:mtable>\r | |
1128 | <xsl:apply-templates mode="c2p" select="mml:matrix/*"/>\r | |
1129 | </mml:mtable>\r | |
1130 | <mml:mo>|</mml:mo>\r | |
1131 | </mml:mrow>\r | |
1132 | </xsl:template>\r | |
1133 | \r | |
1134 | <!-- 4.4.10.5 transpose -->\r | |
1135 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:transpose]]">\r | |
1136 | <mml:msup>\r | |
1137 | <xsl:apply-templates mode="c2p" select="*[2]">\r | |
1138 | <xsl:with-param name="p" select="7"/>\r | |
1139 | </xsl:apply-templates>\r | |
1140 | <mml:mi>T</mml:mi>\r | |
1141 | </mml:msup>\r | |
1142 | </xsl:template>\r | |
1143 | \r | |
1144 | <!-- 4.4.10.5 selector -->\r | |
1145 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:selector]]">\r | |
1146 | <mml:msub>\r | |
1147 | <xsl:apply-templates mode="c2p" select="*[2]">\r | |
1148 | <xsl:with-param name="p" select="7"/>\r | |
1149 | </xsl:apply-templates>\r | |
1150 | <mml:mrow>\r | |
1151 | <xsl:for-each select="*[position()>2]">\r | |
1152 | <xsl:apply-templates mode="c2p" select="."/>\r | |
1153 | <xsl:if test="position() !=last()"><mml:mo>,</mml:mo></xsl:if>\r | |
1154 | </xsl:for-each>\r | |
1155 | </mml:mrow>\r | |
1156 | </mml:msub>\r | |
1157 | </xsl:template>\r | |
1158 | \r | |
1159 | <!-- *** -->\r | |
1160 | <!-- 4.4.10.6 vectorproduct see cartesianproduct -->\r | |
1161 | \r | |
1162 | \r | |
1163 | <!-- 4.4.10.7 scalarproduct-->\r | |
1164 | <xsl:template mode="c2p" match="mml:apply[*[1][self::mml:scalarproduct or self::mml:outerproduct]]">\r | |
1165 | <xsl:param name="p" select="0"/>\r | |
1166 | <xsl:call-template name="infix">\r | |
1167 | <xsl:with-param name="this-p" select="2"/>\r | |
1168 | <xsl:with-param name="p" select="$p"/>\r | |
1169 | <xsl:with-param name="mo"><mml:mo>.</mml:mo></xsl:with-param>\r | |
1170 | </xsl:call-template>\r | |
1171 | </xsl:template>\r | |
1172 | \r | |
1173 | <!-- 4.4.10.8 outerproduct-->\r | |
1174 | \r | |
1175 | <!-- 4.4.11.2 semantics -->\r | |
1176 | <xsl:template mode="c2p" match="mml:semantics">\r | |
1177 | <xsl:apply-templates mode="c2p" select="*[1]"/>\r | |
1178 | </xsl:template>\r | |
1179 | <xsl:template mode="c2p" match="mml:semantics[mml:annotation-xml/@encoding='MathML-Presentation']">\r | |
1180 | <xsl:apply-templates mode="c2p" select="mml:annotation-xml[@encoding='MathML-Presentation']/node()"/>\r | |
1181 | </xsl:template>\r | |
1182 | \r | |
1183 | <!-- 4.4.12.1 integers -->\r | |
1184 | <xsl:template mode="c2p" match="mml:integers">\r | |
1185 | <mml:mi mathvariant="double-struck">Z</mml:mi>\r | |
1186 | </xsl:template>\r | |
1187 | \r | |
1188 | <!-- 4.4.12.2 reals -->\r | |
1189 | <xsl:template mode="c2p" match="mml:reals">\r | |
1190 | <mml:mi mathvariant="double-struck">R</mml:mi>\r | |
1191 | </xsl:template>\r | |
1192 | \r | |
1193 | <!-- 4.4.12.3 rationals -->\r | |
1194 | <xsl:template mode="c2p" match="mml:rationals">\r | |
1195 | <mml:mi mathvariant="double-struck">Q</mml:mi>\r | |
1196 | </xsl:template>\r | |
1197 | \r | |
1198 | <!-- 4.4.12.4 naturalnumbers -->\r | |
1199 | <xsl:template mode="c2p" match="mml:naturalnumbers">\r | |
1200 | <mml:mi mathvariant="double-struck">N</mml:mi>\r | |
1201 | </xsl:template>\r | |
1202 | \r | |
1203 | <!-- 4.4.12.5 complexes -->\r | |
1204 | <xsl:template mode="c2p" match="mml:complexes">\r | |
1205 | <mml:mi mathvariant="double-struck">C</mml:mi>\r | |
1206 | </xsl:template>\r | |
1207 | \r | |
1208 | <!-- 4.4.12.6 primes -->\r | |
1209 | <xsl:template mode="c2p" match="mml:primes">\r | |
1210 | <mml:mi mathvariant="double-struck">P</mml:mi>\r | |
1211 | </xsl:template>\r | |
1212 | \r | |
1213 | <!-- 4.4.12.7 exponentiale -->\r | |
1214 | <xsl:template mode="c2p" match="mml:exponentiale">\r | |
1215 | <mml:mi>e<!-- exponential e--></mml:mi>\r | |
1216 | </xsl:template>\r | |
1217 | \r | |
1218 | <!-- 4.4.12.8 imaginaryi -->\r | |
1219 | <xsl:template mode="c2p" match="mml:imaginaryi">\r | |
1220 | <mml:mi>i<!-- imaginary i--></mml:mi>\r | |
1221 | </xsl:template>\r | |
1222 | \r | |
1223 | <!-- 4.4.12.9 notanumber -->\r | |
1224 | <xsl:template mode="c2p" match="mml:notanumber">\r | |
1225 | <mml:mi>NaN</mml:mi>\r | |
1226 | </xsl:template>\r | |
1227 | \r | |
1228 | <!-- 4.4.12.10 true -->\r | |
1229 | <xsl:template mode="c2p" match="mml:true">\r | |
1230 | <mml:mi>true</mml:mi>\r | |
1231 | </xsl:template>\r | |
1232 | \r | |
1233 | <!-- 4.4.12.11 false -->\r | |
1234 | <xsl:template mode="c2p" match="mml:false">\r | |
1235 | <mml:mi>false</mml:mi>\r | |
1236 | </xsl:template>\r | |
1237 | \r | |
1238 | <!-- 4.4.12.12 emptyset -->\r | |
1239 | <xsl:template mode="c2p" match="mml:emptyset">\r | |
1240 | <mml:mi>∅<!-- emptyset --></mml:mi>\r | |
1241 | </xsl:template>\r | |
1242 | \r | |
1243 | \r | |
1244 | <!-- 4.4.12.13 pi -->\r | |
1245 | <xsl:template mode="c2p" match="mml:pi">\r | |
1246 | <mml:mi>π<!-- pi --></mml:mi>\r | |
1247 | </xsl:template>\r | |
1248 | \r | |
1249 | <!-- 4.4.12.14 eulergamma -->\r | |
1250 | <xsl:template mode="c2p" match="mml:eulergamma">\r | |
1251 | <mml:mi>γ<!-- gamma --></mml:mi>\r | |
1252 | </xsl:template>\r | |
1253 | \r | |
1254 | <!-- 4.4.12.15 infinity -->\r | |
1255 | <xsl:template mode="c2p" match="mml:infinity">\r | |
1256 | <mml:mi>∞<!-- infinity --></mml:mi>\r | |
1257 | </xsl:template>\r | |
1258 | \r | |
1259 | \r | |
1260 | <!-- ****************************** -->\r | |
1261 | <xsl:template name="infix" >\r | |
1262 | <xsl:param name="mo"/>\r | |
1263 | <xsl:param name="p" select="0"/>\r | |
1264 | <xsl:param name="this-p" select="0"/>\r | |
1265 | <mml:mrow>\r | |
1266 | <xsl:if test="$this-p < $p"><mml:mo>(</mml:mo></xsl:if>\r | |
1267 | <xsl:for-each select="*[position()>1]">\r | |
1268 | <xsl:if test="position() > 1">\r | |
1269 | <xsl:copy-of select="$mo"/>\r | |
1270 | </xsl:if>\r | |
1271 | <xsl:apply-templates mode="c2p" select=".">\r | |
1272 | <xsl:with-param name="p" select="$this-p"/>\r | |
1273 | </xsl:apply-templates>\r | |
1274 | </xsl:for-each>\r | |
1275 | <xsl:if test="$this-p < $p"><mml:mo>)</mml:mo></xsl:if>\r | |
1276 | </mml:mrow>\r | |
1277 | </xsl:template>\r | |
1278 | \r | |
1279 | <xsl:template name="binary" >\r | |
1280 | <xsl:param name="mo"/>\r | |
1281 | <xsl:param name="p" select="0"/>\r | |
1282 | <xsl:param name="this-p" select="0"/>\r | |
1283 | <mml:mrow>\r | |
1284 | <xsl:if test="$this-p < $p"><mml:mo>(</mml:mo></xsl:if>\r | |
1285 | <xsl:apply-templates mode="c2p" select="*[2]">\r | |
1286 | <xsl:with-param name="p" select="$this-p"/>\r | |
1287 | </xsl:apply-templates>\r | |
1288 | <xsl:copy-of select="$mo"/>\r | |
1289 | <xsl:apply-templates mode="c2p" select="*[3]">\r | |
1290 | <xsl:with-param name="p" select="$this-p"/>\r | |
1291 | </xsl:apply-templates>\r | |
1292 | <xsl:if test="$this-p < $p"><mml:mo>)</mml:mo></xsl:if>\r | |
1293 | </mml:mrow>\r | |
1294 | </xsl:template>\r | |
1295 | \r | |
1296 | <xsl:template name="set" >\r | |
1297 | <xsl:param name="o" select="'{'"/>\r | |
1298 | <xsl:param name="c" select="'}'"/>\r | |
1299 | <mml:mrow>\r | |
1300 | <mml:mo><xsl:value-of select="$o"/></mml:mo>\r | |
1301 | <xsl:choose>\r | |
1302 | <xsl:when test="mml:condition">\r | |
1303 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:bvar/*[not(self::bvar or self::condition)]"/></mml:mrow>\r | |
1304 | <mml:mo>|</mml:mo>\r | |
1305 | <mml:mrow><xsl:apply-templates mode="c2p" select="mml:condition/node()"/></mml:mrow>\r | |
1306 | </xsl:when>\r | |
1307 | <xsl:otherwise>\r | |
1308 | <xsl:for-each select="*">\r | |
1309 | <xsl:apply-templates mode="c2p" select="."/>\r | |
1310 | <xsl:if test="position() !=last()"><mml:mo>,</mml:mo></xsl:if>\r | |
1311 | </xsl:for-each>\r | |
1312 | </xsl:otherwise>\r | |
1313 | </xsl:choose>\r | |
1314 | <mml:mo><xsl:value-of select="$c"/></mml:mo>\r | |
1315 | </mml:mrow>\r | |
1316 | </xsl:template>\r | |
1317 | \r | |
1318 | </xsl:stylesheet>\r | |
1319 | \r |