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"><xsl:value-of select="m:limit/@definitionURL"/></xsl:variable>
81 <xsl:when test="$uri != ''">
83 <xsl:text>lim</xsl:text>
87 <xsl:text>lim</xsl:text>
91 <xsl:apply-templates select="m:bvar/m:ci"/>
92 <xsl:call-template name="mksymbol-reals">
93 <xsl:with-param name="symbol" select="'leadsto'"/>
95 <xsl:apply-templates mode="inline" select="m:lowlimit"/>
97 <xsl:apply-templates mode="inline" select="*[4]"/>
100 <!-- DIFFERENTIATION -->
102 <xsl:template mode="inline" match="m:apply[m:diff]">
103 <xsl:variable name="uri"><xsl:value-of select="m:diff/@definitionURL"/></xsl:variable>
105 <xsl:when test="$uri != ''">
108 <xsl:text>/</xsl:text>
110 <xsl:text>d</xsl:text>
111 <xsl:value-of select="m:bvar/m:ci"/>
117 <xsl:text>/</xsl:text>
119 <xsl:text>d</xsl:text>
120 <xsl:value-of select="m:bvar/m:ci"/>
124 <xsl:apply-templates mode="inline" select="*[3]"/>
127 <!-- ABSOLUTE VALUE -->
128 <xsl:template mode="inline" match="m:apply[m:abs]">
129 <xsl:variable name="uri">
130 <xsl:value-of select="m:abs/@definitionURL"/>
132 <xsl:text>|</xsl:text>
133 <xsl:apply-templates mode="inline" select="*[2]"/>
134 <xsl:text>|</xsl:text>
139 <xsl:template mode="inline" match="m:apply[m:fact]">
140 <xsl:variable name="uri">
141 <xsl:value-of select="m:abs/@definitionURL"/>
143 <xsl:apply-templates mode="inline" select="*[2]"/>
144 <xsl:text>!</xsl:text>
149 <xsl:template match="m:apply[m:root]">
150 <xsl:variable name="uri">
151 <xsl:value-of select="m:abs/@definitionURL"/>
153 <xsl:text>(sqr</xsl:text>
154 <xsl:apply-templates mode="inline" select="*[2]"/>
155 <xsl:text>)</xsl:text>
160 <xsl:template mode="inline" match="m:apply[m:power]">
161 <xsl:variable name="uri">
162 <xsl:value-of select="m:power/@definitionURL"/>
164 <xsl:apply-templates mode="inline" select="*[2]"/>
166 <xsl:apply-templates mode="inline" select="*[3]"/>
170 <!-- MIN and MAX (binari: estendere) -->
172 <xsl:template mode="inline" match="m:apply[m:min|m:max]">
173 <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
174 <xsl:variable name="symbol">
176 <xsl:when test="m:min">
177 <xsl:value-of select="'min'"/>
179 <xsl:when test="m:max">
180 <xsl:value-of select="'max'"/>
185 <xsl:when test="$uri != ''">
187 <xsl:value-of select="$symbol"/>
191 <xsl:value-of select="$symbol"/>
194 <xsl:text>{</xsl:text>
195 <xsl:apply-templates mode="inline" select="*[2]"/>
196 <xsl:text>, </xsl:text>
197 <xsl:apply-templates mode="inline" select="*[3]"/>
198 <xsl:text>}</xsl:text>
201 <!-- **************************************************************** -->
202 <!-- COUNTING MODE -->
203 <!-- **************************************************************** -->
206 <xsl:template match="m:apply[m:limit]">
207 <xsl:param name="current_indent" select="0"/>
208 <xsl:param name="width" select="$framewidth"/>
209 <xsl:variable name="uri"><xsl:value-of select="m:limit/@definitionURL"/></xsl:variable>
210 <xsl:variable name="charlength">
211 <xsl:apply-templates select="m:limit" mode="charcount"/>
214 <xsl:when test="$charlength > $framewidth">
216 <xsl:when test="$uri != ''">
218 <xsl:text>lim</xsl:text>
222 <xsl:text>lim</xsl:text>
226 <xsl:apply-templates select="m:bvar/m:ci"/>
227 <xsl:call-template name="mksymbol-reals">
228 <xsl:with-param name="symbol" select="'leadsto'"/>
230 <xsl:apply-templates select="m:lowlimit"/>
233 <xsl:call-template name="make_indent">
234 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
236 <xsl:apply-templates select="*[4]">
237 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
238 </xsl:apply-templates>
241 <xsl:apply-templates mode="inline" select="."/>
246 <!-- DIFFERENTIATION -->
247 <xsl:template match="m:apply[m:diff]">
248 <xsl:param name="current_indent" select="0"/>
249 <xsl:param name="width" select="$framewidth"/>
250 <xsl:variable name="uri"><xsl:value-of select="m:diff/@definitionURL"/></xsl:variable>
252 <xsl:when test="$uri != ''">
255 <xsl:text>/</xsl:text>
257 <xsl:text>d</xsl:text>
258 <xsl:value-of select="m:bvar/m:ci"/>
264 <xsl:text>/</xsl:text>
266 <xsl:text>d</xsl:text>
267 <xsl:value-of select="m:bvar/m:ci"/>
271 <xsl:apply-templates select="*[3]">
272 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
273 </xsl:apply-templates>
277 <!-- ABSOLUTE VALUE -->
278 <xsl:template match="m:apply[m:abs]">
279 <xsl:param name="current_indent" select="0"/>
280 <xsl:param name="width" select="$framewidth"/>
281 <xsl:variable name="uri">
282 <xsl:value-of select="m:abs/@definitionURL"/>
284 <xsl:text>|</xsl:text>
285 <xsl:apply-templates select="*[2]">
286 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
287 </xsl:apply-templates>
288 <xsl:text>|</xsl:text>
293 <xsl:template match="m:apply[m:fact]">
294 <xsl:param name="current_indent" select="0"/>
295 <xsl:param name="width" select="$framewidth"/>
296 <xsl:variable name="uri">
297 <xsl:value-of select="m:abs/@definitionURL"/>
299 <xsl:apply-templates select="*[2]">
300 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
301 </xsl:apply-templates>
302 <xsl:text>!</xsl:text>
307 <xsl:template match="m:apply[m:root]">
308 <xsl:param name="current_indent" select="0"/>
309 <xsl:param name="width" select="$framewidth"/>
310 <xsl:variable name="uri">
311 <xsl:value-of select="m:abs/@definitionURL"/>
313 <xsl:text>(sqr</xsl:text>
314 <xsl:apply-templates select="*[2]">
315 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
316 </xsl:apply-templates>
317 <xsl:text>)</xsl:text>
322 <xsl:template match="m:apply[m:power]">
323 <xsl:param name="current_indent" select="0"/>
324 <xsl:param name="width" select="$framewidth"/>
325 <xsl:variable name="uri">
326 <xsl:value-of select="m:power/@definitionURL"/>
328 <xsl:apply-templates select="*[2]"/>
330 <xsl:apply-templates select="*[3]"/>
334 <!-- MIN and MAX (binari: estendere) -->
336 <xsl:template match="m:apply[m:min|m:max]">
337 <xsl:param name="current_indent" select="0"/>
338 <xsl:param name="width" select="$framewidth"/>
339 <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
340 <xsl:variable name="charlength">
341 <xsl:apply-templates select="*[1]" mode="charcount"/>
343 <xsl:variable name="symbol">
345 <xsl:when test="m:min">
346 <xsl:value-of select="'min'"/>
348 <xsl:when test="m:max">
349 <xsl:value-of select="'max'"/>
354 <xsl:when test="$charlength > $framewidth">
356 <xsl:when test="$uri != ''">
358 <xsl:value-of select="$symbol"/>
362 <xsl:value-of select="$symbol"/>
365 <xsl:text>{</xsl:text>
366 <xsl:apply-templates select="*[2]">
367 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
368 </xsl:apply-templates>
369 <xsl:text>,</xsl:text>
371 <xsl:call-template name="make_indent">
372 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
374 <xsl:apply-templates select="*[3]">
375 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
376 </xsl:apply-templates>
377 <xsl:text>}</xsl:text>
380 <xsl:apply-templates mode="inline" select="."/>
387 <xsl:template match="m:abs|m:fact|m:root
388 |m:limit|m:diff|m:min|m:max" mode="charcount">
389 <xsl:param name="incurrent_length" select="0"/>
391 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
392 <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>
394 <xsl:when test="string($siblength) = """>
395 <xsl:value-of select="$incurrent_length + string-length()"/>
398 <xsl:value-of select="number($siblength)"/>
403 <xsl:value-of select="$incurrent_length + string-length()"/>