mathtype_to_mathml 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,24 +8,24 @@
8
8
 
9
9
  <xsl:template match="tmpl[selector='tmLIM']">
10
10
  <munder>
11
- <xsl:apply-templates select="slot[1]"/>
12
- <xsl:apply-templates select="slot[2]"/>
11
+ <xsl:apply-templates select="slot[1] | pile[1]"/>
12
+ <xsl:apply-templates select="slot[2] | pile[2]"/>
13
13
  </munder>
14
14
  </xsl:template>
15
15
 
16
16
 
17
17
  <xsl:template match="tmpl[selector='tmLIM' and variation='tvBO_UPPER']">
18
18
  <mover>
19
- <xsl:apply-templates select="slot[1]"/>
20
- <xsl:apply-templates select="slot[3]"/>
19
+ <xsl:apply-templates select="slot[1] | pile[1]"/>
20
+ <xsl:apply-templates select="slot[3] | pile[3]"/>
21
21
  </mover>
22
22
  </xsl:template>
23
23
 
24
24
  <xsl:template match="tmpl[selector='tmLIM' and (variation='tvBO_UPPER' and variation='tvBO_LOWER')]">
25
25
  <munderover>
26
- <xsl:apply-templates select="slot[1]"/>
27
- <xsl:apply-templates select="slot[2]"/>
28
- <xsl:apply-templates select="slot[3]"/>
26
+ <xsl:apply-templates select="slot[1] | pile[1]"/>
27
+ <xsl:apply-templates select="slot[2] | pile[2]"/>
28
+ <xsl:apply-templates select="slot[3] | pile[3]"/>
29
29
  </munderover>
30
30
  </xsl:template>
