[PLUGINS] +set de base
[lhc/web/www.git] / www / plugins / odt2spip_30 / inc / xsltml / scripts.xsl
1 <?xml version='1.0' encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:m="http://www.w3.org/1998/Math/MathML"
4 version='1.0'>
5
6 <!-- ====================================================================== -->
7 <!-- $Id: scripts.xsl,v 1.1.1.1 2002/10/26 14:20:06 shade33 Exp $
8 This file is part of the XSLT MathML Library distribution.
9 See ./README or http://www.raleigh.ru/MathML/mmltex for
10 copyright and other information -->
11 <!-- ====================================================================== -->
12
13 <xsl:template match="m:munderover">
14 <xsl:variable name="base">
15 <xsl:call-template name="startspace">
16 <xsl:with-param name="symbol" select="./*[1]"/>
17 </xsl:call-template>
18 </xsl:variable>
19 <xsl:variable name="under">
20 <xsl:call-template name="startspace">
21 <xsl:with-param name="symbol" select="./*[2]"/>
22 </xsl:call-template>
23 </xsl:variable>
24 <xsl:variable name="over">
25 <xsl:call-template name="startspace">
26 <xsl:with-param name="symbol" select="./*[3]"/>
27 </xsl:call-template>
28 </xsl:variable>
29
30 <xsl:choose>
31 <xsl:when test="$over='&#x000AF;'"> <!-- OverBar - over bar -->
32 <xsl:text>\overline{</xsl:text>
33 <xsl:call-template name="munder">
34 <xsl:with-param name="base" select="$base"/>
35 <xsl:with-param name="under" select="$under"/>
36 </xsl:call-template>
37 <xsl:text>}</xsl:text>
38 </xsl:when>
39 <xsl:when test="$over='&#x0FE37;'"> <!-- OverBrace - over brace -->
40 <xsl:text>\overbrace{</xsl:text>
41 <xsl:call-template name="munder">
42 <xsl:with-param name="base" select="$base"/>
43 <xsl:with-param name="under" select="$under"/>
44 </xsl:call-template>
45 <xsl:text>}</xsl:text>
46 </xsl:when>
47 <xsl:when test="$under='&#x00332;'"> <!-- UnderBar - combining low line -->
48 <xsl:text>\underline{</xsl:text>
49 <xsl:call-template name="mover">
50 <xsl:with-param name="base" select="$base"/>
51 <xsl:with-param name="over" select="$over"/>
52 <xsl:with-param name="pos_over" select="3"/>
53 </xsl:call-template>
54 <xsl:text>}</xsl:text>
55 </xsl:when>
56 <xsl:when test="$under='&#x0FE38;'"> <!-- UnderBrace - under brace -->
57 <xsl:text>\underbrace{</xsl:text>
58 <xsl:call-template name="mover">
59 <xsl:with-param name="base" select="$base"/>
60 <xsl:with-param name="over" select="$over"/>
61 <xsl:with-param name="pos_over" select="3"/>
62 </xsl:call-template>
63 <xsl:text>}</xsl:text>
64 </xsl:when>
65 <xsl:when test="translate($base,'&#x0220F;&#x02210;&#x022c2;&#x022c3;&#x02294;',
66 '&#x02211;&#x02211;&#x02211;&#x02211;&#x02211;')='&#x02211;'">
67 <!-- if $base is operator, such as
68 &#x02211; /sum L: summation operator
69 &#x0220F; /prod L: product operator
70 &#x02210; /coprod L: coproduct operator
71 &#x022c2; /bigcap
72 &#x022c3; /bigcup
73 &#x02294; /bigsqcup
74 -->
75 <xsl:apply-templates select="./*[1]"/>
76 <xsl:text>_{</xsl:text>
77 <xsl:apply-templates select="./*[2]"/>
78 <xsl:text>}^{</xsl:text>
79 <xsl:apply-templates select="./*[3]"/>
80 <xsl:text>}</xsl:text>
81 </xsl:when>
82 <xsl:otherwise>
83 <xsl:text>\underset{</xsl:text>
84 <xsl:apply-templates select="./*[2]"/>
85 <xsl:text>}{\overset{</xsl:text>
86 <xsl:apply-templates select="./*[3]"/>
87 <xsl:text>}{</xsl:text>
88 <xsl:apply-templates select="./*[1]"/>
89 <xsl:text>}}</xsl:text>
90 </xsl:otherwise>
91 </xsl:choose>
92 </xsl:template>
93
94 <xsl:template match="m:mover">
95 <xsl:call-template name="mover">
96 <xsl:with-param name="base">
97 <xsl:call-template name="startspace">
98 <xsl:with-param name="symbol" select="./*[1]"/>
99 </xsl:call-template>
100 </xsl:with-param>
101 <xsl:with-param name="over">
102 <xsl:call-template name="startspace">
103 <xsl:with-param name="symbol" select="./*[2]"/>
104 </xsl:call-template>
105 </xsl:with-param>
106 </xsl:call-template>
107 </xsl:template>
108
109 <xsl:template match="m:munder">
110 <xsl:call-template name="munder">
111 <xsl:with-param name="base">
112 <xsl:call-template name="startspace">
113 <xsl:with-param name="symbol" select="./*[1]"/>
114 </xsl:call-template>
115 </xsl:with-param>
116 <xsl:with-param name="under">
117 <xsl:call-template name="startspace">
118 <xsl:with-param name="symbol" select="./*[2]"/>
119 </xsl:call-template>
120 </xsl:with-param>
121 </xsl:call-template>
122 </xsl:template>
123
124 <xsl:template name="mover">
125 <xsl:param name="base"/>
126 <xsl:param name="over"/>
127 <xsl:param name="pos_over" select="2"/>
128 <xsl:choose>
129 <xsl:when test="$over='&#x000AF;'"> <!-- OverBar - over bar -->
130 <xsl:text>\overline{</xsl:text>
131 <xsl:apply-templates select="./*[1]"/>
132 <xsl:text>}</xsl:text>
133 </xsl:when>
134 <xsl:when test="$over='&#x0FE37;'"> <!-- OverBrace - over brace -->
135 <xsl:text>\overbrace{</xsl:text>
136 <xsl:apply-templates select="./*[1]"/>
137 <xsl:text>}</xsl:text>
138 </xsl:when>
139 <xsl:when test="translate($base,'&#x0220F;&#x02210;&#x022c2;&#x022c3;&#x02294;',
140 '&#x02211;&#x02211;&#x02211;&#x02211;&#x02211;')='&#x02211;'">
141 <!-- if $base is operator, such as
142 &#x02211; /sum L: summation operator
143 &#x0220F; /prod L: product operator
144 &#x02210; /coprod L: coproduct operator
145 &#x022c2; /bigcap
146 &#x022c3; /bigcup
147 &#x02294; /bigsqcup
148 -->
149 <xsl:apply-templates select="./*[1]"/>
150 <xsl:text>^{</xsl:text>
151 <xsl:apply-templates select="./*[$pos_over]"/>
152 <xsl:text>}</xsl:text>
153 </xsl:when>
154 <xsl:otherwise>
155 <xsl:text>\stackrel{</xsl:text>
156 <xsl:apply-templates select="./*[$pos_over]"/>
157 <xsl:text>}{</xsl:text>
158 <xsl:apply-templates select="./*[1]"/>
159 <xsl:text>}</xsl:text>
160 <!--
161 <xsl:text>\overset{</xsl:text>
162 <xsl:apply-templates select="./*[$pos_over]"/>
163 <xsl:text>}{</xsl:text>
164 <xsl:apply-templates select="./*[1]"/>
165 <xsl:text>}</xsl:text>-->
166 </xsl:otherwise>
167 </xsl:choose>
168 </xsl:template>
169
170 <xsl:template name="munder">
171 <xsl:param name="base"/>
172 <xsl:param name="under"/>
173 <xsl:choose>
174 <xsl:when test="$under='&#x00332;'"> <!-- UnderBar - combining low line -->
175 <xsl:text>\underline{</xsl:text>
176 <xsl:apply-templates select="./*[1]"/>
177 <xsl:text>}</xsl:text>
178 </xsl:when>
179 <xsl:when test="$under='&#x0FE38;'"> <!-- UnderBrace - under brace -->
180 <xsl:text>\underbrace{</xsl:text>
181 <xsl:apply-templates select="./*[1]"/>
182 <xsl:text>}</xsl:text>
183 </xsl:when>
184 <xsl:when test="translate($base,'&#x0220F;&#x02210;&#x022c2;&#x022c3;&#x02294;',
185 '&#x02211;&#x02211;&#x02211;&#x02211;&#x02211;')='&#x02211;'">
186 <!-- if $base is operator, such as
187 &#x02211; /sum L: summation operator
188 &#x0220F; /prod L: product operator
189 &#x02210; /coprod L: coproduct operator
190 &#x022c2; /bigcap
191 &#x022c3; /bigcup
192 &#x02294; /bigsqcup
193 -->
194 <xsl:apply-templates select="./*[1]"/>
195 <xsl:text>_{</xsl:text>
196 <xsl:apply-templates select="./*[2]"/>
197 <xsl:text>}</xsl:text>
198 </xsl:when>
199 <xsl:otherwise>
200 <xsl:text>\underset{</xsl:text> <!-- Required AmsMath package -->
201 <xsl:apply-templates select="./*[2]"/>
202 <xsl:text>}{</xsl:text>
203 <xsl:apply-templates select="./*[1]"/>
204 <xsl:text>}</xsl:text>
205 </xsl:otherwise>
206 </xsl:choose>
207 </xsl:template>
208
209 <xsl:template match="m:msubsup">
210 <xsl:text>{</xsl:text>
211 <xsl:apply-templates select="./*[1]"/>
212 <xsl:text>}_{</xsl:text>
213 <xsl:apply-templates select="./*[2]"/>
214 <xsl:text>}^{</xsl:text>
215 <xsl:apply-templates select="./*[3]"/>
216 <xsl:text>}</xsl:text>
217 </xsl:template>
218
219 <xsl:template match="m:msup">
220 <xsl:text>{</xsl:text>
221 <xsl:apply-templates select="./*[1]"/>
222 <xsl:text>}^{</xsl:text>
223 <xsl:apply-templates select="./*[2]"/>
224 <xsl:text>}</xsl:text>
225 </xsl:template>
226
227 <xsl:template match="m:msub">
228 <xsl:text>{</xsl:text>
229 <xsl:apply-templates select="./*[1]"/>
230 <xsl:text>}_{</xsl:text>
231 <xsl:apply-templates select="./*[2]"/>
232 <xsl:text>}</xsl:text>
233 </xsl:template>
234
235 <xsl:template match="m:mmultiscripts" mode="mprescripts">
236 <xsl:for-each select="m:mprescripts/following-sibling::*">
237 <xsl:if test="position() mod 2 and local-name(.)!='none'">
238 <xsl:text>{}_{</xsl:text>
239 <xsl:apply-templates select="."/>
240 <xsl:text>}</xsl:text>
241 </xsl:if>
242 <xsl:if test="not(position() mod 2) and local-name(.)!='none'">
243 <xsl:text>{}^{</xsl:text>
244 <xsl:apply-templates select="."/>
245 <xsl:text>}</xsl:text>
246 </xsl:if>
247 </xsl:for-each>
248 <xsl:apply-templates select="./*[1]"/>
249 <xsl:for-each select="m:mprescripts/preceding-sibling::*[position()!=last()]">
250 <xsl:if test="position()>2 and local-name(.)!='none'">
251 <xsl:text>{}</xsl:text>
252 </xsl:if>
253 <xsl:if test="position() mod 2 and local-name(.)!='none'">
254 <xsl:text>_{</xsl:text>
255 <xsl:apply-templates select="."/>
256 <xsl:text>}</xsl:text>
257 </xsl:if>
258 <xsl:if test="not(position() mod 2) and local-name(.)!='none'">
259 <xsl:text>^{</xsl:text>
260 <xsl:apply-templates select="."/>
261 <xsl:text>}</xsl:text>
262 </xsl:if>
263 </xsl:for-each>
264 </xsl:template>
265
266 <xsl:template match="m:mmultiscripts">
267 <xsl:choose>
268 <xsl:when test="m:mprescripts">
269 <xsl:apply-templates select="." mode="mprescripts"/>
270 </xsl:when>
271 <xsl:otherwise>
272 <xsl:apply-templates select="./*[1]"/>
273 <xsl:for-each select="*[position()>1]">
274 <xsl:if test="position()>2 and local-name(.)!='none'">
275 <xsl:text>{}</xsl:text>
276 </xsl:if>
277 <xsl:if test="position() mod 2 and local-name(.)!='none'">
278 <xsl:text>_{</xsl:text>
279 <xsl:apply-templates select="."/>
280 <xsl:text>}</xsl:text>
281 </xsl:if>
282 <xsl:if test="not(position() mod 2) and local-name(.)!='none'">
283 <xsl:text>^{</xsl:text>
284 <xsl:apply-templates select="."/>
285 <xsl:text>}</xsl:text>
286 </xsl:if>
287 </xsl:for-each>
288 </xsl:otherwise>
289 </xsl:choose>
290 </xsl:template>
291
292 </xsl:stylesheet>