summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex4ht/xtpipes/xhtmml.4xt
blob: 95bcf6e049a96a1e24d18bb9cc9e7fdd2d6fbad6 (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
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE xtpipes SYSTEM "xtpipes.dtd" >
<xtpipes preamble="yes" signature="xhtmml.4xt (2009-01-20-21:08)">
   <sax content-handler="xtpipes.util.ScriptsManager"
        lexical-handler="xtpipes.util.ScriptsManagerLH" >
     <script element="p" >
   <dom name="." xml="." method="p" class="tex4ht.XhtmmlUtilities" />
</script>
<script element="div" >
   <dom name="." xml="." method="p" class="tex4ht.XhtmmlUtilities" />
</script>

     <script element="li" >
   <dom name="." xml="." method="li" class="tex4ht.XhtmmlUtilities" />
</script>

     <script element="table" >
   <dom name="." xml="." method="table" class="tex4ht.XhtmmlUtilities" />
</script>

     <script element="mrow" >
   <dom name="." xml="." method="mrow" class="tex4ht.XhtmmlUtilities" />
</script>

     <script element="math" >
   <dom name="." xml="." method="math" class="tex4ht.XhtmmlUtilities" />
   <set name="math-mstyle" >
   <![CDATA[
   <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:h="http://www.w3.org/1999/xhtml"
      xmlns:m="http://www.w3.org/1998/Math/MathML"
   >
      <xsl:output omit-xml-declaration = "yes" method="xml" />

   <xsl:template match=" m:* [
      not(self::m:math)
    and
      child::m:mstyle[
           @mathvariant
         and
           child::text()
         and
           (count(child::m:*) = 0)
      ]
    and
      (count(child::m:*) = 1)
    and
      not(@mathvariant)
] " >
  <xsl:copy>
     <xsl:apply-templates select="@*" />
     <xsl:apply-templates select="m:mstyle/@*" />
     <xsl:apply-templates select="m:mstyle/text()" />
  </xsl:copy>
</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-mstyle" />

</script>

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

      <xsl:template match=" m:mstyle [
                  @mathvariant
             and
                  child::m:*[ not(@mathvariant) ]
             and
                  (count(child::m:*) = 1)
] " >
  <xsl:element name="{name(child::m:*[1])}">
    <xsl:attribute name="mathvariant" >
         <xsl:value-of select="@mathvariant" />
    </xsl:attribute>
    <xsl:apply-templates select="child::m:*/@*" />
    <xsl:apply-templates select="
        child::m:*/*
        | child::m:*/text()
        | child::m:*/comment()
      "
    />
  </xsl:element>
</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="mstyle" />
</script>

   </sax>
</xtpipes>