mathtype_to_mathml_plus 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +45 -0
- data/Rakefile +7 -0
- data/lib/mathtype_to_mathml/char_replacer.rb +366 -0
- data/lib/mathtype_to_mathml/mover.rb +151 -0
- data/lib/mathtype_to_mathml/version.rb +3 -0
- data/lib/mathtype_to_mathml.rb +45 -0
- data/lib/transform.xsl +53 -0
- data/lib/xsl/arrow.xsl +319 -0
- data/lib/xsl/box.xsl +42 -0
- data/lib/xsl/char.xsl +1854 -0
- data/lib/xsl/embellishment.xsl +389 -0
- data/lib/xsl/fence.xsl +228 -0
- data/lib/xsl/frac.xsl +46 -0
- data/lib/xsl/int.xsl +622 -0
- data/lib/xsl/lim.xsl +32 -0
- data/lib/xsl/long_division.xsl +32 -0
- data/lib/xsl/long_embellishment.xsl +150 -0
- data/lib/xsl/matrix.xsl +115 -0
- data/lib/xsl/pile.xsl +54 -0
- data/lib/xsl/product_coproduct.xsl +107 -0
- data/lib/xsl/subsup.xsl +55 -0
- data/lib/xsl/sum.xsl +81 -0
- data/lib/xsl/union_intersection.xsl +104 -0
- data/mathtype_to_mathml.gemspec +29 -0
- data/spec/fixtures/expected/280.xml +122 -0
- data/spec/fixtures/expected/281.xml +60 -0
- data/spec/fixtures/expected/299.xml +70 -0
- data/spec/fixtures/expected/326.xml +173 -0
- data/spec/fixtures/expected/424.xml +425 -0
- data/spec/fixtures/expected/450.xml +174 -0
- data/spec/fixtures/expected/452.xml +166 -0
- data/spec/fixtures/expected/478.xml +303 -0
- data/spec/fixtures/expected/629.xml +98 -0
- data/spec/fixtures/expected/arrows.xml +389 -0
- data/spec/fixtures/expected/boxes.xml +22 -0
- data/spec/fixtures/expected/embellishments.xml +178 -0
- data/spec/fixtures/expected/embellishments_roots_long_divisions.xml +162 -0
- data/spec/fixtures/expected/equation1.xml +52 -0
- data/spec/fixtures/expected/equation10.xml +19 -0
- data/spec/fixtures/expected/equation11.xml +17 -0
- data/spec/fixtures/expected/equation12.xml +34 -0
- data/spec/fixtures/expected/equation13.xml +113 -0
- data/spec/fixtures/expected/equation14.xml +54 -0
- data/spec/fixtures/expected/equation2.xml +33 -0
- data/spec/fixtures/expected/equation3.xml +324 -0
- data/spec/fixtures/expected/equation4.xml +14 -0
- data/spec/fixtures/expected/equation5.xml +23 -0
- data/spec/fixtures/expected/equation6.xml +13 -0
- data/spec/fixtures/expected/equation7.xml +19 -0
- data/spec/fixtures/expected/equation8.xml +17 -0
- data/spec/fixtures/expected/equation9.xml +15 -0
- data/spec/fixtures/expected/fences.xml +64 -0
- data/spec/fixtures/expected/integrals.xml +264 -0
- data/spec/fixtures/expected/matrices.xml +253 -0
- data/spec/fixtures/expected/sums.xml +36 -0
- data/spec/fixtures/expected/unions_and_intersections.xml +140 -0
- data/spec/fixtures/input/280.bin +0 -0
- data/spec/fixtures/input/281.bin +0 -0
- data/spec/fixtures/input/299.bin +0 -0
- data/spec/fixtures/input/326.bin +0 -0
- data/spec/fixtures/input/424.bin +0 -0
- data/spec/fixtures/input/450.bin +0 -0
- data/spec/fixtures/input/452.bin +0 -0
- data/spec/fixtures/input/478.bin +0 -0
- data/spec/fixtures/input/629.bin +0 -0
- data/spec/fixtures/input/arrows.bin +0 -0
- data/spec/fixtures/input/boxes.bin +0 -0
- data/spec/fixtures/input/embellishments.bin +0 -0
- data/spec/fixtures/input/embellishments_roots_long_divisions.bin +0 -0
- data/spec/fixtures/input/equation1.bin +0 -0
- data/spec/fixtures/input/equation10.bin +0 -0
- data/spec/fixtures/input/equation11.bin +0 -0
- data/spec/fixtures/input/equation12.bin +0 -0
- data/spec/fixtures/input/equation13.bin +0 -0
- data/spec/fixtures/input/equation14.bin +0 -0
- data/spec/fixtures/input/equation2.bin +0 -0
- data/spec/fixtures/input/equation3.bin +0 -0
- data/spec/fixtures/input/equation4.bin +0 -0
- data/spec/fixtures/input/equation5.bin +0 -0
- data/spec/fixtures/input/equation6.bin +0 -0
- data/spec/fixtures/input/equation7.bin +0 -0
- data/spec/fixtures/input/equation8.bin +0 -0
- data/spec/fixtures/input/equation9.bin +0 -0
- data/spec/fixtures/input/fences.bin +0 -0
- data/spec/fixtures/input/integrals.bin +0 -0
- data/spec/fixtures/input/matrices.bin +0 -0
- data/spec/fixtures/input/sums.bin +0 -0
- data/spec/fixtures/input/unions_and_intersections.bin +0 -0
- data/spec/html_output.rb +28 -0
- data/spec/mathtype_to_mathml_spec.rb +16 -0
- data/spec/spec_helper.rb +4 -0
- metadata +305 -0
|
@@ -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">˜</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">⌢</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">︹</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">¯</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">¯</mo>
|
|
49
|
+
</mover>
|
|
50
|
+
<mo stretchy="true">¯</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">→</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">←</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">↔</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">⇀</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">→</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">←</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">↔</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">⇁</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>
|
data/lib/xsl/matrix.xsl
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
// =====================================================
|
|
4
|
+
// Matrices
|
|
5
|
+
// =====================================================
|
|
6
|
+
|
|
7
|
+
// matrix translation (left, center, right)
|
|
8
|
+
matrix/l = "<(ns)mtable columnalign='left'>$+$n#$-$n</(ns)mtable>";
|
|
9
|
+
matrix = "<(ns)mtable>$+$n#$-$n</(ns)mtable>";
|
|
10
|
+
matrix/r = "<(ns)mtable columnalign='right'>$+$n#$-$n</(ns)mtable>";
|
|
11
|
+
|
|
12
|
+
// matrix line translation (left, center, right)
|
|
13
|
+
matrow/l = "<(ns)mtr columnalign='left'>$+$n#$-$n</(ns)mtr>$n";
|
|
14
|
+
matrow = "<(ns)mtr>$+$n#$-$n</(ns)mtr>$n";
|
|
15
|
+
matrow/r = "<(ns)mtr columnalign='right'>$+$n#$-$n</(ns)mtr>$n";
|
|
16
|
+
|
|
17
|
+
// matrix element translation (except for last element) (left, center, right)
|
|
18
|
+
matelem/l = "<(ns)mtd columnalign='left'>$+$n#$-$n</(ns)mtd>$n";
|
|
19
|
+
matelem = "<(ns)mtd>$+$n#$-$n</(ns)mtd>$n";
|
|
20
|
+
matelem/r = "<(ns)mtd columnalign='right'>$+$n#$-$n</(ns)mtd>$n";
|
|
21
|
+
|
|
22
|
+
// matrix element translation (last element only) (left, center, right)
|
|
23
|
+
matelem/last/l = "<(ns)mtd columnalign='left'>$+$n#$-$n</(ns)mtd>";
|
|
24
|
+
matelem/last = "<(ns)mtd>$+$n#$-$n</(ns)mtd>";
|
|
25
|
+
matelem/last/r = "<(ns)mtd columnalign='right'>$+$n#$-$n</(ns)mtd>";
|
|
26
|
+
-->
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
30
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
31
|
+
exclude-result-prefixes="xs"
|
|
32
|
+
version="1.0">
|
|
33
|
+
|
|
34
|
+
<!-- Matrices TODO -->
|
|
35
|
+
<xsl:template match="matrix[h_just='left']">
|
|
36
|
+
<mtable columnalign="left">
|
|
37
|
+
<xsl:variable name="rows" select="number(rows)"/>
|
|
38
|
+
<xsl:apply-templates select="(slot | pile)[position() mod $rows = 1]" mode="rows-left" />
|
|
39
|
+
</mtable>
|
|
40
|
+
</xsl:template>
|
|
41
|
+
|
|
42
|
+
<xsl:template match="matrix[h_just='center']">
|
|
43
|
+
<mtable>
|
|
44
|
+
<xsl:variable name="rows" select="number(rows)"/>
|
|
45
|
+
<xsl:apply-templates select="(slot | pile)[position() mod $rows = 1]" mode="rows-center" />
|
|
46
|
+
</mtable>
|
|
47
|
+
</xsl:template>
|
|
48
|
+
|
|
49
|
+
<xsl:template match="matrix[h_just='right']">
|
|
50
|
+
<mtable columnalign="right">
|
|
51
|
+
<xsl:variable name="rows" select="number(rows)"/>
|
|
52
|
+
<xsl:apply-templates select="(slot | pile)[position() mod $rows = 1]" mode="rows-right" />
|
|
53
|
+
</mtable>
|
|
54
|
+
</xsl:template>
|
|
55
|
+
|
|
56
|
+
<xsl:template match="slot | pile" mode="rows-left">
|
|
57
|
+
<xsl:variable name="rows" select="number(parent::*/rows)"/>
|
|
58
|
+
<mtr columnalign="left">
|
|
59
|
+
<xsl:apply-templates select="." mode="columns-left" />
|
|
60
|
+
<xsl:apply-templates select="(following-sibling::slot | following-sibling::pile)[position() < $rows]" mode="columns-left" />
|
|
61
|
+
</mtr>
|
|
62
|
+
</xsl:template>
|
|
63
|
+
|
|
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() < $rows]" mode="columns-center" />
|
|
69
|
+
</mtr>
|
|
70
|
+
</xsl:template>
|
|
71
|
+
|
|
72
|
+
<xsl:template match="slot | pile" mode="rows-right">
|
|
73
|
+
<xsl:variable name="rows" select="number(parent::*/rows)"/>
|
|
74
|
+
<mtr columnalign="right">
|
|
75
|
+
<xsl:apply-templates select="." mode="columns-right" />
|
|
76
|
+
<xsl:apply-templates select="(following-sibling::slot | following-sibling::pile)[position() < $rows]" mode="columns-right" />
|
|
77
|
+
</mtr>
|
|
78
|
+
</xsl:template>
|
|
79
|
+
|
|
80
|
+
<xsl:template match="pile" mode="columns-left">
|
|
81
|
+
<mtd columnalign="left">
|
|
82
|
+
<xsl:apply-templates select="."/>
|
|
83
|
+
</mtd>
|
|
84
|
+
</xsl:template>
|
|
85
|
+
|
|
86
|
+
<xsl:template match="pile" mode="columns-center">
|
|
87
|
+
<mtd columnalign="center">
|
|
88
|
+
<xsl:apply-templates select="."/>
|
|
89
|
+
</mtd>
|
|
90
|
+
</xsl:template>
|
|
91
|
+
|
|
92
|
+
<xsl:template match="pile" mode="columns-right">
|
|
93
|
+
<mtd columnalign="right">
|
|
94
|
+
<xsl:apply-templates select="."/>
|
|
95
|
+
</mtd>
|
|
96
|
+
</xsl:template>
|
|
97
|
+
|
|
98
|
+
<xsl:template match="slot" mode="columns-left">
|
|
99
|
+
<mtd columnalign="left">
|
|
100
|
+
<xsl:apply-templates />
|
|
101
|
+
</mtd>
|
|
102
|
+
</xsl:template>
|
|
103
|
+
|
|
104
|
+
<xsl:template match="slot" mode="columns-center">
|
|
105
|
+
<mtd columnalign="center">
|
|
106
|
+
<xsl:apply-templates />
|
|
107
|
+
</mtd>
|
|
108
|
+
</xsl:template>
|
|
109
|
+
|
|
110
|
+
<xsl:template match="slot" mode="columns-right">
|
|
111
|
+
<mtd columnalign="right">
|
|
112
|
+
<xsl:apply-templates />
|
|
113
|
+
</mtd>
|
|
114
|
+
</xsl:template>
|
|
115
|
+
</xsl:stylesheet>
|
data/lib/xsl/pile.xsl
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
<!-- The translation of a pile using this form of translation string is performed with the following steps:
|
|
8
|
+
|
|
9
|
+
The <start> part of the translation string is output;
|
|
10
|
+
The first line is translated;
|
|
11
|
+
The <repeat> part of the translation string is output;
|
|
12
|
+
The next line is translated;
|
|
13
|
+
If there are any more lines, go back to Step 3. Otherwise, continue with the next step;
|
|
14
|
+
The <end> part of the translation string is output.
|
|
15
|
+
-->
|
|
16
|
+
<xsl:template match="pile">
|
|
17
|
+
<mtable>
|
|
18
|
+
<xsl:apply-templates select="slot" mode="wrap"/>
|
|
19
|
+
</mtable>
|
|
20
|
+
</xsl:template>
|
|
21
|
+
|
|
22
|
+
<xsl:template match="pile[halign='left']">
|
|
23
|
+
<mtable columnalign="left">
|
|
24
|
+
<xsl:apply-templates select="slot" mode="wrap"/>
|
|
25
|
+
</mtable>
|
|
26
|
+
</xsl:template>
|
|
27
|
+
|
|
28
|
+
<xsl:template match="pile/slot" mode="wrap">
|
|
29
|
+
<mtr>
|
|
30
|
+
<mtd>
|
|
31
|
+
<xsl:apply-templates select="."/>
|
|
32
|
+
</mtd>
|
|
33
|
+
</mtr>
|
|
34
|
+
</xsl:template>
|
|
35
|
+
|
|
36
|
+
<xsl:template match="pile[halign='right']">
|
|
37
|
+
<mtable columnalign="right">
|
|
38
|
+
<xsl:apply-templates select="slot" mode="wrap"/>
|
|
39
|
+
</mtable>
|
|
40
|
+
</xsl:template>
|
|
41
|
+
|
|
42
|
+
<xsl:template match="pile[halign='dec']">
|
|
43
|
+
<mtable groupalign="decimalpoint">
|
|
44
|
+
<xsl:apply-templates select="slot" mode="wrap"/>
|
|
45
|
+
</mtable>
|
|
46
|
+
</xsl:template>
|
|
47
|
+
|
|
48
|
+
<xsl:template match="pile[halign='al']">
|
|
49
|
+
<mtable>
|
|
50
|
+
<xsl:apply-templates select="slot" mode="wrap"/>
|
|
51
|
+
</mtable>
|
|
52
|
+
</xsl:template>
|
|
53
|
+
|
|
54
|
+
</xsl:stylesheet>
|
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
<!-- Product and coproduct -->
|
|
8
|
+
|
|
9
|
+
<xsl:template match="tmpl[selector='tmPROD']">
|
|
10
|
+
<mstyle displaystyle="true">
|
|
11
|
+
<munderover>
|
|
12
|
+
<mo>∏</mo>
|
|
13
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
14
|
+
<xsl:apply-templates select="slot[3] | pile[3]"/>
|
|
15
|
+
</munderover>
|
|
16
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
17
|
+
</mstyle>
|
|
18
|
+
</xsl:template>
|
|
19
|
+
|
|
20
|
+
<xsl:template match="tmpl[selector='tmPROD' and variation='tvBO_LOWER' and not(variation='tvBO_UPPER')]">
|
|
21
|
+
<mstyle displaystyle="true">
|
|
22
|
+
<munder>
|
|
23
|
+
<mo>∏</mo>
|
|
24
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
25
|
+
</munder>
|
|
26
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
27
|
+
</mstyle>
|
|
28
|
+
</xsl:template>
|
|
29
|
+
|
|
30
|
+
<xsl:template match="tmpl[selector='tmPROD' and (not(variation='tvBO_UPPER') and not(variation='tvBO_LOWER'))]">
|
|
31
|
+
<mstyle displaystyle="true">
|
|
32
|
+
<mo>∏</mo> <xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
33
|
+
</mstyle>
|
|
34
|
+
</xsl:template>
|
|
35
|
+
|
|
36
|
+
<xsl:template match="tmpl[selector='tmPROD' and not(variation='tvBO_SUM') and variation='tvBO_LOWER']">
|
|
37
|
+
<mstyle displaystyle="true">
|
|
38
|
+
<msub>
|
|
39
|
+
<mo>∏</mo>
|
|
40
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
41
|
+
</msub>
|
|
42
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
43
|
+
</mstyle>
|
|
44
|
+
</xsl:template>
|
|
45
|
+
|
|
46
|
+
<xsl:template match="tmpl[selector='tmPROD' and not(variation='tvBO_SUM') ]">
|
|
47
|
+
<mstyle displaystyle="true">
|
|
48
|
+
<msubsup>
|
|
49
|
+
<mo>∏</mo>
|
|
50
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
51
|
+
<xsl:apply-templates select="slot[3] | pile[3]"/>
|
|
52
|
+
</msubsup>
|
|
53
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
54
|
+
</mstyle>
|
|
55
|
+
</xsl:template>
|
|
56
|
+
|
|
57
|
+
<xsl:template match="tmpl[selector='tmCOPROD']">
|
|
58
|
+
<mstyle displaystyle="true">
|
|
59
|
+
<munderover>
|
|
60
|
+
<mo>∐</mo>
|
|
61
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
62
|
+
<xsl:apply-templates select="slot[3] | pile[3]"/>
|
|
63
|
+
</munderover>
|
|
64
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
65
|
+
</mstyle>
|
|
66
|
+
</xsl:template>
|
|
67
|
+
|
|
68
|
+
<xsl:template match="tmpl[selector='tmCOPROD' and not(variation='tvBO_SUM') ]">
|
|
69
|
+
<mstyle displaystyle="true">
|
|
70
|
+
<msubsup>
|
|
71
|
+
<mo>∐</mo>
|
|
72
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
73
|
+
<xsl:apply-templates select="slot[3] | pile[3]"/>
|
|
74
|
+
</msubsup>
|
|
75
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
76
|
+
</mstyle>
|
|
77
|
+
</xsl:template>
|
|
78
|
+
|
|
79
|
+
<xsl:template match="tmpl[selector='tmCOPROD' and (not(variation='tvBO_UPPER') and not(variation='tvBO_LOWER'))]">
|
|
80
|
+
<mstyle displaystyle="true">
|
|
81
|
+
<mo>∐</mo> <xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
82
|
+
</mstyle>
|
|
83
|
+
</xsl:template>
|
|
84
|
+
|
|
85
|
+
<xsl:template match="tmpl[selector='tmCOPROD' and variation='tvBO_LOWER' and not(variation='tvBO_UPPER')]">
|
|
86
|
+
<mstyle displaystyle="true">
|
|
87
|
+
<munder>
|
|
88
|
+
<mo>∐</mo>
|
|
89
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
90
|
+
</munder>
|
|
91
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
92
|
+
</mstyle>
|
|
93
|
+
</xsl:template>
|
|
94
|
+
|
|
95
|
+
<xsl:template match="tmpl[selector='tmCOPROD' and not(variation='tvBO_SUM') and variation='tvBO_LOWER' and not(variation='tvBO_UPPER')]">
|
|
96
|
+
<mstyle displaystyle="true">
|
|
97
|
+
<msub>
|
|
98
|
+
<mo>∐</mo>
|
|
99
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
100
|
+
</msub>
|
|
101
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
102
|
+
</mstyle>
|
|
103
|
+
</xsl:template>
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
</xsl:stylesheet>
|
data/lib/xsl/subsup.xsl
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
<xsl:template match="tmpl[selector='tmSUP' and not(variation='tvSU_PRECEDES')]">
|
|
8
|
+
<msup>
|
|
9
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
10
|
+
<xsl:apply-templates select="slot[3] | pile[3]"/>
|
|
11
|
+
</msup>
|
|
12
|
+
</xsl:template>
|
|
13
|
+
|
|
14
|
+
<xsl:template match="tmpl[selector='tmSUB' and not(variation='tvSU_PRECEDES')]">
|
|
15
|
+
<msub>
|
|
16
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
17
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
18
|
+
</msub>
|
|
19
|
+
</xsl:template>
|
|
20
|
+
|
|
21
|
+
<xsl:template match="tmpl[selector='tmSUBSUP' and not(variation='tvSU_PRECEDES')]">
|
|
22
|
+
<msubsup>
|
|
23
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
24
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
25
|
+
<xsl:apply-templates select="slot[3] | pile[3]"/>
|
|
26
|
+
</msubsup>
|
|
27
|
+
</xsl:template>
|
|
28
|
+
|
|
29
|
+
<xsl:template match="tmpl[selector='tmSUP' and variation='tvSU_PRECEDES']">
|
|
30
|
+
<mmultiscripts>
|
|
31
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
32
|
+
<mprescripts/>
|
|
33
|
+
<none/>
|
|
34
|
+
<xsl:apply-templates select="slot[3] | pile[3]"/>
|
|
35
|
+
</mmultiscripts>
|
|
36
|
+
</xsl:template>
|
|
37
|
+
|
|
38
|
+
<xsl:template match="tmpl[selector='tmSUB' and variation='tvSU_PRECEDES']">
|
|
39
|
+
<mmultiscripts>
|
|
40
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
41
|
+
<mprescripts/>
|
|
42
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
43
|
+
<none/>
|
|
44
|
+
</mmultiscripts>
|
|
45
|
+
</xsl:template>
|
|
46
|
+
|
|
47
|
+
<xsl:template match="tmpl[selector='tmSUBSUP' and variation='tvSU_PRECEDES']">
|
|
48
|
+
<mmultiscripts>
|
|
49
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
50
|
+
<mprescripts/>
|
|
51
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
52
|
+
<xsl:apply-templates select="slot[3] | pile[3]"/>
|
|
53
|
+
</mmultiscripts>
|
|
54
|
+
</xsl:template>
|
|
55
|
+
</xsl:stylesheet>
|
data/lib/xsl/sum.xsl
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
<!-- Summations -->
|
|
8
|
+
|
|
9
|
+
<xsl:template match="tmpl[selector='tmSUM' and (not(variation='tvBO_UPPER') and not(variation='tvBO_UPPER'))]">
|
|
10
|
+
<mstyle displaystyle="true">
|
|
11
|
+
<mo>∑</mo>
|
|
12
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
13
|
+
</mstyle>
|
|
14
|
+
</xsl:template>
|
|
15
|
+
|
|
16
|
+
<xsl:template match="tmpl[selector='tmSUM' and variation='tvBO_LOWER']">
|
|
17
|
+
<mstyle displaystyle="true">
|
|
18
|
+
<munder>
|
|
19
|
+
<mo>∑</mo>
|
|
20
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
21
|
+
</munder>
|
|
22
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
23
|
+
</mstyle>
|
|
24
|
+
</xsl:template>
|
|
25
|
+
|
|
26
|
+
<xsl:template match="tmpl[selector='tmSUM']">
|
|
27
|
+
<mstyle displaystyle="true">
|
|
28
|
+
<munderover>
|
|
29
|
+
<mo>∑</mo>
|
|
30
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
31
|
+
<xsl:apply-templates select="slot[3] | pile[3]"/>
|
|
32
|
+
</munderover>
|
|
33
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
34
|
+
</mstyle>
|
|
35
|
+
</xsl:template>
|
|
36
|
+
|
|
37
|
+
<xsl:template match="tmpl[selector='tmSUM' and not(variation='tvBO_SUM') and variation='tvBO_LOWER']">
|
|
38
|
+
<mstyle displaystyle="true">
|
|
39
|
+
<msub>
|
|
40
|
+
<mo>∑</mo>
|
|
41
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
42
|
+
</msub>
|
|
43
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
44
|
+
</mstyle>
|
|
45
|
+
</xsl:template>
|
|
46
|
+
|
|
47
|
+
<xsl:template match="tmpl[selector='tmSUM' and not(variation='tvBO_SUM')]">
|
|
48
|
+
<mstyle displaystyle="true">
|
|
49
|
+
<msubsup>
|
|
50
|
+
<mo>∑</mo>
|
|
51
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
52
|
+
<xsl:apply-templates select="slot[3] | pile[3]"/>
|
|
53
|
+
</msubsup>
|
|
54
|
+
<xsl:apply-templates select="slot[1] | pile[1]"/>
|
|
55
|
+
</mstyle>
|
|
56
|
+
</xsl:template>
|
|
57
|
+
|
|
58
|
+
<!-- Sum operator -->
|
|
59
|
+
<xsl:template match="tmpl[selector='tmSUMOP']">
|
|
60
|
+
<munderover>
|
|
61
|
+
<mstyle mathsize="140%" displaystyle="true"><xsl:apply-templates select="slot[4] | pile[4]"/></mstyle>
|
|
62
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
63
|
+
<xsl:apply-templates select="slot[3] | pile[3]"/>
|
|
64
|
+
</munderover>
|
|
65
|
+
</xsl:template>
|
|
66
|
+
|
|
67
|
+
<xsl:template match="tmpl[selector='tmSUMOP' and variation='tvBO_UPPER' ]">
|
|
68
|
+
<mover>
|
|
69
|
+
<mstyle mathsize="140%" displaystyle="true"><xsl:apply-templates select="slot[4] | pile[4]"/></mstyle>
|
|
70
|
+
<xsl:apply-templates select="slot[3] | pile[3]"/>
|
|
71
|
+
</mover>
|
|
72
|
+
</xsl:template>
|
|
73
|
+
|
|
74
|
+
<xsl:template match="tmpl[selector='tmSUMOP' and variation='tvBO_LOWER' ]">
|
|
75
|
+
<munder>
|
|
76
|
+
<mstyle mathsize="140%" displaystyle="true"><xsl:apply-templates select="slot[4] | pile[4]"/></mstyle>
|
|
77
|
+
<xsl:apply-templates select="slot[2] | pile[2]"/>
|
|
78
|
+
</munder>
|
|
79
|
+
</xsl:template>
|
|
80
|
+
|
|
81
|
+
</xsl:stylesheet>
|