31
31
 
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
4
+ exclude-result-prefixes="xs"
5
+ version="1.0">
6
+
7
+ <!-- Long division -->
8
+
9
+ <xsl:template match="tmpl[selector='tmLDIV']">
10
+ <mtable>
11
+ <mtr>
12
+ <mtd columnalign="right">
13
+ <xsl:apply-templates select="(slot | pile)[2]"/>
14
+ </mtd>
15
+ </mtr>
16
+ <mtr>
17
+ <mtd columnalign="right">
18
+ <menclose notation="longdiv">
19
+ <xsl:apply-templates select="(slot | pile)[1]"/>
20
+ </menclose>
21
+ </mtd>
22
+ </mtr>
23
+ </mtable>
24
+ </xsl:template>
25
+
26
+ <xsl:template match="tmpl[selector='tmLDIV' and not(variation='tvLD_UPPER')]">
27
+ <menclose notation="longdiv">
28
+ <xsl:apply-templates select="(slot | pile)[1]"/>
29
+ </menclose>
30
+ </xsl:template>
31
+
32
+ </xsl:stylesheet>
@@ -0,0 +1,150 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
4
+ exclude-result-prefixes="xs"
5
+ version="1.0">
6
+
7
+ <!-- Long embellishments -->
8
+
9
+ <xsl:template match="tmpl[selector='tmTILDE']">
10
+ <mover accent="true">
11
+ <xsl:apply-templates select="(slot | pile)[1]"/>
12
+ <mo stretchy="true">&#x2DC;</mo>
13
+ </mover>
14
+ </xsl:template>
15
+
16
+ <xsl:template match="tmpl[selector='tmARC']">
17
+ <mover accent="true">
18
+ <xsl:apply-templates select="(slot | pile)[1]"/>
19
+ <mo stretchy="true">&#x2322;</mo>
20
+ </mover>
21
+ </xsl:template>
22
+
23
+ <xsl:template match="tmpl[selector='tmHAT']">
24
+ <mover accent="true">
25
+ <xsl:apply-templates select="(slot | pile)[1]"/>
26
+ <mo stretchy="true">^</mo>
27
+ </mover>
28
+ </xsl:template>
29
+
30
+ <xsl:template match="tmpl[selector='tmJSTATUS']">
31
+ <mover accent="true">
32
+ <xsl:apply-templates select="(slot | pile)[1]"/>
33
+ <mo stretchy="true">&#xFE39;</mo>
34
+ </mover>
35
+ </xsl:template>
36
+
37
+ <xsl:template match="tmpl[selector='tmOBAR']">
38
+ <mover accent="true">
39
+ <xsl:apply-templates select="(slot | pile)[1]"/>
40
+ <mo stretchy="true">&#xAF;</mo>
41
+ </mover>
42
+ </xsl:template>
43
+
44
+ <xsl:template match="tmpl[selector='tmOBAR' and variation='tvBAR_DOUBLE']">
45
+ <mover accent="true">
46
+ <mover accent="true">
47
+ <xsl:apply-templates select="(slot | pile)[1]"/>
48
+ <mo stretchy="true">&#xAF;</mo>
49
+ </mover>
50
+ <mo stretchy="true">&#xAF;</mo>
51
+ </mover>
52
+ </xsl:template>
53
+
54
+ <xsl:template match="tmpl[selector='tmUBAR']">
55
+ <munder accentunder="true">
56
+ <xsl:apply-templates select="(slot | pile)[1]"/>
57
+ <mo stretchy="true">_</mo>
58
+ </munder>
59
+ </xsl:template>
60
+
61
+ <xsl:template match="tmpl[selector='tmUBAR' and variation='tvBAR_DOUBLE']">
62
+ <munder accentunder="true">
63
+ <munder accentunder="true">
64
+ <xsl:apply-templates select="(slot | pile)[1]"/>
65
+ <mo stretchy="true">_</mo>
66
+ </munder>
67
+ <mo stretchy="true">_</mo>
68
+ </munder>
69
+ </xsl:template>
70
+
71
+ <xsl:template match="tmpl[selector='tmVEC']">
72
+ <mover accent="true">
73
+ <xsl:apply-templates select="(slot | pile)[1]"/>
74
+ <mo stretchy="true">&#x2192;</mo>
75
+ </mover>
76
+ </xsl:template>
77
+
78
+ <xsl:template match="tmpl[selector='tmVEC' and variation='tvVE_LEFT']">
79
+ <mover accent="true">
80
+ <xsl:apply-templates select="(slot | pile)[1]"/>
81
+ <mo stretchy="true">&#x2190;</mo>
82
+ </mover>
83
+ </xsl:template>
84
+
85
+ <xsl:template match="tmpl[selector='tmVEC' and (variation='tvVE_LEFT' and variation='tvVE_RIGHT' )]">
86
+ <mover accent="true">
87
+ <xsl:apply-templates select="(slot | pile)[1]"/>
88
+ <mo stretchy="true">&#x2194;</mo>
89
+ </mover>
90
+ </xsl:template>
91
+
92
+ <xsl:template match="tmpl[selector='tmVEC' and variation='tvVE_HARPOON']">
93
+ <mover accent="true">
94
+ <xsl:apply-templates select="(slot | pile)[1]"/>
95
+ <mo stretchy="true">&#x21C0;</mo>
96
+ </mover>
97
+ </xsl:template>
98
+
99
+ <xsl:template match="tmpl[selector='tmVEC' and variation='tvVE_UNDER']">
100
+ <munder accentunder="true">
101
+ <xsl:apply-templates select="(slot | pile)[1]"/>
102
+ <mo stretchy="true">&#x2192;</mo>
103
+ </munder>
104
+ </xsl:template>
105
+
106
+ <xsl:template match="tmpl[selector='tmVEC' and variation='tvVE_UNDER' and variation='tvVE_LEFT']">
107
+ <munder accentunder="true">
108
+ <xsl:apply-templates select="(slot | pile)[1]"/>
109
+ <mo stretchy="true">&#x2190;</mo>
110
+ </munder>
111
+ </xsl:template>
112
+
113
+ <xsl:template match="tmpl[selector='tmVEC' and variation='tvVE_UNDER' and (variation='tvVE_LEFT' and variation='tvVE_RIGHT' )]">
114
+ <munder accentunder="true">
115
+ <xsl:apply-templates select="(slot | pile)[1]"/>
116
+ <mo stretchy="true">&#x2194;</mo>
117
+ </munder>
118
+ </xsl:template>
119
+
120
+ <xsl:template match="tmpl[selector='tmVEC' and variation='tvVE_UNDER' and variation='tvVE_HARPOON']">
121
+ <munder accentunder="true">
122
+ <xsl:apply-templates select="(slot | pile)[1]"/>
123
+ <mo stretchy="true">&#x21C1;</mo>
124
+ </munder>
125
+ </xsl:template>
126
+
127
+ <xsl:template match="tmpl[selector='tmSTRIKE']">
128
+ <menclose notation="updiagonalstrike downdiagonalstrike">
129
+ <xsl:apply-templates select="(slot | pile)[1]"/>
130
+ </menclose>
131
+ </xsl:template>
132
+
133
+ <xsl:template match="tmpl[selector='tmSTRIKE' and variation='tvST_HORIZ' and not(variation='tvST_UP' or variation='tvST_DOWN')]">
134
+ <menclose notation="horizontalstrike">
135
+ <xsl:apply-templates select="(slot | pile)[1]"/>
136
+ </menclose>
137
+ </xsl:template>
138
+
139
+ <xsl:template match="tmpl[selector='tmSTRIKE' and variation='tvST_UP' and not(variation='tvST_HORIZ' or variation='tvST_DOWN')]">
140
+ <menclose notation="updiagonalstrike">
141
+ <xsl:apply-templates select="(slot | pile)[1]"/>
142
+ </menclose>
143
+ </xsl:template>
144
+
145
+ <xsl:template match="tmpl[selector='tmSTRIKE' and variation='tvST_DOWN' and not(variation='tvST_UP' or variation='tvST_HORIZ')]">
146
+ <menclose notation="downdiagonalstrike">
147
+ <xsl:apply-templates select="(slot | pile)[1]"/>
148
+ </menclose>
149
+ </xsl:template>
150
+ </xsl:stylesheet>
@@ -32,85 +32,84 @@ matelem/last/r = "<(ns)mtd columnalign='right'>$+$n#$-$n</(ns)mtd>";
32
32
  version="1.0">
