[SPIP] ~v3.0.25-->v3.0.26
[lhc/web/www.git] / www / plugins / odt2spip_30 / inc / xsltml / glayout.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: glayout.xsl, 2002/17/05 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:mfrac">
14 <xsl:choose>
15 <xsl:when test="@bevelled='true'">
16 <!-- <xsl:text>\raisebox{1ex}{</xsl:text>
17 <xsl:apply-templates select="./*[1]"/>
18 <xsl:text>}\!\left/ \!\raisebox{-1ex}{</xsl:text>
19 <xsl:apply-templates select="./*[2]"/>
20 <xsl:text>}\right.</xsl:text>-->
21 </xsl:when>
22 <xsl:when test="@linethickness">
23 <xsl:text>\genfrac{}{}{</xsl:text>
24 <xsl:choose>
25 <xsl:when test="number(@linethickness)">
26 <xsl:value-of select="@linethickness div 10"/>
27 <xsl:text>ex</xsl:text>
28 </xsl:when>
29 <xsl:when test="@linethickness='thin'">
30 <xsl:text>.05ex</xsl:text>
31 </xsl:when>
32 <xsl:when test="@linethickness='medium'"/>
33 <xsl:when test="@linethickness='thick'">
34 <xsl:text>.2ex</xsl:text>
35 </xsl:when>
36 <xsl:otherwise>
37 <xsl:value-of select="@linethickness"/>
38 </xsl:otherwise>
39 </xsl:choose>
40 <xsl:text>}{}{</xsl:text>
41 </xsl:when>
42 <xsl:otherwise>
43 <xsl:text>\frac{</xsl:text>
44 </xsl:otherwise>
45 </xsl:choose>
46 <xsl:if test="@numalign='right'">
47 <xsl:text>\hfill </xsl:text>
48 </xsl:if>
49 <xsl:apply-templates select="./*[1]"/>
50 <xsl:if test="@numalign='left'">
51 <xsl:text>\hfill </xsl:text>
52 </xsl:if>
53 <xsl:text>}{</xsl:text>
54 <xsl:if test="@denomalign='right'">
55 <xsl:text>\hfill </xsl:text>
56 </xsl:if>
57 <xsl:apply-templates select="./*[2]"/>
58 <xsl:if test="@denomalign='left'">
59 <xsl:text>\hfill </xsl:text>
60 </xsl:if>
61 <xsl:text>}</xsl:text>
62 </xsl:template>
63
64 <xsl:template match="m:mroot">
65 <xsl:choose>
66 <xsl:when test="count(./*)=2">
67 <xsl:text>\sqrt[</xsl:text>
68 <xsl:apply-templates select="./*[2]"/>
69 <xsl:text>]{</xsl:text>
70 <xsl:apply-templates select="./*[1]"/>
71 <xsl:text>}</xsl:text>
72 </xsl:when>
73 <xsl:otherwise>
74 <!-- number of argumnets is not 2 - code 25 -->
75 <xsl:message>exception 25:</xsl:message>
76 <xsl:text>\text{exception 25:}</xsl:text>
77 </xsl:otherwise>
78 </xsl:choose>
79 </xsl:template>
80
81 <xsl:template match="m:msqrt">
82 <xsl:text>\sqrt{</xsl:text>
83 <xsl:apply-templates/>
84 <xsl:text>}</xsl:text>
85 </xsl:template>
86
87 <xsl:template match="m:mfenced">
88 <xsl:choose>
89 <xsl:when test="@open">
90 <xsl:if test="translate(@open,'{}[]()|','{{{{{{{')='{'">
91 <xsl:text>\left</xsl:text>
92 </xsl:if>
93 <xsl:if test="@open='{' or @open='}'">
94 <xsl:text>\</xsl:text>
95 </xsl:if>
96 <xsl:value-of select="@open"/>
97 </xsl:when>
98 <xsl:otherwise><xsl:text>\left(</xsl:text></xsl:otherwise>
99 </xsl:choose>
100 <xsl:choose>
101 <xsl:when test="count(./*)>1">
102 <xsl:variable name="symbol">
103 <xsl:choose>
104 <xsl:when test="@separators">
105 <xsl:call-template name="startspace">
106 <xsl:with-param name="symbol" select="@separators"/>
107 </xsl:call-template>
108 </xsl:when>
109 <xsl:otherwise>,</xsl:otherwise>
110 </xsl:choose>
111 </xsl:variable>
112 <xsl:for-each select="./*">
113 <xsl:apply-templates select="."/>
114 <xsl:if test="not(position()=last())">
115 <xsl:choose>
116 <xsl:when test="position()>string-length($symbol)">
117 <xsl:value-of select="substring($symbol,string-length($symbol))"/>
118 </xsl:when>
119 <xsl:otherwise>
120 <xsl:value-of select="substring($symbol,position(),1)"/>
121 </xsl:otherwise>
122 </xsl:choose>
123 </xsl:if>
124 </xsl:for-each>
125 </xsl:when>
126 <xsl:otherwise>
127 <xsl:apply-templates/>
128 </xsl:otherwise>
129 </xsl:choose>
130 <xsl:choose>
131 <xsl:when test="@close">
132 <xsl:if test="translate(@open,'{}[]()|','{{{{{{{')='{'">
133 <xsl:text>\right</xsl:text>
134 </xsl:if>
135 <xsl:if test="@open='{' or @open='}'">
136 <xsl:text>\</xsl:text>
137 </xsl:if>
138 <xsl:value-of select="@close"/>
139 </xsl:when>
140 <xsl:otherwise><xsl:text>\right)</xsl:text></xsl:otherwise>
141 </xsl:choose>
142 </xsl:template>
143
144 <xsl:template match="m:mphantom">
145 <xsl:text>\phantom{</xsl:text>
146 <xsl:apply-templates/>
147 <xsl:text>}</xsl:text>
148 </xsl:template>
149
150 <xsl:template match="m:menclose">
151 <xsl:choose>
152 <xsl:when test="@notation = 'actuarial'">
153 <xsl:text>\overline{</xsl:text>
154 <xsl:apply-templates/>
155 <xsl:text>\hspace{.2em}|}</xsl:text>
156 </xsl:when>
157 <xsl:when test="@notation = 'radical'">
158 <xsl:text>\sqrt{</xsl:text>
159 <xsl:apply-templates/>
160 <xsl:text>}</xsl:text>
161 </xsl:when>
162 <xsl:otherwise>
163 <xsl:text>\overline{)</xsl:text>
164 <xsl:apply-templates/>
165 <xsl:text>}</xsl:text>
166 </xsl:otherwise>
167 </xsl:choose>
168 </xsl:template>
169
170 <xsl:template match="m:mrow">
171 <xsl:apply-templates/>
172 </xsl:template>
173
174 <xsl:template match="m:mstyle">
175 <xsl:if test="@background">
176 <xsl:text>\colorbox[rgb]{</xsl:text>
177 <xsl:call-template name="color">
178 <xsl:with-param name="color" select="@background"/>
179 </xsl:call-template>
180 <xsl:text>}{$</xsl:text>
181 </xsl:if>
182 <xsl:if test="@color">
183 <xsl:text>\textcolor[rgb]{</xsl:text>
184 <xsl:call-template name="color">
185 <xsl:with-param name="color" select="@color"/>
186 </xsl:call-template>
187 <xsl:text>}{</xsl:text>
188 </xsl:if>
189 <xsl:apply-templates/>
190 <xsl:if test="@color">
191 <xsl:text>}</xsl:text>
192 </xsl:if>
193 <xsl:if test="@background">
194 <xsl:text>$}</xsl:text>
195 </xsl:if>
196 </xsl:template>
197 <!--
198
199 <xsl:template match="m:mstyle">
200 <xsl:if test="@displaystyle='true'">
201 <xsl:text>{\displaystyle</xsl:text>
202 </xsl:if>
203 <xsl:if test="@scriptlevel=2">
204 <xsl:text>{\scriptscriptstyle</xsl:text>
205 </xsl:if>
206 <xsl:apply-templates/>
207 <xsl:if test="@scriptlevel=2">
208 <xsl:text>}</xsl:text>
209 </xsl:if>
210 <xsl:if test="@displaystyle='true'">
211 <xsl:text>}</xsl:text>
212 </xsl:if>
213 </xsl:template>
214 -->
215
216 <xsl:template match="m:merror">
217 <xsl:apply-templates/>
218 </xsl:template>
219
220 </xsl:stylesheet>