3 <!-- Copyright (C) 2000, HELM Team -->
5 <!-- This file is part of HELM, an Hypertextual, Electronic -->
6 <!-- Library of Mathematics, developed at the Computer Science -->
7 <!-- Department, University of Bologna, Italy. -->
9 <!-- HELM is free software; you can redistribute it and/or -->
10 <!-- modify it under the terms of the GNU General Public License -->
11 <!-- as published by the Free Software Foundation; either version 2 -->
12 <!-- of the License, or (at your option) any later version. -->
14 <!-- HELM is distributed in the hope that it will be useful, -->
15 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
16 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
17 <!-- GNU General Public License for more details. -->
19 <!-- You should have received a copy of the GNU General Public License -->
20 <!-- along with HELM; if not, write to the Free Software -->
21 <!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, -->
22 <!-- MA 02111-1307, USA. -->
24 <!-- For details, see the HELM World-Wide-Web page, -->
25 <!-- http://cs.unibo.it/helm/. -->
27 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
28 xmlns:m="http://www.w3.org/1998/Math/MathML">
30 <!--***********************************************************************-->
31 <!-- INIT style for HTML -->
32 <!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena -->
33 <!--***********************************************************************-->
35 <xsl:template name="mksymbol-reals">
36 <xsl:param name="symbol" select="''"/>
38 <xsl:when test="$UNICODEvsSYMBOL = 'symbol'">
39 <xsl:variable name="fontsymbol">
41 <xsl:when test="$symbol = 'leadsto'">
42 <xsl:value-of select="'®'"/>
45 <xsl:text>???</xsl:text>
49 <FONT FACE="symbol" color="'blue'">
50 <xsl:value-of select="$fontsymbol"/>
54 <xsl:variable name="unicodesymbol">
56 <xsl:when test="$symbol = 'leadsto'">
57 <xsl:value-of select="'→'"/>
60 <xsl:text>???</xsl:text>
65 <xsl:value-of select="$unicodesymbol"/>
71 <!-- **************************************************************** -->
73 <!-- **************************************************************** -->
78 <xsl:template mode="inline" match="m:apply[m:limit]">
79 <xsl:variable name="uri">
80 <xsl:value-of select="m:limit/@definitionURL"/>
83 <xsl:text>lim</xsl:text>
86 <xsl:apply-templates select="m:bvar/m:ci"/>
87 <xsl:call-template name="mksymbol-reals">
88 <xsl:with-param name="symbol" select="'leadsto'"/>
90 <xsl:apply-templates mode="inline" select="m:lowlimit"/>
92 <xsl:apply-templates mode="inline" select="*[4]"/>
95 <!-- DIFFERENTIATION -->
97 <xsl:template mode="inline" match="m:apply[m:diff]">
98 <xsl:variable name="uri">
99 <xsl:value-of select="m:diff/@definitionURL"/>
103 <xsl:text>/</xsl:text>
105 <xsl:text>d</xsl:text>
106 <xsl:value-of select="m:bvar/m:ci"/>
109 <xsl:apply-templates mode="inline" select="*[3]"/>
112 <!-- ABSOLUTE VALUE -->
113 <xsl:template mode="inline" match="m:apply[m:abs]">
114 <xsl:variable name="uri">
115 <xsl:value-of select="m:abs/@definitionURL"/>
117 <xsl:text>|</xsl:text>
118 <xsl:apply-templates mode="inline" select="*[2]"/>
119 <xsl:text>|</xsl:text>
124 <xsl:template mode="inline" match="m:apply[m:fact]">
125 <xsl:variable name="uri">
126 <xsl:value-of select="m:abs/@definitionURL"/>
128 <xsl:apply-templates mode="inline" select="*[2]"/>
129 <xsl:text>!</xsl:text>
134 <xsl:template match="m:apply[m:root]">
135 <xsl:variable name="uri">
136 <xsl:value-of select="m:abs/@definitionURL"/>
138 <xsl:text>(sqr</xsl:text>
139 <xsl:apply-templates mode="inline" select="*[2]"/>
140 <xsl:text>)</xsl:text>
145 <xsl:template mode="inline" match="m:apply[m:power]">
146 <xsl:variable name="uri">
147 <xsl:value-of select="m:power/@definitionURL"/>
149 <xsl:apply-templates mode="inline" select="*[2]"/>
151 <xsl:apply-templates mode="inline" select="*[3]"/>
155 <!-- MIN and MAX (binari: estendere) -->
157 <xsl:template mode="inline" match="m:apply[m:min|m:max]">
158 <xsl:variable name="uri">
159 <xsl:value-of select="*[1]/@definitionURL"/>
161 <xsl:variable name="symbol">
163 <xsl:when test="m:min">
164 <xsl:value-of select="'min'"/>
166 <xsl:when test="m:max">
167 <xsl:value-of select="'max'"/>
172 <xsl:value-of select="$symbol"/>
174 <xsl:text>{</xsl:text>
175 <xsl:apply-templates mode="inline" select="*[2]"/>
176 <xsl:text>, </xsl:text>
177 <xsl:apply-templates mode="inline" select="*[3]"/>
178 <xsl:text>}</xsl:text>
181 <!-- **************************************************************** -->
182 <!-- COUNTING MODE -->
183 <!-- **************************************************************** -->
186 <xsl:template match="m:apply[m:limit]">
187 <xsl:param name="current_indent" select="0"/>
188 <xsl:param name="width" select="$framewidth"/>
189 <xsl:variable name="uri">
190 <xsl:value-of select="m:limit/@definitionURL"/>
192 <xsl:variable name="charlength">
193 <xsl:apply-templates select="m:limit" mode="charcount"/>
196 <xsl:when test="$charlength > $framewidth">
198 <xsl:text>lim</xsl:text>
201 <xsl:apply-templates select="m:bvar/m:ci"/>
202 <xsl:call-template name="mksymbol-reals">
203 <xsl:with-param name="symbol" select="'leadsto'"/>
205 <xsl:apply-templates select="m:lowlimit"/>
208 <xsl:call-template name="make_indent">
209 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
211 <xsl:apply-templates select="*[4]">
212 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
213 </xsl:apply-templates>
216 <xsl:apply-templates mode="inline" select="."/>
221 <!-- DIFFERENTIATION -->
222 <xsl:template match="m:apply[m:diff]">
223 <xsl:param name="current_indent" select="0"/>
224 <xsl:param name="width" select="$framewidth"/>
225 <xsl:variable name="uri">
226 <xsl:value-of select="m:diff/@definitionURL"/>
230 <xsl:text>/</xsl:text>
232 <xsl:text>d</xsl:text>
233 <xsl:value-of select="m:bvar/m:ci"/>
236 <xsl:apply-templates select="*[3]">
237 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
238 </xsl:apply-templates>
242 <!-- ABSOLUTE VALUE -->
243 <xsl:template match="m:apply[m:abs]">
244 <xsl:param name="current_indent" select="0"/>
245 <xsl:param name="width" select="$framewidth"/>
246 <xsl:variable name="uri">
247 <xsl:value-of select="m:abs/@definitionURL"/>
249 <xsl:text>|</xsl:text>
250 <xsl:apply-templates select="*[2]">
251 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
252 </xsl:apply-templates>
253 <xsl:text>|</xsl:text>
258 <xsl:template match="m:apply[m:fact]">
259 <xsl:param name="current_indent" select="0"/>
260 <xsl:param name="width" select="$framewidth"/>
261 <xsl:variable name="uri">
262 <xsl:value-of select="m:abs/@definitionURL"/>
264 <xsl:apply-templates select="*[2]">
265 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
266 </xsl:apply-templates>
267 <xsl:text>!</xsl:text>
272 <xsl:template match="m:apply[m:root]">
273 <xsl:param name="current_indent" select="0"/>
274 <xsl:param name="width" select="$framewidth"/>
275 <xsl:variable name="uri">
276 <xsl:value-of select="m:abs/@definitionURL"/>
278 <xsl:text>(sqr</xsl:text>
279 <xsl:apply-templates select="*[2]">
280 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
281 </xsl:apply-templates>
282 <xsl:text>)</xsl:text>
287 <xsl:template match="m:apply[m:power]">
288 <xsl:param name="current_indent" select="0"/>
289 <xsl:param name="width" select="$framewidth"/>
290 <xsl:variable name="uri">
291 <xsl:value-of select="m:power/@definitionURL"/>
293 <xsl:apply-templates select="*[2]"/>
295 <xsl:apply-templates select="*[3]"/>
299 <!-- MIN and MAX (binari: estendere) -->
301 <xsl:template match="m:apply[m:min|m:max]">
302 <xsl:param name="current_indent" select="0"/>
303 <xsl:param name="width" select="$framewidth"/>
304 <xsl:variable name="uri">
305 <xsl:value-of select="*[1]/@definitionURL"/>
307 <xsl:variable name="charlength">
308 <xsl:apply-templates select="*[1]" mode="charcount"/>
310 <xsl:variable name="symbol">
312 <xsl:when test="m:min">
313 <xsl:value-of select="'min'"/>
315 <xsl:when test="m:max">
316 <xsl:value-of select="'max'"/>
321 <xsl:when test="$charlength > $framewidth">
323 <xsl:value-of select="$symbol"/>
325 <xsl:text>{</xsl:text>
326 <xsl:apply-templates select="*[2]">
327 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
328 </xsl:apply-templates>
329 <xsl:text>,</xsl:text>
331 <xsl:call-template name="make_indent">
332 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
334 <xsl:apply-templates select="*[3]">
335 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
336 </xsl:apply-templates>
337 <xsl:text>}</xsl:text>
340 <xsl:apply-templates mode="inline" select="."/>
347 <xsl:template match="m:abs|m:fact|m:root
348 |m:limit|m:diff|m:min|m:max" mode="charcount">
349 <xsl:param name="incurrent_length" select="0"/>
351 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
352 <xsl:variable name="siblength"><xsl:apply-templates select="following-sibling::*[position()=1]" mode="charcount"><xsl:with-param name="incurrent_length" select="$incurrent_length + string-length()"/></xsl:apply-templates></xsl:variable>
354 <xsl:when test="string($siblength) = """>
355 <xsl:value-of select="$incurrent_length + string-length()"/>
358 <xsl:value-of select="number($siblength)"/>
363 <xsl:value-of select="$incurrent_length + string-length()"/>