33
33
 
34
34
  <!-- Matrices TODO -->
35
- <xsl:template match="matrix">
35
+ <xsl:template match="matrix[h_just='left']">
36
36
  <mtable columnalign="left">
37
37
  <xsl:variable name="rows" select="number(rows)"/>
38
-
39
- <xsl:apply-templates select="slot[position() mod $rows = 1]" mode="rows" />
38
+ <xsl:apply-templates select="(slot | pile)[position() mod $rows = 1]" mode="rows-left" />
40
39
  </mtable>
41
40
  </xsl:template>
42
41
 
43
- <!--
44
-
45
- <xsl:template match="matrix">
42
+ <xsl:template match="matrix[h_just='center']">
46
43
  <mtable>
47
- <xsl:apply-templates select="slot[1]"/>
44
+ <xsl:variable name="rows" select="number(rows)"/>
45
+ <xsl:apply-templates select="(slot | pile)[position() mod $rows = 1]" mode="rows-center" />
48
46
  </mtable>
49
47
  </xsl:template>
50
48
 
51
- <xsl:template match="matrix">
49
+ <xsl:template match="matrix[h_just='right']">
52
50
  <mtable columnalign="right">
53
- <xsl:apply-templates select="slot[1]"/>
51
+ <xsl:variable name="rows" select="number(rows)"/>
52
+ <xsl:apply-templates select="(slot | pile)[position() mod $rows = 1]" mode="rows-right" />
54
53
  </mtable>
55
54
  </xsl:template>
56
55
 
57
- -->
58
-
59
- <xsl:template name="matrow" match="slot" mode="rows">
56
+ <xsl:template match="slot | pile" mode="rows-left">
60
57
  <xsl:variable name="rows" select="number(parent::*/rows)"/>
61
58
  <mtr columnalign="left">
62
- <xsl:apply-templates select="." mode="columns" />
63
- <xsl:apply-templates select="following-sibling::slot[position() &lt; $rows]" mode="columns" />
59
+ <xsl:apply-templates select="." mode="columns-left" />
60
+ <xsl:apply-templates select="(following-sibling::slot | following-sibling::pile)[position() &lt; $rows]" mode="columns-left" />
64
61
  </mtr>
65
62
  </xsl:template>
66
63
 
67
- <!--
68
- <xsl:template match="matrow">
69
- <mtr>
70
- <xsl:apply-templates select="slot[1]"/>
64
+ <xsl:template match="slot | pile" mode="rows-center">
65
+ <xsl:variable name="rows" select="number(parent::*/rows)"/>
66
+ <mtr columnalign="center">
67
+ <xsl:apply-templates select="." mode="columns-center" />
68
+ <xsl:apply-templates select="(following-sibling::slot | following-sibling::pile)[position() &lt; $rows]" mode="columns-center" />
71
69
  </mtr>
72
70
  </xsl:template>
73
71
 
74
- <xsl:template match="matrow">
72
+ <xsl:template match="slot | pile" mode="rows-right">
73
+ <xsl:variable name="rows" select="number(parent::*/rows)"/>
75
74
  <mtr columnalign="right">
