Debian Codegraph @

texmf-dist/tex4ht/xtpipes/htspk.4xt

raw
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE xtpipes SYSTEM "xtpipes.dtd" >
3 <xtpipes>
4 <sax content-handler="xtpipes.util.ScriptsManager"
5 lexical-handler="xtpipes.util.ScriptsManagerLH" >
6 <script element="br" >
7 <set name="br" >
8 <![CDATA[
9 <xsl:stylesheet version="1.0"
10 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11 >
12 <xsl:output omit-xml-declaration = "yes" />
13 <xsl:template match="br" >
14 <xsl:copy>
15 <xsl:apply-templates select="@*" />
16 <xsl:comment>.</xsl:comment>
17 </xsl:copy>
18 </xsl:template>
19 <xsl:template match="*|@*|text()|comment()" >
20 <xsl:copy>
21 <xsl:apply-templates select="*|@*|text()|comment()" />
22 </xsl:copy>
23 </xsl:template>
24 </xsl:stylesheet>
25 ]]>
26 </set>
27 <xslt name="." xml="." xsl="br" />
28 </script>
29
30 <script element="span::msup" >
31 <set name="m-sub-sup" >
32 <![CDATA[
33 <xsl:stylesheet version="1.0"
34 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
35 >
36 <xsl:output omit-xml-declaration = "yes" />
37
38 <xsl:template match="span[
39 ((@class = 'msup') or (@class = 'msub')
40 or (@class = 'msubsup'))
41 and
42 not(
43 child::span[ (@class = 'mrow-sub') ]
44 / child::span[ (@class != 'begin-script')
45 and
46 (@class != 'end-script')
47 and
48 (@class != 'mid-script')
49 ]
50 )
51 and
52 not(
53 child::span[ (@class = 'mrow-super') ]
54 / child::span[ (@class != 'begin-script')
55 and
56 (@class != 'end-script')
57 and
58 (@class != 'mid-script')
59 ]
60 )
61 ]" >
62 <xsl:apply-templates select="child::span[
63 @class = 'mrow-base' ]/*" />
64 </xsl:template>
65
66 <xsl:template match="*|@*|text()|comment()" >
67 <xsl:copy>
68 <xsl:apply-templates select="*|@*|text()|comment()" />
69 </xsl:copy>
70 </xsl:template>
71 </xsl:stylesheet>
72 ]]>
73
74 </set>
75 <xslt name="." xml="." xsl="m-sub-sup" />
76 <set name="m-sup-2-3" >
77 <![CDATA[
78 <xsl:stylesheet version="1.0"
79 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
80 >
81 <xsl:output omit-xml-declaration = "yes" />
82
83 <xsl:template match="span[
84 (@class = 'msup')
85 and
86 (normalize-space(
87 child::span[ (@class = 'mrow-super') ]
88 / child::span[ (@class != 'begin-script')
89 and
90 (@class != 'end-script')
91 ]
92 ) = '2')
93 and not(
94 child::span[ (@class = 'mrow-base') ]
95 / child::span[ not( @title = 'speech-extra' ) ]
96 [ position() = last() ]
97 / self::* [ @class = 'mo-op' ]
98 )
99
100 ]" >
101 <xsl:copy>
102 <xsl:apply-templates select="*|@*|text()|comment()"
103 mode="squared" />
104 </xsl:copy>
105 </xsl:template>
106 <xsl:template match="*|@*|text()|comment()"
107 mode="squared" >
108 <xsl:copy>
109 <xsl:choose>
110 <xsl:when test=" @class = 'mrow-super' ">
111 <xsl:apply-templates select="@*" />
112 <span class="mo-op">
113 <xsl:text> squared </xsl:text>
114 </span>
115 </xsl:when>
116 <xsl:otherwise>
117 <xsl:apply-templates select="*|@*|text()|comment()" />
118 </xsl:otherwise>
119 </xsl:choose>
120 </xsl:copy>
121 </xsl:template>
122 <xsl:template match="span[
123 (@class = 'msup')
124 and
125 (normalize-space(
126 child::span[ (@class = 'mrow-super') ]
127 / child::span[ (@class != 'begin-script')
128 and
129 (@class != 'end-script')
130 ]
131 ) = '3')
132 and not(
133 child::span[ (@class = 'mrow-base') ]
134 / child::span[ not( @title = 'speech-extra' ) ]
135 [ position() = last() ]
136 / self::* [ @class = 'mo-op' ]
137 )
138
139 ]" >
140 <xsl:copy>
141 <xsl:apply-templates select="*|@*|text()|comment()"
142 mode="cube" />
143 </xsl:copy>
144 </xsl:template>
145 <xsl:template match="*|@*|text()|comment()"
146 mode="cube" >
147 <xsl:copy>
148 <xsl:choose>
149 <xsl:when test=" @class = 'mrow-super' ">
150 <xsl:apply-templates select="@*" />
151 <span class="mo-op">
152 <xsl:text> cube </xsl:text>
153 </span>
154 </xsl:when>
155 <xsl:otherwise>
156 <xsl:apply-templates select="*|@*|text()|comment()" />
157 </xsl:otherwise>
158 </xsl:choose>
159 </xsl:copy>
160 </xsl:template>
161
162 <xsl:template match="*|@*|text()|comment()" >
163 <xsl:copy>
164 <xsl:apply-templates select="*|@*|text()|comment()" />
165 </xsl:copy>
166 </xsl:template>
167 </xsl:stylesheet>
168 ]]>
169
170 </set>
171 <xslt name="." xml="." xsl="m-sup-2-3" />
172
173 </script>
174 <script element="span::msub" >
175 <set name="m-sub-sup" >
176 <![CDATA[
177 <xsl:stylesheet version="1.0"
178 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
179 >
180 <xsl:output omit-xml-declaration = "yes" />
181
182 <xsl:template match="span[
183 ((@class = 'msup') or (@class = 'msub')
184 or (@class = 'msubsup'))
185 and
186 not(
187 child::span[ (@class = 'mrow-sub') ]
188 / child::span[ (@class != 'begin-script')
189 and
190 (@class != 'end-script')
191 and
192 (@class != 'mid-script')
193 ]
194 )
195 and
196 not(
197 child::span[ (@class = 'mrow-super') ]
198 / child::span[ (@class != 'begin-script')
199 and
200 (@class != 'end-script')
201 and
202 (@class != 'mid-script')
203 ]
204 )
205 ]" >
206 <xsl:apply-templates select="child::span[
207 @class = 'mrow-base' ]/*" />
208 </xsl:template>
209
210 <xsl:template match="*|@*|text()|comment()" >
211 <xsl:copy>
212 <xsl:apply-templates select="*|@*|text()|comment()" />
213 </xsl:copy>
214 </xsl:template>
215 </xsl:stylesheet>
216 ]]>
217
218 </set>
219 <xslt name="." xml="." xsl="m-sub-sup" />
220
221 </script>
222 <script element="span::msubsup" >
223 <set name="subsup-prime" >
224 <![CDATA[
225 <xsl:stylesheet version="1.0"
226 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
227 >
228 <xsl:output omit-xml-declaration = "yes" />
229
230 <xsl:template match="span[
231 (@class = 'msubsup')
232 and
233 (count(
234 child::* [ @class='mrow-super' ]
235 / child::span [ not(@title = 'speech-extra') ] ) = 1)
236 and
237 (count(
238 child::* [ @class='mrow-super' ]
239 / child::span [ not(@title = 'speech-extra') ]
240 / child::span) = 1)
241 and
242 child::* [ @class='mrow-super' ]
243 / child::span [ not(@title = 'speech-extra') ]
244 / child::span[ @class='char' ]
245 / child::span[
246 (@class = 'ch 2032') or (@class = 'ch 2033')
247 or (@class = 'ch 2034')
248 ]
249 ]" >
250 <xsl:copy>
251 <xsl:attribute name="class" >
252 <xsl:text>msub</xsl:text>
253 </xsl:attribute>
254 <span class="mrow-base">
255 <xsl:apply-templates select="
256 *[@class = 'mrow-base'] / *
257 " />
258 <xsl:apply-templates select="
259 *[@class = 'mrow-super']
260 / child::span [ not(@title = 'speech-extra') ]
261 " />
262 </span>
263 <xsl:apply-templates select="*[@class = 'mrow-sub']" />
264 </xsl:copy>
265 </xsl:template>
266
267 <xsl:template match="*|@*|text()|comment()" >
268 <xsl:copy>
269 <xsl:apply-templates select="*|@*|text()|comment()" />
270 </xsl:copy>
271 </xsl:template>
272 </xsl:stylesheet>
273 ]]>
274
275 </set>
276 <xslt name="." xml="." xsl="subsup-prime" />
277
278 <set name="m-sub-sup" >
279 <![CDATA[
280 <xsl:stylesheet version="1.0"
281 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
282 >
283 <xsl:output omit-xml-declaration = "yes" />
284
285 <xsl:template match="span[
286 ((@class = 'msup') or (@class = 'msub')
287 or (@class = 'msubsup'))
288 and
289 not(
290 child::span[ (@class = 'mrow-sub') ]
291 / child::span[ (@class != 'begin-script')
292 and
293 (@class != 'end-script')
294 and
295 (@class != 'mid-script')
296 ]
297 )
298 and
299 not(
300 child::span[ (@class = 'mrow-super') ]
301 / child::span[ (@class != 'begin-script')
302 and
303 (@class != 'end-script')
304 and
305 (@class != 'mid-script')
306 ]
307 )
308 ]" >
309 <xsl:apply-templates select="child::span[
310 @class = 'mrow-base' ]/*" />
311 </xsl:template>
312
313 <xsl:template match="*|@*|text()|comment()" >
314 <xsl:copy>
315 <xsl:apply-templates select="*|@*|text()|comment()" />
316 </xsl:copy>
317 </xsl:template>
318 </xsl:stylesheet>
319 ]]>
320
321 </set>
322 <xslt name="." xml="." xsl="m-sub-sup" />
323
324 <set name="m-subsup-2-3" >
325 <![CDATA[
326 <xsl:stylesheet version="1.0"
327 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
328 >
329 <xsl:output omit-xml-declaration = "yes" />
330
331 <xsl:template match="span[
332 (@class = 'msubsup')
333 and
334 (normalize-space(
335 child::span[ (@class = 'mrow-super') ]
336 / child::span[ (@class != 'mid-script')
337 and
338 (@class != 'end-script')
339 ]
340 ) = '2')
341 and not(
342 child::span[ (@class = 'mrow-base') ]
343 / child::span[ not( @title = 'speech-extra' ) ]
344 [ position() = last() ]
345 / self::* [ @class = 'mo-op' ]
346 )
347
348 ]" >
349 <xsl:copy>
350 <xsl:attribute name="class" >
351 <xsl:text>msub</xsl:text>
352 </xsl:attribute>
353 <xsl:apply-templates select="*|text()|comment()"
354 mode="sub-squared" />
355 </xsl:copy>
356 </xsl:template>
357 <xsl:template match="*|@*|text()|comment()"
358 mode="sub-squared" >
359 <xsl:copy>
360 <xsl:choose>
361 <xsl:when test=" @class = 'mrow-sub' ">
362 <xsl:apply-templates select="*[
363 not( @class = 'end-script' )
364 ]
365 |@*|text()|comment()" />
366 <xsl:apply-templates select="
367 following-sibling::*[1] / *[
368 @class = 'end-script'
369 ] " />
370 </xsl:when>
371 <xsl:when test=" @class = 'mrow-super' ">
372 <xsl:attribute name="class" >
373 <xsl:text>squared-super</xsl:text>
374 </xsl:attribute>
375 <span class="mo-op">
376 <xsl:text> squared </xsl:text>
377 </span>
378 </xsl:when>
379 <xsl:otherwise>
380 <xsl:apply-templates select="*|@*|text()|comment()" />
381 </xsl:otherwise>
382 </xsl:choose>
383 </xsl:copy>
384 </xsl:template>
385 <xsl:template match="span[
386 (@class = 'msubsup')
387 and
388 (normalize-space(
389 child::span[ (@class = 'mrow-super') ]
390 / child::span[ (@class != 'mid-script')
391 and
392 (@class != 'end-script')
393 ]
394 ) = '3')
395 and not(
396 child::span[ (@class = 'mrow-base') ]
397 / child::span[ not( @title = 'speech-extra' ) ]
398 [ position() = last() ]
399 / self::* [ @class = 'mo-op' ]
400 )
401
402 ]" >
403 <xsl:copy>
404 <xsl:attribute name="class" >
405 <xsl:text>msub</xsl:text>
406 </xsl:attribute>
407 <xsl:apply-templates select="*|text()|comment()"
408 mode="sub-cube" />
409 </xsl:copy>
410 </xsl:template>
411 <xsl:template match="*|@*|text()|comment()"
412 mode="sub-cube" >
413 <xsl:copy>
414 <xsl:choose>
415 <xsl:when test=" @class = 'mrow-sub' ">
416 <xsl:apply-templates select="*[
417 not( @class = 'end-script' )
418 ]
419 |@*|text()|comment()" />
420 <xsl:apply-templates select="
421 following-sibling::*[1] / *[
422 @class = 'end-script'
423 ] " />
424 </xsl:when>
425 <xsl:when test=" @class = 'mrow-super' ">
426 <xsl:attribute name="class" >
427 <xsl:text>cube-super</xsl:text>
428 </xsl:attribute>
429 <span class="mo-op">
430 <xsl:text> cube </xsl:text>
431 </span>
432 </xsl:when>
433 <xsl:otherwise>
434 <xsl:apply-templates select="*|@*|text()|comment()" />
435 </xsl:otherwise>
436 </xsl:choose>
437 </xsl:copy>
438 </xsl:template>
439
440 <xsl:template match="*|@*|text()|comment()" >
441 <xsl:copy>
442 <xsl:apply-templates select="*|@*|text()|comment()" />
443 </xsl:copy>
444 </xsl:template>
445 </xsl:stylesheet>
446 ]]>
447
448 </set>
449 <xslt name="." xml="." xsl="m-subsup-2-3" />
450
451 </script>
452
453 <script element="span::mfrac" >
454 <set name="mfrac" >
455 <![CDATA[
456 <xsl:stylesheet version="1.0"
457 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
458 >
459 <xsl:output omit-xml-declaration = "yes" />
460
461 <xsl:template match="span[ @class = 'mfrac' ]" >
462 <xsl:copy>
463 <xsl:choose>
464 <xsl:when test="
465 (string-length(
466 normalize-space(child::span[ @class = 'mrow-numerator' ][1])
467 ) = 1)
468 and
469 (string-length(
470 normalize-space(child::span[ @class = 'mrow-enumerator' ][1])
471 ) = 1)
472 ">
473 <xsl:variable name="a">
474 <xsl:value-of select="
475 normalize-space(child::span[ @class = 'mrow-numerator' ][1])
476 " />
477 </xsl:variable>
478 <xsl:variable name="b">
479 <xsl:value-of select="
480 normalize-space(child::span[ @class = 'mrow-enumerator' ][1])
481 " />
482 </xsl:variable>
483
484 <xsl:choose>
485 <xsl:when test="
486 (translate($a,'123456789','') != '')
487 or
488 (translate($b,'123456789','') != '')
489 " >
490 <xsl:apply-templates select="*|@*|text()|comment()" />
491 </xsl:when>
492 <xsl:when test=" $a &lt; $b ">
493 <xsl:attribute name="class">
494 <xsl:text>word-frac</xsl:text>
495 </xsl:attribute>
496 <xsl:choose>
497 <xsl:when test=" $a = 1 "><xsl:text> one </xsl:text></xsl:when>
498 <xsl:when test=" $a = 2 "><xsl:text> two </xsl:text></xsl:when>
499 <xsl:when test=" $a = 3 "><xsl:text> three </xsl:text></xsl:when>
500 <xsl:when test=" $a = 4 "><xsl:text> four </xsl:text></xsl:when>
501 <xsl:when test=" $a = 5 "><xsl:text> five </xsl:text></xsl:when>
502 <xsl:when test=" $a = 6 "><xsl:text> six </xsl:text></xsl:when>
503 <xsl:when test=" $a = 7 "><xsl:text> seven </xsl:text></xsl:when>
504 <xsl:when test=" $a = 8 "><xsl:text> eight </xsl:text></xsl:when>
505 <xsl:when test=" $a = 9 "><xsl:text> nine </xsl:text></xsl:when>
506 </xsl:choose>
507
508 <xsl:choose>
509 <xsl:when test=" $b = 2 "><xsl:text> half</xsl:text></xsl:when>
510 <xsl:when test=" $b = 3 "><xsl:text> third</xsl:text></xsl:when>
511 <xsl:when test=" $b = 4 "><xsl:text> fourth</xsl:text></xsl:when>
512 <xsl:when test=" $b = 5 "><xsl:text> fifth</xsl:text></xsl:when>
513 <xsl:when test=" $b = 6 "><xsl:text> sixth</xsl:text></xsl:when>
514 <xsl:when test=" $b = 7 "><xsl:text> seventh</xsl:text></xsl:when>
515 <xsl:when test=" $b = 8 "><xsl:text> eighth</xsl:text></xsl:when>
516 <xsl:when test=" $b = 9 "><xsl:text> nineth</xsl:text></xsl:when>
517 </xsl:choose>
518 <xsl:if test=" $a &gt; 1 "><xsl:text>s</xsl:text></xsl:if>
519 <xsl:text> </xsl:text>
520
521 </xsl:when>
522 <xsl:otherwise>
523 <xsl:apply-templates select="*|@*|text()|comment()" />
524 </xsl:otherwise>
525 </xsl:choose>
526 </xsl:when>
527
528 <xsl:when test="
529 (@class = 'mfrac')
530 and
531 child::span[ @class = 'mrow-enumerator' ]
532 / child::span[ @class = 'continuous-mfrac' ]
533 and
534 ( normalize-space(
535 child::span[ @class = 'mrow-numerator' ]
536 )
537 =
538 normalize-space(
539 child::span[ @class = 'mrow-enumerator' ]
540 / child::span[ @class = 'continuous-mfrac' ]
541 / child::span[ @class = 'mrow-numerator' ]
542 )
543 )
544 and (
545 normalize-space(
546 child::span[ @class = 'mrow-enumerator' ] /
547 child::span[ @class = 'mfrac' ] /
548 preceding-sibling::*[1] )
549 =
550 normalize-space(
551 child::span[ @class = 'mrow-enumerator' ] /
552 child::span[ @class = 'mfrac' ] /
553 child::span[ @class = 'mrow-enumerator' ] /
554 child::span[ @class = 'continuous-mfrac' ] /
555 preceding-sibling::*[1] )
556 )
557
558 " >
559 <xsl:variable name="a">
560 <xsl:apply-templates select="
561 child::span[ @class = 'mrow-enumerator' ] /
562 child::span[ @class = 'mcontinuous-mfrac' ] /
563 preceding-sibling::*[2]
564 " mode="enum-op" />
565 </xsl:variable>
566 <xsl:variable name="b">
567 <xsl:apply-templates select="
568 child::span[ @class = 'mrow-enumerator' ] /
569 child::span[ @class = 'mcontinuous-mfrac' ] /
570 child::span[ @class = 'mrow-enumerator' ] /
571 child::span[
572 (@class = 'mfrac') or (@class = 'mcontinuous-mfrac')
573 ] /
574 preceding-sibling::*[2]
575 " mode="enum-op" />
576 </xsl:variable>
577
578 <xsl:choose>
579 <xsl:when test="
580 normalize-space($a)=normalize-space($b)
581 " >
582 <xsl:attribute name="class">
583 <xsl:value-of select=" 'continuous-mfrac' " />
584 </xsl:attribute>
585 <xsl:apply-templates select="*|text()|comment()" />
586 </xsl:when>
587 <xsl:otherwise>
588 <xsl:apply-templates select="*|@*|text()|comment()" />
589 </xsl:otherwise>
590 </xsl:choose>
591 </xsl:when>
592
593 <xsl:when test="
594 (translate(
595 normalize-space(
596 child::span[ @class = 'mrow-numerator' ]),
597 '0123456789','')= '')
598 and ( normalize-space(
599 child::span[ @class = 'mrow-numerator' ])
600 and
601 normalize-space(
602 child::span[ @class = 'mrow-enumerator' ] /
603 child::span[ @class = 'mfrac' ] /
604 child::span[ @class = 'mrow-numerator' ])
605 )
606 and
607 ( normalize-space(
608 child::span[ @class = 'mrow-enumerator' ] /
609 child::span[ @class = 'mfrac' ] /
610 child::span[ @class = 'mrow-numerator' ])
611 and
612 normalize-space(
613 child::span[ @class = 'mrow-enumerator' ] /
614 child::span[ @class = 'mfrac' ] /
615 child::span[ @class = 'mrow-enumerator' ] /
616 child::span[ @class = 'mfrac' ] /
617 child::span[ @class = 'mrow-numerator' ])
618 )
619
620 and ( child::span[ @class = 'mrow-enumerator' ] /
621 child::span[ @class = 'mfrac' ] /
622 preceding-sibling::*[1][@class = 'mo-bin']
623 )
624 and
625 ( normalize-space(
626 child::span[ @class = 'mrow-enumerator' ] /
627 child::span[ @class = 'mfrac' ] /
628 preceding-sibling::*[1] )
629 =
630 normalize-space(
631 child::span[ @class = 'mrow-enumerator' ] /
632 child::span[ @class = 'mfrac' ] /
633 child::span[ @class = 'mrow-enumerator' ] /
634 child::span[ @class = 'mfrac' ] /
635 preceding-sibling::*[1] )
636 )
637
638 ">
639 <xsl:variable name="a">
640 <xsl:apply-templates select="
641 child::span[ @class = 'mrow-enumerator' ] /
642 child::span[ @class = 'mfrac' ] /
643 preceding-sibling::*[2]
644 " mode="enum-op" />
645 </xsl:variable>
646 <xsl:variable name="b">
647 <xsl:apply-templates select="
648 child::span[ @class = 'mrow-enumerator' ] /
649 child::span[ @class = 'mfrac' ] /
650 child::span[ @class = 'mrow-enumerator' ] /
651 child::span[ @class = 'mfrac' ] /
652 preceding-sibling::*[2]
653 " mode="enum-op" />
654 </xsl:variable>
655 <xsl:variable name="c">
656 <xsl:value-of select="
657 normalize-space(
658 child::span[ @class = 'mrow-enumerator' ] /
659 child::span[ @class = 'mfrac' ] /
660 child::span[ @class = 'mrow-enumerator' ] /
661 child::span[ @class = 'mfrac' ] /
662 child::span[ @class = 'mrow-enumerator' ] )
663 " />
664 </xsl:variable>
665
666 <xsl:choose>
667 <xsl:when test="
668 ( translate($a,'0123456789 ','') = '')
669 and (normalize-space($a)=normalize-space($b))
670 and starts-with( $c, normalize-space( $a ))
671 and starts-with(
672 normalize-space(
673 substring-after( $c, normalize-space( $a )) )
674 ,
675 normalize-space(
676 child::span[ @class = 'mrow-enumerator' ] /
677 child::span[ @class = 'mfrac' ] /
678 preceding-sibling::*[1] )
679 )
680 " >
681 <xsl:attribute name="class">
682 <xsl:value-of select=" 'continuous-mfrac' " />
683 </xsl:attribute>
684 <xsl:apply-templates select="*|text()|comment()" />
685 </xsl:when>
686 <xsl:otherwise>
687 <xsl:apply-templates select="*|@*|text()|comment()" />
688 </xsl:otherwise>
689 </xsl:choose>
690 </xsl:when>
691
692 <xsl:otherwise>
693 <xsl:apply-templates select="*|@*|text()|comment()" />
694 </xsl:otherwise>
695 </xsl:choose>
696 </xsl:copy>
697 </xsl:template>
698 <xsl:template match="*" mode="enum-op">
699 <xsl:if test="preceding-sibling::*" >
700 <xsl:apply-templates select=" preceding-sibling::*[1] " />
701 </xsl:if>
702 <xsl:value-of select="." />
703 </xsl:template>
704
705 <xsl:template match="*|@*|text()|comment()" >
706 <xsl:copy>
707 <xsl:apply-templates select="*|@*|text()|comment()" />
708 </xsl:copy>
709 </xsl:template>
710 </xsl:stylesheet>
711 ]]>
712
713 </set>
714 <xslt name="." xml="." xsl="mfrac" />
715 </script>
716
717 <script element="span::munder-underline" >
718 <set name="munder" >
719 <![CDATA[
720 <xsl:stylesheet version="1.0"
721 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
722 >
723 <xsl:output omit-xml-declaration = "yes" />
724
725 <xsl:template match="*" mode="content" >
726 <xsl:choose>
727 <xsl:when test=" @class = 'char' " >
728 <xsl:text>x</xsl:text>
729 </xsl:when>
730 <xsl:when test=" not(
731 (@title = 'speech-extra') or (@class = 'accent-char')
732 ) " >
733 <xsl:apply-templates select="*|text()" mode="content" />
734 </xsl:when>
735 </xsl:choose>
736 </xsl:template>
737
738 <xsl:template match="span[
739 (@class = 'munder-underline')
740 and
741 child::span[
742 (@class = 'mo-0332')
743 and
744 descendant::span[ @class = 'mi' ]
745 ]
746 ]" >
747 <xsl:copy>
748 <xsl:apply-templates select="@*" />
749 <xsl:variable name="content">
750 <xsl:apply-templates select="*" mode="content" />
751 </xsl:variable>
752 <xsl:choose>
753 <xsl:when test="
754 string-length( normalize-space( $content )) = 1
755 " >
756 <xsl:apply-templates
757 select=" *[ @class != 'begin-end' ] " />
758 <span class="begin-end" title="speech-extra" >
759 <xsl:text> under bar </xsl:text>
760 </span>
761 </xsl:when>
762 <xsl:otherwise>
763 <xsl:apply-templates select="*|text()|comment()" />
764 </xsl:otherwise>
765 </xsl:choose>
766 </xsl:copy>
767 </xsl:template>
768
769 <xsl:template match="*|@*|text()|comment()" >
770 <xsl:copy>
771 <xsl:apply-templates select="*|@*|text()|comment()" />
772 </xsl:copy>
773 </xsl:template>
774 </xsl:stylesheet>
775 ]]>
776
777 </set>
778 <xslt name="." xml="." xsl="munder" />
779 </script>
780 <script element="span::mover-overline" >
781 <set name="mover" >
782 <![CDATA[
783 <xsl:stylesheet version="1.0"
784 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
785 >
786 <xsl:output omit-xml-declaration = "yes" />
787
788 <xsl:template match="*" mode="content" >
789 <xsl:choose>
790 <xsl:when test=" @class = 'char' " >
791 <xsl:text>x</xsl:text>
792 </xsl:when>
793 <xsl:when test=" not(
794 (@title = 'speech-extra') or (@class = 'accent-char')
795 ) " >
796 <xsl:apply-templates select="*|text()" mode="content" />
797 </xsl:when>
798 </xsl:choose>
799 </xsl:template>
800
801 <xsl:template match="span[
802 (@class = 'mover-overline')
803 and
804 child::span[
805 (@class = 'mo-00AF')
806 and
807 descendant::span[ @class = 'mi' ]
808 ]
809 ]" >
810 <xsl:copy>
811 <xsl:apply-templates select="@*" />
812 <xsl:variable name="content">
813 <xsl:apply-templates select="*" mode="content" />
814 </xsl:variable>
815 <xsl:choose>
816 <xsl:when test="
817 string-length( normalize-space( $content )) = 1
818 " >
819 <xsl:apply-templates
820 select=" *[ @class != 'begin-end' ] " />
821 <span class="begin-end" title="speech-extra" >
822 <xsl:text> over bar </xsl:text>
823 </span>
824 </xsl:when>
825 <xsl:otherwise>
826 <xsl:apply-templates select="*|text()|comment()" />
827 </xsl:otherwise>
828 </xsl:choose>
829 </xsl:copy>
830 </xsl:template>
831
832 <xsl:template match="*|@*|text()|comment()" >
833 <xsl:copy>
834 <xsl:apply-templates select="*|@*|text()|comment()" />
835 </xsl:copy>
836 </xsl:template>
837 </xsl:stylesheet>
838 ]]>
839
840 </set>
841 <xslt name="." xml="." xsl="mover" />
842 </script>
843
844 <script element="span::limits-msub-msup" >
845 <set name="smash" >
846 <![CDATA[
847 <xsl:stylesheet version="1.0"
848 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
849 >
850 <xsl:output omit-xml-declaration = "yes" />
851
852 <xsl:template match="span[
853 (@class = 'limits-msub-msup')
854 and
855 child::*[ (position() = 1)
856 and (@class = 'limits-mrow-base')
857 and child::*[ (position() = 1)
858 and (@class = 'limits-msub-msup')
859 ] ]
860 ]" >
861 <xsl:copy>
862 <xsl:apply-templates select="@*" />
863 <xsl:apply-templates select="
864 *[1]
865 / *[1]
866 / *[ not(@class='limits-mrow-super') ] " />
867 <xsl:apply-templates select=" *[
868 preceding-sibling::*
869 and
870 not(@class='limits-mrow-super') ]" />
871 <xsl:apply-templates select="
872 *[1]
873 / *[1]
874 / *[@class='limits-mrow-super' ] " />
875 <xsl:apply-templates select=" *[
876 preceding-sibling::*
877 and
878 (@class='limits-mrow-super') ]" />
879 </xsl:copy>
880 </xsl:template>
881
882 <xsl:template match="*|@*|text()|comment()" >
883 <xsl:copy>
884 <xsl:apply-templates select="*|@*|text()|comment()" />
885 </xsl:copy>
886 </xsl:template>
887 </xsl:stylesheet>
888 ]]>
889
890 </set>
891 <xslt name="." xml="." xsl="smash" />
892 </script>
893
894 <script element="span::mathvariant-bold" >
895 <set name="bold" >
896 <![CDATA[
897 <xsl:stylesheet version="1.0"
898 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
899 >
900 <xsl:output omit-xml-declaration = "yes" />
901
902 <xsl:template match="*" mode="content" >
903 <xsl:choose>
904 <xsl:when test=" @class = 'char' " >
905 <xsl:text>x</xsl:text>
906 </xsl:when>
907 <xsl:when test=" not(
908 (@title = 'speech-extra') or (@class = 'accent-char')
909 ) " >
910 <xsl:apply-templates select="*|text()" mode="content" />
911 </xsl:when>
912 </xsl:choose>
913 </xsl:template>
914
915 <xsl:template match="span[ @class = 'mathvariant-bold' ]" >
916 <xsl:copy>
917 <xsl:apply-templates select="@*" />
918 <xsl:variable name="content">
919 <xsl:apply-templates select="*" mode="content" />
920 </xsl:variable>
921 <xsl:choose>
922 <xsl:when test="
923 string-length( normalize-space( $content )) = 1
924 " >
925 <span class="begin-end" title="speech-extra" >
926 <xsl:text> bold </xsl:text>
927 </span>
928 <xsl:apply-templates select="*|text()|comment()" />
929 </xsl:when>
930 <xsl:otherwise>
931 <span class="begin-end" title="speech-extra" >
932 <xsl:text> begin bold </xsl:text>
933 </span>
934 <xsl:apply-templates select="*|text()|comment()" />
935 <span class="begin-end" title="speech-extra" >
936 <xsl:text> end bold </xsl:text>
937 </span>
938 </xsl:otherwise>
939 </xsl:choose>
940 </xsl:copy>
941 </xsl:template>
942
943 <xsl:template match="*|@*|text()|comment()" >
944 <xsl:copy>
945 <xsl:apply-templates select="*|@*|text()|comment()" />
946 </xsl:copy>
947 </xsl:template>
948 </xsl:stylesheet>
949 ]]>
950
951 </set>
952 <xslt name="." xml="." xsl="bold" />
953 </script>
954
955 <script element="span::mi" >
956 <set name="math-cap" >
957 <![CDATA[
958 <xsl:stylesheet version="1.0"
959 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
960 >
961 <xsl:output omit-xml-declaration = "yes" />
962
963 <xsl:template match="span[ @class = 'mi' ]" >
964 <xsl:copy>
965 <xsl:apply-templates select="@*" />
966 <xsl:if test=" string-length(.) = 1 " >
967 <xsl:if test="
968 (translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
969 '') = '' )
970 " >
971 <span class="capital-description"
972 title="speech-extra" >
973 <xsl:text> capital </xsl:text>
974 </span>
975 </xsl:if>
976 </xsl:if>
977 <xsl:apply-templates select="*|text()|comment()" />
978 </xsl:copy>
979 </xsl:template>
980
981 <xsl:template match="*|@*|text()|comment()" >
982 <xsl:copy>
983 <xsl:apply-templates select="*|@*|text()|comment()" />
984 </xsl:copy>
985 </xsl:template>
986 </xsl:stylesheet>
987 ]]>
988
989 </set>
990 <xslt name="." xml="." xsl="math-cap" />
991 </script>
992
993 <script element="div::tr" >
994 <set name="bold" >
995 <![CDATA[
996 <xsl:stylesheet version="1.0"
997 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
998 >
999 <xsl:output omit-xml-declaration = "yes" />
1000
1001 <xsl:template match="div[
1002 parent::div[ @class = 'tr' ]
1003 and ( normalize-space(.) = '' )
1004 and not( normalize-space(following-sibling::*) != '' )
1005 ]" >
1006 </xsl:template>
1007
1008 <xsl:template match="*|@*|text()|comment()" >
1009 <xsl:copy>
1010 <xsl:apply-templates select="*|@*|text()|comment()" />
1011 </xsl:copy>
1012 </xsl:template>
1013 </xsl:stylesheet>
1014 ]]>
1015
1016 </set>
1017 <xslt name="." xml="." xsl="bold" />
1018 </script>
1019
1020 <script element="span::inline-math" >
1021 <set name="num-sub" >
1022 <![CDATA[
1023 <xsl:stylesheet version="1.0"
1024 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1025 >
1026 <xsl:output omit-xml-declaration = "yes" />
1027
1028 <xsl:template match="span[
1029 (@class = 'msub')
1030 and
1031 (count( child::span[ @class = 'mrow-base' ]
1032 / child::* ) = 1 )
1033 and not( ancestor::*[
1034 (@class = 'msub')
1035 or
1036 (@class = 'msup')
1037 or
1038 (@class = 'msubsup')
1039 ] )
1040 and
1041 not( child::span[ @class = 'mrow-sub' ]
1042 / child::* [
1043 not( @title = 'speech-extra' )
1044 and
1045 not( @class = 'mn' )
1046 and
1047 not(
1048 (@class = 'mo-punc')
1049 and
1050 ( . = ',' )
1051 and
1052 preceding-sibling::*[1][ @class = 'mn' ]
1053 and
1054 following-sibling::*[1][ @class = 'mn' ]
1055 and
1056 following-sibling::*[2][ @class = 'mn' ]
1057 and
1058 following-sibling::*[3][ @class = 'mn' ]
1059 and
1060 ( not(following-sibling::*[4])
1061 or
1062 not(following-sibling::*[4][ @class = 'mn' ])
1063 )
1064 )
1065 and
1066 not(
1067 (@class = 'mo-punc')
1068 and
1069 ( . = '.' )
1070 and
1071 following-sibling::*[1][ @class = 'mn' ]
1072 and
1073 not(
1074 following-sibling::*[
1075 (@class = 'mo-punc')
1076 and
1077 (. = '.')
1078 ]
1079 )
1080 )
1081 ])
1082 ]" >
1083 <xsl:copy>
1084 <xsl:apply-templates select="@*" />
1085 <xsl:apply-templates select="*[1]" />
1086 <span class="mrow-sub">
1087 <span class="space" title="speech-extra">
1088 <xsl:text> </xsl:text>
1089 </span>
1090 <xsl:apply-templates
1091 select="*[2] / *[
1092 not(@title = 'speech-extra')
1093 and
1094 not(
1095 (@class = 'mo-punc')
1096 and (. = ',')
1097 )
1098 ]" />
1099 </span>
1100 </xsl:copy>
1101 </xsl:template>
1102
1103 <xsl:template match="*|@*|text()|comment()" >
1104 <xsl:copy>
1105 <xsl:apply-templates select="*|@*|text()|comment()" />
1106 </xsl:copy>
1107 </xsl:template>
1108 </xsl:stylesheet>
1109 ]]>
1110
1111 </set>
1112 <xslt name="." xml="." xsl="num-sub" />
1113
1114 <dom name="." xml="." method="fracLevel" class="tex4ht.HtSpk" />
1115 <set name="rmXmlDecl" >
1116 <![CDATA[
1117 <xsl:stylesheet version="1.0"
1118 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1119 >
1120 <xsl:output omit-xml-declaration = "yes" />
1121
1122 <xsl:template match="*|@*|text()|comment()" >
1123 <xsl:copy>
1124 <xsl:apply-templates select="*|@*|text()|comment()" />
1125 </xsl:copy>
1126 </xsl:template>
1127 </xsl:stylesheet>
1128 ]]>
1129
1130 </set>
1131 <xslt name="." xml="." xsl="rmXmlDecl" />
1132
1133
1134 <dom name="." xml="." method="scriptLevel" class="tex4ht.HtSpk" />
1135 <set name="rmXmlDecl" >
1136 <![CDATA[
1137 <xsl:stylesheet version="1.0"
1138 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1139 >
1140 <xsl:output omit-xml-declaration = "yes" />
1141
1142 <xsl:template match="*|@*|text()|comment()" >
1143 <xsl:copy>
1144 <xsl:apply-templates select="*|@*|text()|comment()" />
1145 </xsl:copy>
1146 </xsl:template>
1147 </xsl:stylesheet>
1148 ]]>
1149
1150 </set>
1151 <xslt name="." xml="." xsl="rmXmlDecl" />
1152
1153
1154 <dom name="." xml="." method="rootLevel" class="tex4ht.HtSpk" />
1155 <set name="rmXmlDecl" >
1156 <![CDATA[
1157 <xsl:stylesheet version="1.0"
1158 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1159 >
1160 <xsl:output omit-xml-declaration = "yes" />
1161
1162 <xsl:template match="*|@*|text()|comment()" >
1163 <xsl:copy>
1164 <xsl:apply-templates select="*|@*|text()|comment()" />
1165 </xsl:copy>
1166 </xsl:template>
1167 </xsl:stylesheet>
1168 ]]>
1169
1170 </set>
1171 <xslt name="." xml="." xsl="rmXmlDecl" />
1172
1173
1174 <set name="inline-math" >
1175 <![CDATA[
1176 <xsl:stylesheet version="1.0"
1177 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1178 >
1179 <xsl:output omit-xml-declaration = "yes" />
1180
1181 <xsl:template match="*" mode="content" >
1182 <xsl:choose>
1183 <xsl:when test=" @class = 'char' " >
1184 <xsl:text>x</xsl:text>
1185 </xsl:when>
1186 <xsl:when test=" not(
1187 (@title = 'speech-extra') or (@class = 'accent-char')
1188 ) " >
1189 <xsl:apply-templates select="*|text()" mode="content" />
1190 </xsl:when>
1191 </xsl:choose>
1192 </xsl:template>
1193
1194 <xsl:template match="span[
1195 (@class = 'end-script')
1196 and
1197 ancestor::* [ following-sibling::* [
1198 not( @class = 'content-less' )
1199 ]
1200 ][1]
1201 / following-sibling::* [
1202 not( @class = 'content-less' )
1203 ][1]
1204 / self::*
1205 [
1206 (@class = 'end-math')
1207 or
1208 (@class = 'end-script')
1209 or
1210 (@class = 'end-root')
1211 or
1212 (@class = 'end-stack')
1213 or
1214 (@class = 'mid-stack')
1215 or
1216 (@class = 'end-array')
1217 or
1218 (@class = 'tr')
1219 or
1220 (@title = 'implicit-baseline')
1221 ]
1222 ]" >
1223 </xsl:template>
1224
1225 <xsl:template match="span[
1226 ((@class = 'mfrac') and
1227 (translate(
1228 concat(
1229 span[ (@class = 'mrow-numerator')],
1230 span[ (@class = 'mrow-enumerator')]
1231 ) ,'0123456789','') = '')
1232 and
1233 not(descendant::*/descendant::*/descendant::*)
1234 or
1235 (@class = 'word-frac'))
1236 and
1237 preceding-sibling::*[1]
1238 / self::span[ @class = 'mn']
1239 ]" >
1240 <xsl:text> and </xsl:text>
1241 <xsl:copy>
1242 <xsl:apply-templates select="*|@*|text()|comment()" />
1243 </xsl:copy>
1244 </xsl:template>
1245
1246 <xsl:template match="span[
1247 (@class = 'mo-bin')
1248 and
1249 ( preceding-sibling::*[
1250 (position()=1)
1251 and
1252 ( (@title='speech-extra')
1253 or (@class='mo-bin')
1254 or (@class='mo-rel') )
1255 ]
1256 and
1257 (
1258 following-sibling::*[ (@class='mn') or (@class='mi') ]
1259 or
1260 (count(following-sibling::*[
1261 not(@title = 'speech-extra')
1262 ]) = 1)
1263 )
1264 or
1265 not(preceding-sibling::*)
1266 )
1267 and
1268 (normalize-space(.)='minus')
1269 ]" >
1270 <xsl:copy>
1271 <xsl:attribute name="class">
1272 <xsl:text>mo-unary</xsl:text>
1273 </xsl:attribute>
1274 <xsl:apply-templates select="*|text()|comment()"
1275 mode="minus-neg" />
1276 </xsl:copy>
1277 </xsl:template>
1278 <xsl:template match="*|@*|text()|comment()" mode="minus-neg" >
1279 <xsl:copy>
1280 <xsl:apply-templates select="*|@*|text()|comment()"
1281 mode="minus-neg" />
1282 </xsl:copy>
1283 </xsl:template>
1284 <xsl:template match="text()" mode="minus-neg" >
1285 <xsl:choose>
1286 <xsl:when test=" . = 'minus' " >
1287 <xsl:text>negative</xsl:text>
1288 </xsl:when>
1289 <xsl:otherwise>
1290 <xsl:value-of select="." />
1291 </xsl:otherwise>
1292 </xsl:choose>
1293 </xsl:template>
1294
1295 <xsl:template match="span[ @class = 'end-limits-script' ]" >
1296 <xsl:if test=" parent::*[ not(following-sibling::*) ] ">
1297 <xsl:copy>
1298 <xsl:apply-templates select=" @* " />
1299 <xsl:choose>
1300 <xsl:when test="
1301 parent::*[ preceding-sibling::span[
1302 @class != 'limits-mrow-base'
1303 ] ]
1304 " >
1305 <xsl:text> end scripts </xsl:text>
1306 </xsl:when>
1307 <xsl:otherwise>
1308 <xsl:text> end script </xsl:text>
1309 </xsl:otherwise>
1310 </xsl:choose>
1311 </xsl:copy>
1312 </xsl:if>
1313 </xsl:template>
1314 <xsl:template match="span[ @class = 'begin-limits-script' ]" >
1315 <xsl:copy>
1316 <xsl:apply-templates select=" @* " />
1317 <xsl:choose>
1318 <xsl:when test="
1319 parent::*[ @class = 'limits-mrow-super' ]
1320 " >
1321 <xsl:apply-templates
1322 select=" parent::*
1323 / preceding-sibling::*[1] "
1324 mode = "extra-over" />
1325 </xsl:when>
1326 <xsl:when test="
1327 parent::*[ @class = 'limits-mrow-sub' ]
1328 " >
1329 <xsl:apply-templates
1330 select=" parent::*
1331 / preceding-sibling::*[1] "
1332 mode = "extra-under" />
1333 </xsl:when>
1334 </xsl:choose>
1335 <xsl:apply-templates select="*|text()|comment()" />
1336 </xsl:copy>
1337 </xsl:template>
1338 <xsl:template match="*" mode="extra-over" >
1339 <xsl:if test = " self::span[ @class = 'limits-mrow-super' ] " >
1340 <xsl:text> over </xsl:text>
1341 <xsl:apply-templates select=" preceding-sibling::*[1] "
1342 mode = "extra-over" />
1343 </xsl:if>
1344 </xsl:template>
1345 <xsl:template match="*" mode="extra-under" >
1346 <xsl:if test = " self::span[ @class = 'limits-mrow-sub' ] " >
1347 <xsl:text> under </xsl:text>
1348 <xsl:apply-templates select=" preceding-sibling::*[1] "
1349 mode = "extra-under" />
1350 </xsl:if>
1351 </xsl:template>
1352
1353 <xsl:template match="span[
1354 (@class = 'begin-script')
1355 and
1356 following-sibling::*[
1357 child::span / child::span[
1358 (@class = 'ch 2032') or (@class = 'ch 2033')
1359 or (@class = 'ch 2034')
1360 ] ]
1361 ]" >
1362 </xsl:template>
1363 <xsl:template match="span[
1364 (@class = 'end-script')
1365 and
1366 preceding-sibling::*[
1367 child::span / child::span[
1368 (@class = 'ch 2032') or (@class = 'ch 2033')
1369 or (@class = 'ch 2034')
1370 ] ]
1371 ]" >
1372 </xsl:template>
1373
1374
1375 <xsl:template match="span[
1376 (@class = 'inline-math')
1377 and
1378 (count( child::*[ not(@title) or (@title != 'speech-extra') ]
1379 ) = 1)
1380 ]" >
1381 <xsl:copy>
1382 <xsl:variable name="content">
1383 <xsl:apply-templates
1384 select="child::*[ not(@title) or (@title != 'speech-extra') ]
1385 "
1386 mode="content" />
1387 </xsl:variable>
1388 <xsl:choose>
1389 <xsl:when test="
1390 string-length( normalize-space( $content )) = 1
1391 " >
1392 <xsl:attribute name="class">
1393 <xsl:text>semi-math</xsl:text>
1394 </xsl:attribute>
1395 <xsl:apply-templates select="child::*[ not(@title) or (@title != 'speech-extra') ]
1396 " />
1397 </xsl:when>
1398 <xsl:when test=" child::*[
1399 (position() = 2)
1400 and
1401 ((@class = 'msub') or (@class = 'msup') or (@class = 'msubsup'))
1402 ]" >
1403 <xsl:variable name="content">
1404 <xsl:apply-templates select="child::*[2] / child::*[
1405 @class = 'mrow-base' ]"
1406 mode="content" />
1407 </xsl:variable>
1408 <xsl:choose>
1409 <xsl:when test="
1410 string-length( normalize-space( $content )) = 1
1411 " >
1412 <xsl:attribute name="class">
1413 <xsl:text>semi-math</xsl:text>
1414 </xsl:attribute>
1415 <xsl:apply-templates select="*[2]" />
1416
1417 </xsl:when>
1418 <xsl:otherwise>
1419 <xsl:apply-templates select="*|@*|comment()|text()" />
1420 </xsl:otherwise>
1421 </xsl:choose>
1422 </xsl:when>
1423
1424 <xsl:otherwise>
1425 <xsl:apply-templates select="*|@*|comment()|text()" />
1426 </xsl:otherwise>
1427 </xsl:choose>
1428 </xsl:copy>
1429 </xsl:template>
1430
1431 <xsl:template match="*|@*|text()|comment()" >
1432 <xsl:copy>
1433 <xsl:apply-templates select="*|@*|text()|comment()" />
1434 </xsl:copy>
1435 </xsl:template>
1436 </xsl:stylesheet>
1437 ]]>
1438
1439 </set>
1440 <xslt name="." xml="." xsl="inline-math" />
1441 <set name="inline-math-2" >
1442 <![CDATA[
1443 <xsl:stylesheet version="1.0"
1444 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1445 >
1446 <xsl:output omit-xml-declaration = "yes" />
1447
1448 <xsl:template match="*" mode="content" >
1449 <xsl:choose>
1450 <xsl:when test=" @class = 'char' " >
1451 <xsl:text>x</xsl:text>
1452 </xsl:when>
1453 <xsl:when test=" not(
1454 (@title = 'speech-extra') or (@class = 'accent-char')
1455 ) " >
1456 <xsl:apply-templates select="*|text()" mode="content" />
1457 </xsl:when>
1458 </xsl:choose>
1459 </xsl:template>
1460
1461 <xsl:template match="span[
1462 (@class = 'end-script')
1463 and
1464 ancestor::*[ preceding-sibling::* [
1465 ((@class = 'begin-script') or (@class = 'mid-script')) ]]
1466
1467 ]" >
1468 <xsl:copy>
1469 <xsl:apply-templates select="*|@*|comment()" />
1470 <xsl:value-of select="
1471 ancestor::*[ preceding-sibling::* [
1472 ((@class = 'begin-script') or
1473 (@class = 'mid-script')) ]] [1]
1474 / preceding-sibling::* [
1475 ((@class = 'begin-script') or
1476 (@class = 'mid-script')) ][1]
1477 " />
1478 </xsl:copy>
1479 </xsl:template>
1480
1481 <xsl:template match="span[ @class = 'mi' ]" >
1482 <span class="space" title="speech-extra">
1483 <xsl:text> </xsl:text>
1484 </span>
1485 <xsl:copy>
1486 <xsl:apply-templates select="*|@*|text()|comment()" />
1487 </xsl:copy>
1488 </xsl:template>
1489
1490 <xsl:template match="span[
1491 (@class = 'begin-script')
1492 and
1493 following-sibling::* [1] / child::*[
1494 (position() = 1)
1495 and
1496 (@class = 'mrow-base')
1497 and
1498 ( normalize-space(.) = '' )
1499 ]
1500 ]" >
1501 </xsl:template>
1502
1503
1504 <xsl:template match="span[
1505 (@class = 'inline-math')
1506 and
1507 (count( child::*[ not(@title) or (@title != 'speech-extra') ]
1508 ) = 2)
1509 and
1510 child::span[
1511 (@class = 'mo-unary')
1512 and
1513 following-sibling::*[1]
1514 / descendant::span[ @class = 'mi' ]
1515 ]
1516 ]" >
1517 <xsl:copy>
1518 <xsl:variable name="content">
1519 <xsl:apply-templates
1520 select="child::*[
1521 (not(@title) or (@title != 'speech-extra'))
1522 and not( @class = 'mo-unary' )
1523 ]"
1524 mode="content" />
1525 </xsl:variable>
1526 <xsl:choose>
1527 <xsl:when test="
1528 string-length( normalize-space( $content )) = 1
1529 " >
1530 <xsl:attribute name="class">
1531 <xsl:text>semi-math</xsl:text>
1532 </xsl:attribute>
1533 <xsl:apply-templates select="child::*[ not(@title) or (@title != 'speech-extra') ]
1534 " />
1535 </xsl:when>
1536 <xsl:otherwise>
1537 <xsl:apply-templates select="*|@*|comment()|text()" />
1538 </xsl:otherwise>
1539 </xsl:choose>
1540 </xsl:copy>
1541 </xsl:template>
1542
1543 <xsl:template match="*|@*|text()|comment()" >
1544 <xsl:copy>
1545 <xsl:apply-templates select="*|@*|text()|comment()" />
1546 </xsl:copy>
1547 </xsl:template>
1548 </xsl:stylesheet>
1549 ]]>
1550
1551 </set>
1552 <xslt name="." xml="." xsl="inline-math-2" />
1553 <set name="empty-el" >
1554 <![CDATA[
1555 <xsl:stylesheet version="1.0"
1556 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1557 >
1558 <xsl:output omit-xml-declaration = "yes" />
1559
1560 <xsl:template match="*[ not(child::*) ]" >
1561 <xsl:copy>
1562 <xsl:apply-templates select="@*|comment()|text()" />
1563 <xsl:if test=" normalize-space(.) = '' " >
1564 <xsl:comment>.</xsl:comment>
1565 </xsl:if>
1566 </xsl:copy>
1567 </xsl:template>
1568
1569 <xsl:template match="*|@*|text()|comment()" >
1570 <xsl:copy>
1571 <xsl:apply-templates select="*|@*|text()|comment()" />
1572 </xsl:copy>
1573 </xsl:template>
1574 </xsl:stylesheet>
1575 ]]>
1576
1577 </set>
1578 <xslt name="." xml="." xsl="empty-el" />
1579
1580 </script>
1581
1582 <script element="div::display-math" >
1583 <set name="num-sub" >
1584 <![CDATA[
1585 <xsl:stylesheet version="1.0"
1586 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1587 >
1588 <xsl:output omit-xml-declaration = "yes" />
1589
1590 <xsl:template match="span[
1591 (@class = 'msub')
1592 and
1593 (count( child::span[ @class = 'mrow-base' ]
1594 / child::* ) = 1 )
1595 and not( ancestor::*[
1596 (@class = 'msub')
1597 or
1598 (@class = 'msup')
1599 or
1600 (@class = 'msubsup')
1601 ] )
1602 and
1603 not( child::span[ @class = 'mrow-sub' ]
1604 / child::* [
1605 not( @title = 'speech-extra' )
1606 and
1607 not( @class = 'mn' )
1608 and
1609 not(
1610 (@class = 'mo-punc')
1611 and
1612 ( . = ',' )
1613 and
1614 preceding-sibling::*[1][ @class = 'mn' ]
1615 and
1616 following-sibling::*[1][ @class = 'mn' ]
1617 and
1618 following-sibling::*[2][ @class = 'mn' ]
1619 and
1620 following-sibling::*[3][ @class = 'mn' ]
1621 and
1622 ( not(following-sibling::*[4])
1623 or
1624 not(following-sibling::*[4][ @class = 'mn' ])
1625 )
1626 )
1627 and
1628 not(
1629 (@class = 'mo-punc')
1630 and
1631 ( . = '.' )
1632 and
1633 following-sibling::*[1][ @class = 'mn' ]
1634 and
1635 not(
1636 following-sibling::*[
1637 (@class = 'mo-punc')
1638 and
1639 (. = '.')
1640 ]
1641 )
1642 )
1643 ])
1644 ]" >
1645 <xsl:copy>
1646 <xsl:apply-templates select="@*" />
1647 <xsl:apply-templates select="*[1]" />
1648 <span class="mrow-sub">
1649 <span class="space" title="speech-extra">
1650 <xsl:text> </xsl:text>
1651 </span>
1652 <xsl:apply-templates
1653 select="*[2] / *[
1654 not(@title = 'speech-extra')
1655 and
1656 not(
1657 (@class = 'mo-punc')
1658 and (. = ',')
1659 )
1660 ]" />
1661 </span>
1662 </xsl:copy>
1663 </xsl:template>
1664
1665 <xsl:template match="*|@*|text()|comment()" >
1666 <xsl:copy>
1667 <xsl:apply-templates select="*|@*|text()|comment()" />
1668 </xsl:copy>
1669 </xsl:template>
1670 </xsl:stylesheet>
1671 ]]>
1672
1673 </set>
1674 <xslt name="." xml="." xsl="num-sub" />
1675
1676 <dom name="." xml="." method="fracLevel" class="tex4ht.HtSpk" />
1677 <set name="rmXmlDecl" >
1678 <![CDATA[
1679 <xsl:stylesheet version="1.0"
1680 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1681 >
1682 <xsl:output omit-xml-declaration = "yes" />
1683
1684 <xsl:template match="*|@*|text()|comment()" >
1685 <xsl:copy>
1686 <xsl:apply-templates select="*|@*|text()|comment()" />
1687 </xsl:copy>
1688 </xsl:template>
1689 </xsl:stylesheet>
1690 ]]>
1691
1692 </set>
1693 <xslt name="." xml="." xsl="rmXmlDecl" />
1694
1695
1696 <dom name="." xml="." method="scriptLevel" class="tex4ht.HtSpk" />
1697 <set name="rmXmlDecl" >
1698 <![CDATA[
1699 <xsl:stylesheet version="1.0"
1700 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1701 >
1702 <xsl:output omit-xml-declaration = "yes" />
1703
1704 <xsl:template match="*|@*|text()|comment()" >
1705 <xsl:copy>
1706 <xsl:apply-templates select="*|@*|text()|comment()" />
1707 </xsl:copy>
1708 </xsl:template>
1709 </xsl:stylesheet>
1710 ]]>
1711
1712 </set>
1713 <xslt name="." xml="." xsl="rmXmlDecl" />
1714
1715
1716 <dom name="." xml="." method="rootLevel" class="tex4ht.HtSpk" />
1717 <set name="rmXmlDecl" >
1718 <![CDATA[
1719 <xsl:stylesheet version="1.0"
1720 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1721 >
1722 <xsl:output omit-xml-declaration = "yes" />
1723
1724 <xsl:template match="*|@*|text()|comment()" >
1725 <xsl:copy>
1726 <xsl:apply-templates select="*|@*|text()|comment()" />
1727 </xsl:copy>
1728 </xsl:template>
1729 </xsl:stylesheet>
1730 ]]>
1731
1732 </set>
1733 <xslt name="." xml="." xsl="rmXmlDecl" />
1734
1735
1736 <set name="display-math" >
1737 <![CDATA[
1738 <xsl:stylesheet version="1.0"
1739 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1740 >
1741 <xsl:output omit-xml-declaration = "yes" />
1742
1743 <xsl:template match="*" mode="content" >
1744 <xsl:choose>
1745 <xsl:when test=" @class = 'char' " >
1746 <xsl:text>x</xsl:text>
1747 </xsl:when>
1748 <xsl:when test=" not(
1749 (@title = 'speech-extra') or (@class = 'accent-char')
1750 ) " >
1751 <xsl:apply-templates select="*|text()" mode="content" />
1752 </xsl:when>
1753 </xsl:choose>
1754 </xsl:template>
1755
1756 <xsl:template match="span[
1757 (@class = 'end-script')
1758 and
1759 ancestor::* [ following-sibling::* [
1760 not( @class = 'content-less' )
1761 ]
1762 ][1]
1763 / following-sibling::* [
1764 not( @class = 'content-less' )
1765 ][1]
1766 / self::*
1767 [
1768 (@class = 'end-math')
1769 or
1770 (@class = 'end-script')
1771 or
1772 (@class = 'end-root')
1773 or
1774 (@class = 'end-stack')
1775 or
1776 (@class = 'mid-stack')
1777 or
1778 (@class = 'end-array')
1779 or
1780 (@class = 'tr')
1781 or
1782 (@title = 'implicit-baseline')
1783 ]
1784 ]" >
1785 </xsl:template>
1786
1787 <xsl:template match="span[
1788 ((@class = 'mfrac') and
1789 (translate(
1790 concat(
1791 span[ (@class = 'mrow-numerator')],
1792 span[ (@class = 'mrow-enumerator')]
1793 ) ,'0123456789','') = '')
1794 and
1795 not(descendant::*/descendant::*/descendant::*)
1796 or
1797 (@class = 'word-frac'))
1798 and
1799 preceding-sibling::*[1]
1800 / self::span[ @class = 'mn']
1801 ]" >
1802 <xsl:text> and </xsl:text>
1803 <xsl:copy>
1804 <xsl:apply-templates select="*|@*|text()|comment()" />
1805 </xsl:copy>
1806 </xsl:template>
1807
1808 <xsl:template match="span[
1809 (@class = 'mo-bin')
1810 and
1811 ( preceding-sibling::*[
1812 (position()=1)
1813 and
1814 ( (@title='speech-extra')
1815 or (@class='mo-bin')
1816 or (@class='mo-rel') )
1817 ]
1818 and
1819 (
1820 following-sibling::*[ (@class='mn') or (@class='mi') ]
1821 or
1822 (count(following-sibling::*[
1823 not(@title = 'speech-extra')
1824 ]) = 1)
1825 )
1826 or
1827 not(preceding-sibling::*)
1828 )
1829 and
1830 (normalize-space(.)='minus')
1831 ]" >
1832 <xsl:copy>
1833 <xsl:attribute name="class">
1834 <xsl:text>mo-unary</xsl:text>
1835 </xsl:attribute>
1836 <xsl:apply-templates select="*|text()|comment()"
1837 mode="minus-neg" />
1838 </xsl:copy>
1839 </xsl:template>
1840 <xsl:template match="*|@*|text()|comment()" mode="minus-neg" >
1841 <xsl:copy>
1842 <xsl:apply-templates select="*|@*|text()|comment()"
1843 mode="minus-neg" />
1844 </xsl:copy>
1845 </xsl:template>
1846 <xsl:template match="text()" mode="minus-neg" >
1847 <xsl:choose>
1848 <xsl:when test=" . = 'minus' " >
1849 <xsl:text>negative</xsl:text>
1850 </xsl:when>
1851 <xsl:otherwise>
1852 <xsl:value-of select="." />
1853 </xsl:otherwise>
1854 </xsl:choose>
1855 </xsl:template>
1856
1857 <xsl:template match="span[ @class = 'end-limits-script' ]" >
1858 <xsl:if test=" parent::*[ not(following-sibling::*) ] ">
1859 <xsl:copy>
1860 <xsl:apply-templates select=" @* " />
1861 <xsl:choose>
1862 <xsl:when test="
1863 parent::*[ preceding-sibling::span[
1864 @class != 'limits-mrow-base'
1865 ] ]
1866 " >
1867 <xsl:text> end scripts </xsl:text>
1868 </xsl:when>
1869 <xsl:otherwise>
1870 <xsl:text> end script </xsl:text>
1871 </xsl:otherwise>
1872 </xsl:choose>
1873 </xsl:copy>
1874 </xsl:if>
1875 </xsl:template>
1876 <xsl:template match="span[ @class = 'begin-limits-script' ]" >
1877 <xsl:copy>
1878 <xsl:apply-templates select=" @* " />
1879 <xsl:choose>
1880 <xsl:when test="
1881 parent::*[ @class = 'limits-mrow-super' ]
1882 " >
1883 <xsl:apply-templates
1884 select=" parent::*
1885 / preceding-sibling::*[1] "
1886 mode = "extra-over" />
1887 </xsl:when>
1888 <xsl:when test="
1889 parent::*[ @class = 'limits-mrow-sub' ]
1890 " >
1891 <xsl:apply-templates
1892 select=" parent::*
1893 / preceding-sibling::*[1] "
1894 mode = "extra-under" />
1895 </xsl:when>
1896 </xsl:choose>
1897 <xsl:apply-templates select="*|text()|comment()" />
1898 </xsl:copy>
1899 </xsl:template>
1900 <xsl:template match="*" mode="extra-over" >
1901 <xsl:if test = " self::span[ @class = 'limits-mrow-super' ] " >
1902 <xsl:text> over </xsl:text>
1903 <xsl:apply-templates select=" preceding-sibling::*[1] "
1904 mode = "extra-over" />
1905 </xsl:if>
1906 </xsl:template>
1907 <xsl:template match="*" mode="extra-under" >
1908 <xsl:if test = " self::span[ @class = 'limits-mrow-sub' ] " >
1909 <xsl:text> under </xsl:text>
1910 <xsl:apply-templates select=" preceding-sibling::*[1] "
1911 mode = "extra-under" />
1912 </xsl:if>
1913 </xsl:template>
1914
1915 <xsl:template match="span[
1916 (@class = 'begin-script')
1917 and
1918 following-sibling::*[
1919 child::span / child::span[
1920 (@class = 'ch 2032') or (@class = 'ch 2033')
1921 or (@class = 'ch 2034')
1922 ] ]
1923 ]" >
1924 </xsl:template>
1925 <xsl:template match="span[
1926 (@class = 'end-script')
1927 and
1928 preceding-sibling::*[
1929 child::span / child::span[
1930 (@class = 'ch 2032') or (@class = 'ch 2033')
1931 or (@class = 'ch 2034')
1932 ] ]
1933 ]" >
1934 </xsl:template>
1935
1936
1937 <xsl:template match="*|@*|text()|comment()" >
1938 <xsl:copy>
1939 <xsl:apply-templates select="*|@*|text()|comment()" />
1940 </xsl:copy>
1941 </xsl:template>
1942 </xsl:stylesheet>
1943 ]]>
1944
1945 </set>
1946 <xslt name="." xml="." xsl="display-math" />
1947 <set name="display-math-2" >
1948 <![CDATA[
1949 <xsl:stylesheet version="1.0"
1950 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1951 >
1952 <xsl:output omit-xml-declaration = "yes" />
1953
1954 <xsl:template match="*" mode="content" >
1955 <xsl:choose>
1956 <xsl:when test=" @class = 'char' " >
1957 <xsl:text>x</xsl:text>
1958 </xsl:when>
1959 <xsl:when test=" not(
1960 (@title = 'speech-extra') or (@class = 'accent-char')
1961 ) " >
1962 <xsl:apply-templates select="*|text()" mode="content" />
1963 </xsl:when>
1964 </xsl:choose>
1965 </xsl:template>
1966
1967 <xsl:template match="span[
1968 (@class = 'end-script')
1969 and
1970 ancestor::*[ preceding-sibling::* [
1971 ((@class = 'begin-script') or (@class = 'mid-script')) ]]
1972
1973 ]" >
1974 <xsl:copy>
1975 <xsl:apply-templates select="*|@*|comment()" />
1976 <xsl:value-of select="
1977 ancestor::*[ preceding-sibling::* [
1978 ((@class = 'begin-script') or
1979 (@class = 'mid-script')) ]] [1]
1980 / preceding-sibling::* [
1981 ((@class = 'begin-script') or
1982 (@class = 'mid-script')) ][1]
1983 " />
1984 </xsl:copy>
1985 </xsl:template>
1986
1987 <xsl:template match="span[ @class = 'mi' ]" >
1988 <span class="space" title="speech-extra">
1989 <xsl:text> </xsl:text>
1990 </span>
1991 <xsl:copy>
1992 <xsl:apply-templates select="*|@*|text()|comment()" />
1993 </xsl:copy>
1994 </xsl:template>
1995
1996 <xsl:template match="span[
1997 (@class = 'begin-script')
1998 and
1999 following-sibling::* [1] / child::*[
2000 (position() = 1)
2001 and
2002 (@class = 'mrow-base')
2003 and
2004 ( normalize-space(.) = '' )
2005 ]
2006 ]" >
2007 </xsl:template>
2008
2009
2010 <xsl:template match="*|@*|text()|comment()" >
2011 <xsl:copy>
2012 <xsl:apply-templates select="*|@*|text()|comment()" />
2013 </xsl:copy>
2014 </xsl:template>
2015 </xsl:stylesheet>
2016 ]]>
2017
2018 </set>
2019 <xslt name="." xml="." xsl="display-math-2" />
2020 <set name="empty-el" >
2021 <![CDATA[
2022 <xsl:stylesheet version="1.0"
2023 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2024 >
2025 <xsl:output omit-xml-declaration = "yes" />
2026
2027 <xsl:template match="*[ not(child::*) ]" >
2028 <xsl:copy>
2029 <xsl:apply-templates select="@*|comment()|text()" />
2030 <xsl:if test=" normalize-space(.) = '' " >
2031 <xsl:comment>.</xsl:comment>
2032 </xsl:if>
2033 </xsl:copy>
2034 </xsl:template>
2035
2036 <xsl:template match="*|@*|text()|comment()" >
2037 <xsl:copy>
2038 <xsl:apply-templates select="*|@*|text()|comment()" />
2039 </xsl:copy>
2040 </xsl:template>
2041 </xsl:stylesheet>
2042 ]]>
2043
2044 </set>
2045 <xslt name="." xml="." xsl="empty-el" />
2046
2047 </script>
2048
2049
2050 <script element="div::split-side" >
2051 <set name="clean-split" >
2052 <![CDATA[
2053 <xsl:stylesheet version="1.0"
2054 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2055 >
2056 <xsl:output omit-xml-declaration = "yes" />
2057
2058 <xsl:template match="*" mode="content" >
2059 <xsl:choose>
2060 <xsl:when test=" @class = 'char' " >
2061 <xsl:text>x</xsl:text>
2062 </xsl:when>
2063 <xsl:when test=" not(
2064 (@title = 'speech-extra') or (@class = 'accent-char')
2065 ) " >
2066 <xsl:apply-templates select="*|text()" mode="content" />
2067 </xsl:when>
2068 </xsl:choose>
2069 </xsl:template>
2070
2071 <xsl:template match=" div[ @class='split-side' ]
2072 " >
2073 <xsl:variable name="content">
2074 <xsl:apply-templates select="*" mode="content" />
2075 </xsl:variable>
2076 <xsl:if test="
2077 string-length( normalize-space( $content )) != 0
2078 " >
2079 <xsl:copy>
2080 <xsl:apply-templates select=" *|@*|text()|comment() " />
2081 </xsl:copy>
2082 </xsl:if>
2083 </xsl:template>
2084
2085 <xsl:template match="*|@*|text()|comment()" >
2086 <xsl:copy>
2087 <xsl:apply-templates select="*|@*|text()|comment()" />
2088 </xsl:copy>
2089 </xsl:template>
2090 </xsl:stylesheet>
2091 ]]>
2092
2093 </set>
2094 <xslt name="." xml="." xsl="clean-split" />
2095 </script>
2096
2097 <script element="div::newtheorem" >
2098 <set name="newtheorem" >
2099 <![CDATA[
2100 <xsl:stylesheet version="1.0"
2101 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2102 >
2103 <xsl:output omit-xml-declaration = "yes" />
2104
2105 <xsl:template match="
2106 div[ (@class='newtheorem')
2107 and
2108 child::*[1] / child::span[ @class = 'theorem-head' ]
2109 ]
2110 " >
2111 <xsl:copy>
2112 <xsl:apply-templates select="*|@*|text()|comment()" />
2113 <div class="begin-end" title="speech-extra">
2114 <xsl:value-of select="
2115 concat( ' end ',
2116 string( child::*[1] /
2117 child::span[ @class = 'theorem-head' ] )
2118 ) " />
2119 </div>
2120 </xsl:copy>
2121 </xsl:template>
2122
2123 <xsl:template match="*[ not(child::*) ]" >
2124 <xsl:copy>
2125 <xsl:apply-templates select="@*|comment()|text()" />
2126 <xsl:if test=" normalize-space(.) = '' " >
2127 <xsl:comment>.</xsl:comment>
2128 </xsl:if>
2129 </xsl:copy>
2130 </xsl:template>
2131
2132 <xsl:template match="*|@*|text()|comment()" >
2133 <xsl:copy>
2134 <xsl:apply-templates select="*|@*|text()|comment()" />
2135 </xsl:copy>
2136 </xsl:template>
2137 </xsl:stylesheet>
2138 ]]>
2139
2140 </set>
2141 <xslt name="." xml="." xsl="newtheorem" />
2142 </script>
2143
2144 </sax>
2145 </xtpipes>
2146