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="'®'"/>
44 <xsl:when test="$symbol = 'sum'">
45 <xsl:value-of select="'å'"/>
48 <xsl:text>???</xsl:text>
52 <FONT FACE="symbol" color="'blue'">
53 <xsl:value-of select="$fontsymbol"/>
57 <xsl:variable name="unicodesymbol">
59 <xsl:when test="$symbol = 'leadsto'">
60 <xsl:value-of select="'→'"/>
62 <xsl:when test="$symbol = 'sum'">
63 <xsl:value-of select="'∑'"/>
66 <xsl:text>???</xsl:text>
71 <xsl:value-of select="$unicodesymbol"/>
77 <!-- **************************************************************** -->
79 <!-- **************************************************************** -->
83 <xsl:template mode="inline" match="m:apply[m:sum]">
84 <xsl:variable name="uri">
85 <xsl:value-of select="m:sum/@definitionURL"/>
88 <xsl:when test="$uri != ''">
91 <FONT FACE="symbol" color="'blue'">
92 <xsl:value-of select="'å'"/>
94 <xsl:call-template name="mksymbol-reals">
95 <xsl:with-param name="symbol" select="'sum'"/>
101 <FONT FACE="symbol" color="'blue'">
102 <xsl:value-of select="'å'"/>
104 <xsl:call-template name="mksymbol-reals">
105 <xsl:with-param name="symbol" select="'sum'"/>
110 <xsl:when test="m:condition">
112 <xsl:apply-templates select="m:condition"/>
117 <xsl:apply-templates select="m:lowlimit/*[1]"/>
118 <xsl:call-template name="mksymbol-init">
119 <xsl:with-param name="symbol" select="'leq'"/>
121 <xsl:apply-templates select="m:bvar/*[1]"/>
122 <xsl:call-template name="mksymbol-init">
123 <xsl:with-param name="symbol" select="'leq'"/>
125 <xsl:apply-templates select="m:uplimit/*[1]"/>
129 <xsl:apply-templates mode="inline" select="*[position()=last()]"/>
136 <xsl:template mode="inline" match="m:apply[m:limit]">
137 <xsl:variable name="uri"><xsl:value-of select="m:limit/@definitionURL"/></xsl:variable>
139 <xsl:when test="$uri != ''">
141 <xsl:text>lim</xsl:text>
145 <xsl:text>lim</xsl:text>
149 <xsl:apply-templates select="m:bvar/m:ci"/>
150 <xsl:call-template name="mksymbol-reals">
151 <xsl:with-param name="symbol" select="'leadsto'"/>
153 <xsl:apply-templates mode="inline" select="m:lowlimit"/>
155 <xsl:apply-templates mode="inline" select="*[4]"/>
158 <!-- DIFFERENTIATION -->
160 <xsl:template mode="inline" match="m:apply[m:diff]">
161 <xsl:variable name="uri"><xsl:value-of select="m:diff/@definitionURL"/></xsl:variable>
163 <xsl:when test="$uri != ''">
166 <xsl:text>/</xsl:text>
168 <xsl:text>d</xsl:text>
169 <xsl:value-of select="m:bvar/m:ci"/>
175 <xsl:text>/</xsl:text>
177 <xsl:text>d</xsl:text>
178 <xsl:value-of select="m:bvar/m:ci"/>
182 <xsl:apply-templates mode="inline" select="*[3]"/>
185 <!-- ABSOLUTE VALUE -->
186 <xsl:template mode="inline" match="m:apply[m:abs]">
187 <xsl:variable name="uri">
188 <xsl:value-of select="m:abs/@definitionURL"/>
190 <xsl:text>|</xsl:text>
191 <xsl:apply-templates mode="inline" select="*[2]"/>
192 <xsl:text>|</xsl:text>
197 <xsl:template mode="inline" match="m:apply[m:fact]">
198 <xsl:variable name="uri">
199 <xsl:value-of select="m:abs/@definitionURL"/>
201 <xsl:apply-templates mode="inline" select="*[2]"/>
202 <xsl:text>!</xsl:text>
207 <xsl:template match="m:apply[m:root]">
208 <xsl:variable name="uri">
209 <xsl:value-of select="m:abs/@definitionURL"/>
211 <xsl:text>(sqr</xsl:text>
212 <xsl:apply-templates mode="inline" select="*[2]"/>
213 <xsl:text>)</xsl:text>
218 <xsl:template mode="inline" match="m:apply[m:power]">
219 <xsl:variable name="uri">
220 <xsl:value-of select="m:power/@definitionURL"/>
222 <xsl:apply-templates mode="inline" select="*[2]"/>
224 <xsl:apply-templates mode="inline" select="*[3]"/>
228 <!-- MIN and MAX (binari: estendere) -->
230 <xsl:template mode="inline" match="m:apply[m:min|m:max]">
231 <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
232 <xsl:variable name="symbol">
234 <xsl:when test="m:min">
235 <xsl:value-of select="'min'"/>
237 <xsl:when test="m:max">
238 <xsl:value-of select="'max'"/>
243 <xsl:when test="$uri != ''">
245 <xsl:value-of select="$symbol"/>
249 <xsl:value-of select="$symbol"/>
252 <xsl:text>{</xsl:text>
253 <xsl:apply-templates mode="inline" select="*[2]"/>
254 <xsl:text>, </xsl:text>
255 <xsl:apply-templates mode="inline" select="*[3]"/>
256 <xsl:text>}</xsl:text>
259 <!-- **************************************************************** -->
260 <!-- COUNTING MODE -->
261 <!-- **************************************************************** -->
263 <xsl:template match="m:apply[m:sum]">
264 <xsl:apply-templates mode="inline" select="."/>
267 <xsl:template match="m:apply[m:limit]">
268 <xsl:param name="current_indent" select="0"/>
269 <xsl:param name="width" select="$framewidth"/>
270 <xsl:variable name="uri"><xsl:value-of select="m:limit/@definitionURL"/></xsl:variable>
271 <xsl:variable name="charlength">
272 <xsl:apply-templates select="m:limit" mode="charcount"/>
275 <xsl:when test="$charlength > $framewidth">
277 <xsl:when test="$uri != ''">
279 <xsl:text>lim</xsl:text>
283 <xsl:text>lim</xsl:text>
287 <xsl:apply-templates select="m:bvar/m:ci"/>
288 <xsl:call-template name="mksymbol-reals">
289 <xsl:with-param name="symbol" select="'leadsto'"/>
291 <xsl:apply-templates select="m:lowlimit"/>
294 <xsl:call-template name="make_indent">
295 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
297 <xsl:apply-templates select="*[4]">
298 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
299 </xsl:apply-templates>
302 <xsl:apply-templates mode="inline" select="."/>
307 <!-- DIFFERENTIATION -->
308 <xsl:template match="m:apply[m:diff]">
309 <xsl:param name="current_indent" select="0"/>
310 <xsl:param name="width" select="$framewidth"/>
311 <xsl:variable name="uri"><xsl:value-of select="m:diff/@definitionURL"/></xsl:variable>
313 <xsl:when test="$uri != ''">
316 <xsl:text>/</xsl:text>
318 <xsl:text>d</xsl:text>
319 <xsl:value-of select="m:bvar/m:ci"/>
325 <xsl:text>/</xsl:text>
327 <xsl:text>d</xsl:text>
328 <xsl:value-of select="m:bvar/m:ci"/>
332 <xsl:apply-templates select="*[3]">
333 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
334 </xsl:apply-templates>
338 <!-- ABSOLUTE VALUE -->
339 <xsl:template match="m:apply[m:abs]">
340 <xsl:param name="current_indent" select="0"/>
341 <xsl:param name="width" select="$framewidth"/>
342 <xsl:variable name="uri">
343 <xsl:value-of select="m:abs/@definitionURL"/>
345 <xsl:text>|</xsl:text>
346 <xsl:apply-templates select="*[2]">
347 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
348 </xsl:apply-templates>
349 <xsl:text>|</xsl:text>
354 <xsl:template match="m:apply[m:fact]">
355 <xsl:param name="current_indent" select="0"/>
356 <xsl:param name="width" select="$framewidth"/>
357 <xsl:variable name="uri">
358 <xsl:value-of select="m:abs/@definitionURL"/>
360 <xsl:apply-templates select="*[2]">
361 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
362 </xsl:apply-templates>
363 <xsl:text>!</xsl:text>
368 <xsl:template match="m:apply[m:root]">
369 <xsl:param name="current_indent" select="0"/>
370 <xsl:param name="width" select="$framewidth"/>
371 <xsl:variable name="uri">
372 <xsl:value-of select="m:abs/@definitionURL"/>
374 <xsl:text>(sqr</xsl:text>
375 <xsl:apply-templates select="*[2]">
376 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
377 </xsl:apply-templates>
378 <xsl:text>)</xsl:text>
383 <xsl:template match="m:apply[m:power]">
384 <xsl:param name="current_indent" select="0"/>
385 <xsl:param name="width" select="$framewidth"/>
386 <xsl:variable name="uri">
387 <xsl:value-of select="m:power/@definitionURL"/>
389 <xsl:apply-templates select="*[2]"/>
391 <xsl:apply-templates select="*[3]"/>
395 <!-- MIN and MAX (binari: estendere) -->
397 <xsl:template match="m:apply[m:min|m:max]">
398 <xsl:param name="current_indent" select="0"/>
399 <xsl:param name="width" select="$framewidth"/>
400 <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
401 <xsl:variable name="charlength">
402 <xsl:apply-templates select="*[1]" mode="charcount"/>
404 <xsl:variable name="symbol">
406 <xsl:when test="m:min">
407 <xsl:value-of select="'min'"/>
409 <xsl:when test="m:max">
410 <xsl:value-of select="'max'"/>
415 <xsl:when test="$charlength > $framewidth">
417 <xsl:when test="$uri != ''">
419 <xsl:value-of select="$symbol"/>
423 <xsl:value-of select="$symbol"/>
426 <xsl:text>{</xsl:text>
427 <xsl:apply-templates select="*[2]">
428 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
429 </xsl:apply-templates>
430 <xsl:text>,</xsl:text>
432 <xsl:call-template name="make_indent">
433 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
435 <xsl:apply-templates select="*[3]">
436 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
437 </xsl:apply-templates>
438 <xsl:text>}</xsl:text>
441 <xsl:apply-templates mode="inline" select="."/>
448 <xsl:template match="m:abs|m:fact|m:root|
449 m:sum|m:limit|m:diff|m:min|m:max" mode="charcount">
450 <xsl:param name="incurrent_length" select="0"/>
452 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
453 <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>
455 <xsl:when test="string($siblength) = """>
456 <xsl:value-of select="$incurrent_length + string-length()"/>
459 <xsl:value-of select="number($siblength)"/>
464 <xsl:value-of select="$incurrent_length + string-length()"/>