76
- <xsl:apply-templates select="slot[1]"/>
75
+ <xsl:apply-templates select="." mode="columns-right" />
76
+ <xsl:apply-templates select="(following-sibling::slot | following-sibling::pile)[position() &lt; $rows]" mode="columns-right" />
77
77
  </mtr>
78
78
  </xsl:template>
79
- -->
80
79
 
81
- <xsl:template name="matelem" match="slot" mode="columns">
80
+ <xsl:template match="pile" mode="columns-left">
82
81
  <mtd columnalign="left">
83
- <xsl:apply-templates />
82
+ <xsl:apply-templates select="."/>
84
83
  </mtd>
85
84
  </xsl:template>
86
85
 
87
- <!-- <xsl:template match="matelem">
88
- <mtd>
89
- <xsl:apply-templates select="slot[1]"/>
86
+ <xsl:template match="pile" mode="columns-center">
87
+ <mtd columnalign="center">
88
+ <xsl:apply-templates select="."/>
90
89
  </mtd>
91
90
  </xsl:template>
92
91
 
93
- <xsl:template match="matelem">
92
+ <xsl:template match="pile" mode="columns-right">
94
93
  <mtd columnalign="right">
95
- <xsl:apply-templates select="slot[1]"/>
94
+ <xsl:apply-templates select="."/>
96
95
  </mtd>
97
96
  </xsl:template>
98
97
 
99
- <xsl:template match="matelem">
98
+ <xsl:template match="slot" mode="columns-left">
100
99
  <mtd columnalign="left">
101
- <xsl:apply-templates select="slot[1]"/>
100
+ <xsl:apply-templates />
102
101
  </mtd>
103
102
  </xsl:template>
104
103
 
105
- <xsl:template match="matelem">
106
- <mtd>
107
- <xsl:apply-templates select="slot[1]"/>
104
+ <xsl:template match="slot" mode="columns-center">
105
+ <mtd columnalign="center">
106
+ <xsl:apply-templates />
108
107
  </mtd>
109
108
  </xsl:template>
110
109
 
111
- <xsl:template match="matelem">
110
+ <xsl:template match="slot" mode="columns-right">
112
111
  <mtd columnalign="right">
113
- <xsl:apply-templates select="slot[1]"/>
112
+ <xsl:apply-templates />
114
113
  </mtd>
115
- </xsl:template> -->
114
+ </xsl:template>
116
115
  </xsl:stylesheet>
@@ -12,7 +12,7 @@
12
12
  The next line is translated;
13
13
  If there are any more lines, go back to Step 3. Otherwise, continue with the next step;
14
14
  The <end> part of the translation string is output.
15
- -->
15
+ -->
16
16
  <xsl:template match="pile">
17
17
  <mtable>
18
18
  <xsl:apply-templates select="slot" mode="wrap"/>
@@ -10,10 +10,10 @@
10
10
  <mstyle displaystyle="true">
11
11
  <munderover>
12
12
  <mo>&#x220F;</mo>
13
- <xsl:apply-templates select="slot[2]"/>
14
- <xsl:apply-templates select="slot[3]"/>
13
+ <xsl:apply-templates select="slot[2] | pile[2]"/>
14
+ <xsl:apply-templates select="slot[3] | pile[3]"/>
15
15
  </munderover>
16
- <xsl:apply-templates select="slot[1]"/>
16
+ <xsl:apply-templates select="slot[1] | pile[1]"/>
17
17
  </mstyle>
18
18
  </xsl:template>
19
19
 
@@ -21,15 +21,15 @@
21
21
  <mstyle displaystyle="true">
22
22
  <munder>
23
23
  <mo>&#x220F;</mo>
24
- <xsl:apply-templates select="slot[2]"/>
24
+ <xsl:apply-templates select="slot[2] | pile[2]"/>
25
25
  </munder>
26
- <xsl:apply-templates select="slot[1]"/>
26
+ <xsl:apply-templates select="slot[1] | pile[1]"/>
27
27
  </mstyle>
28
28
  </xsl:template>
29
29
 
30
30
  <xsl:template match="tmpl[selector='tmPROD' and (not(variation='tvBO_UPPER') and not(variation='tvBO_LOWER'))]">
31
31
  <mstyle displaystyle="true">
