summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex4ht/xtpipes/oo-math.4xt
blob: d6864098d72d1a71543211d72cfeb8032fd8bcb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE xtpipes SYSTEM "xtpipes.dtd" >
<xtpipes preamble="yes" signature="oo-math.4xt (2008-06-15-00:45)">
   <sax content-handler="xtpipes.util.ScriptsManager,tex4ht.OomFilter"
        lexical-handler="xtpipes.util.ScriptsManagerLH" >
      <script element="math:mtable" >
         <dom name="." xml="." method="mtable" class="tex4ht.OoUtilities" />

      </script>
      <script element="math:math" >
         <set name="math:mo" >
   <![CDATA[
   <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:math="http://www.w3.org/1998/Math/MathML"
      xmlns:xlink="http://www.w3.org/1999/xlink"
   >
      <xsl:output omit-xml-declaration = "yes" />

   <xsl:template match=" math:mo" >
   <xsl:choose>
     <xsl:when test="
   (preceding-sibling::math:mn or preceding-sibling::math:mi)
   and not(following-sibling::*)
" >
   <math:mtext>
      <xsl:apply-templates select="*|@*|text()" />
   </math:mtext>
</xsl:when>
<xsl:when test="
   not((preceding-sibling::*) or following-sibling::*)
" >
   <math:mtext>
      <xsl:apply-templates select="*|@*|text()" />
   </math:mtext>
</xsl:when>
<xsl:when test="
   (.='{') or (.='}')
" >
   <math:mtext>
      <xsl:apply-templates select="*|@*|text()" />
   </math:mtext>
</xsl:when>
<xsl:when test="  . = '='" >
  <xsl:choose>
     <xsl:when test="   not(preceding-sibling::*)
                     or not(following-sibling::*)
                     or preceding-sibling::*[1] / self::math:mo
     ">
        <math:mtext>
           <xsl:apply-templates select="*|@*|text()" />
        </math:mtext>
     </xsl:when>
     <xsl:otherwise>
        <math:mo>
           <xsl:apply-templates select="*|@*|text()" />
        </math:mo>
     </xsl:otherwise>
  </xsl:choose>

</xsl:when>

     <xsl:when test=" string-length() &gt; 1 " >
   <math:mtext>
      <xsl:value-of select="normalize-space(.)" />
   </math:mtext>
</xsl:when>

     <xsl:otherwise>
        <math:mo>
           <xsl:apply-templates select="@*" />
           <xsl:value-of select="normalize-space(.)" />
        </math:mo>
     </xsl:otherwise>
   </xsl:choose>
   </xsl:template>
         <xsl:template match="*|@*|text()|comment()" >
        <xsl:copy>
          <xsl:apply-templates select="*|@*|text()|comment()" />
        </xsl:copy>
      </xsl:template>
   </xsl:stylesheet>
]]>

</set>
<xslt name="." xml="." xsl="math:mo" />

         
         <set name="math:mspace" >
   <![CDATA[
   <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:math="http://www.w3.org/1998/Math/MathML"
      xmlns:xlink="http://www.w3.org/1999/xlink"
   >
      <xsl:output omit-xml-declaration = "yes" />

   <xsl:template match="math:mspace" >
  <math:mtext>
     <xsl:text> </xsl:text>
  </math:mtext>
</xsl:template>

         <xsl:template match="*|@*|text()|comment()" >
        <xsl:copy>
          <xsl:apply-templates select="*|@*|text()|comment()" />
        </xsl:copy>
      </xsl:template>
   </xsl:stylesheet>
]]>

</set>
<xslt name="." xml="." xsl="math:mspace" />

      </script>
   </sax>
</xtpipes>