32
- <mo>&#x220F;</mo> <xsl:apply-templates select="slot[1]"/>
32
+ <mo>&#x220F;</mo> <xsl:apply-templates select="slot[1] | pile[1]"/>
33
33
  </mstyle>
34
34
  </xsl:template>
35
35
 
@@ -37,9 +37,9 @@
37
37
  <mstyle displaystyle="true">
38
38
  <msub>
39
39
  <mo>&#x220F;</mo>
40
- <xsl:apply-templates select="slot[2]"/>
40
+ <xsl:apply-templates select="slot[2] | pile[2]"/>
41
41
  </msub>
42
- <xsl:apply-templates select="slot[1]"/>
42
+ <xsl:apply-templates select="slot[1] | pile[1]"/>
43
43
  </mstyle>
44
44
  </xsl:template>
45
45
 
@@ -47,10 +47,10 @@
47
47
  <mstyle displaystyle="true">
48
48
  <msubsup>
49
49
  <mo>&#x220F;</mo>
50
- <xsl:apply-templates select="slot[2]"/>
51
- <xsl:apply-templates select="slot[3]"/>
50
+ <xsl:apply-templates select="slot[2] | pile[2]"/>
51
+ <xsl:apply-templates select="slot[3] | pile[3]"/>
52
52
  </msubsup>
53
- <xsl:apply-templates select="slot[1]"/>
53
+ <xsl:apply-templates select="slot[1] | pile[1]"/>
54
54
  </mstyle>
55
55
  </xsl:template>
56
56
 
@@ -58,10 +58,10 @@
58
58
  <mstyle displaystyle="true">
59
59
  <munderover>
60
60
  <mo>&#x2210;</mo>
61
- <xsl:apply-templates select="slot[2]"/>
62
- <xsl:apply-templates select="slot[3]"/>
61
+ <xsl:apply-templates select="slot[2] | pile[2]"/>
62
+ <xsl:apply-templates select="slot[3] | pile[3]"/>
63
63
  </munderover>
64
- <xsl:apply-templates select="slot[1]"/>
64
+ <xsl:apply-templates select="slot[1] | pile[1]"/>
65
65
  </mstyle>
66
66
  </xsl:template>
67
67
 
@@ -69,16 +69,16 @@
69
69
  <mstyle displaystyle="true">
70
70
  <msubsup>
71
71
  <mo>&#x2210;</mo>
72
- <xsl:apply-templates select="slot[2]"/>
73
- <xsl:apply-templates select="slot[3]"/>
72
+ <xsl:apply-templates select="slot[2] | pile[2]"/>
73
+ <xsl:apply-templates select="slot[3] | pile[3]"/>
74
74
  </msubsup>
75
- <xsl:apply-templates select="slot[1]"/>
75
+ <xsl:apply-templates select="slot[1] | pile[1]"/>
76
76
  </mstyle>
77
77
  </xsl:template>
78
78
 
79
79
  <xsl:template match="tmpl[selector='tmCOPROD' and (not(variation='tvBO_UPPER') and not(variation='tvBO_LOWER'))]">
80
80
  <mstyle displaystyle="true">
81
- <mo>&#x2210;</mo> <xsl:apply-templates select="slot[1]"/>
81
+ <mo>&#x2210;</mo> <xsl:apply-templates select="slot[1] | pile[1]"/>
82
82
  </mstyle>
83
83
  </xsl:template>
84
84
 
@@ -86,9 +86,9 @@
86
86
  <mstyle displaystyle="true">
87
87
  <munder>
88
88
  <mo>&#x2210;</mo>
89
- <xsl:apply-templates select="slot[2]"/>
89
+ <xsl:apply-templates select="slot[2] | pile[2]"/>
90
90
  </munder>
91
- <xsl:apply-templates select="slot[1]"/>
91
+ <xsl:apply-templates select="slot[1] | pile[1]"/>
92
92
  </mstyle>
93
93
  </xsl:template>
94
94
 
@@ -96,9 +96,9 @@
96
96
  <mstyle displaystyle="true">
97
97
  <msub>
98
98
  <mo>&#x2210;</mo>
99
- <xsl:apply-templates select="slot[2]"/>
99
+ <xsl:apply-templates select="slot[2] | pile[2]"/>
100
100
  </msub>
101
- <xsl:apply-templates select="slot[1]"/>
101
+ <xsl:apply-templates select="slot[1] | pile[1]"/>
102
102
  </mstyle>
103
103
  </xsl:template>
104
104