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 <!-- **************************************************************** -->
37 <!-- **************************************************************** -->
42 <xsl:template mode="inline" match="m:apply[m:limit]">
43 <xsl:variable name="uri">
44 <xsl:value-of select="m:limit/@definitionURL"/>
47 <xsl:attribute name="href">
48 <xsl:call-template name="makeURL">
49 <xsl:with-param name="url" select="$uri"/>
52 <xsl:text>lim</xsl:text>
55 <xsl:apply-templates select="m:bvar/m:ci"/>
56 <FONT FACE="symbol" mathcolor="blue">®</FONT>
57 <xsl:apply-templates mode="inline" select="m:lowlimit"/>
59 <xsl:apply-templates mode="inline" select="*[4]"/>
62 <!-- DIFFERENTIATION -->
64 <xsl:template mode="inline" match="m:apply[m:diff]">
65 <xsl:variable name="uri">
66 <xsl:value-of select="m:diff/@definitionURL"/>
69 <xsl:attribute name="href">
70 <xsl:call-template name="makeURL">
71 <xsl:with-param name="url" select="$uri"/>
75 <xsl:text>/</xsl:text>
77 <xsl:text>d</xsl:text>
78 <xsl:value-of select="m:bvar/m:ci"/>
81 <xsl:apply-templates mode="inline" select="*[3]"/>
84 <!-- ABSOLUTE VALUE -->
85 <xsl:template mode="inline" match="m:apply[m:abs]">
86 <xsl:variable name="uri">
87 <xsl:value-of select="m:abs/@definitionURL"/>
89 <xsl:text>|</xsl:text>
90 <xsl:apply-templates mode="inline" select="*[2]"/>
91 <xsl:text>|</xsl:text>
96 <xsl:template mode="inline" match="m:apply[m:fact]">
97 <xsl:variable name="uri">
98 <xsl:value-of select="m:abs/@definitionURL"/>
100 <xsl:apply-templates mode="inline" select="*[2]"/>
101 <xsl:text>!</xsl:text>
106 <xsl:template match="m:apply[m:root]">
107 <xsl:variable name="uri">
108 <xsl:value-of select="m:abs/@definitionURL"/>
110 <xsl:text>(sqr</xsl:text>
111 <xsl:apply-templates mode="inline" select="*[2]"/>
112 <xsl:text>)</xsl:text>
117 <xsl:template mode="inline" match="m:apply[m:power]">
118 <xsl:variable name="uri">
119 <xsl:value-of select="m:power/@definitionURL"/>
121 <xsl:apply-templates mode="inline" select="*[2]"/>
123 <xsl:apply-templates mode="inline" select="*[3]"/>
127 <!-- MIN and MAX (binari: estendere) -->
129 <xsl:template mode="inline" match="m:apply[m:min|m:max]">
130 <xsl:variable name="uri">
131 <xsl:value-of select="*[1]/@definitionURL"/>
133 <xsl:variable name="symbol">
135 <xsl:when test="m:min">
136 <xsl:value-of select="'min'"/>
138 <xsl:when test="m:max">
139 <xsl:value-of select="'max'"/>
144 <xsl:attribute name="href">
145 <xsl:call-template name="makeURL">
146 <xsl:with-param name="url" select="$uri"/>
149 <xsl:value-of select="$symbol"/>
151 <xsl:text>{</xsl:text>
152 <xsl:apply-templates mode="inline" select="*[2]"/>
153 <xsl:text>, </xsl:text>
154 <xsl:apply-templates mode="inline" select="*[3]"/>
155 <xsl:text>}</xsl:text>
158 <!-- **************************************************************** -->
159 <!-- COUNTING MODE -->
160 <!-- **************************************************************** -->
163 <xsl:template match="m:apply[m:limit]">
164 <xsl:param name="current_indent" select="0"/>
165 <xsl:param name="width" select="$framewidth"/>
166 <xsl:variable name="uri">
167 <xsl:value-of select="m:limit/@definitionURL"/>
169 <xsl:variable name="charlength">
170 <xsl:apply-templates select="m:limit" mode="charcount"/>
173 <xsl:when test="$charlength > $framewidth">
175 <xsl:attribute name="href">
176 <xsl:call-template name="makeURL">
177 <xsl:with-param name="url" select="$uri"/>
180 <xsl:text>lim</xsl:text>
183 <xsl:apply-templates select="m:bvar/m:ci"/>
184 <FONT FACE="symbol" mathcolor="blue">®</FONT>
185 <xsl:apply-templates select="m:lowlimit"/>
188 <xsl:call-template name="make_indent">
189 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
191 <xsl:apply-templates select="*[4]">
192 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
193 </xsl:apply-templates>
196 <xsl:apply-templates mode="inline" select="."/>
201 <!-- DIFFERENTIATION -->
202 <xsl:template match="m:apply[m:diff]">
203 <xsl:param name="current_indent" select="0"/>
204 <xsl:param name="width" select="$framewidth"/>
205 <xsl:variable name="uri">
206 <xsl:value-of select="m:diff/@definitionURL"/>
209 <xsl:attribute name="href">
210 <xsl:call-template name="makeURL">
211 <xsl:with-param name="url" select="$uri"/>
215 <xsl:text>/</xsl:text>
217 <xsl:text>d</xsl:text>
218 <xsl:value-of select="m:bvar/m:ci"/>
221 <xsl:apply-templates select="*[3]">
222 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
223 </xsl:apply-templates>
227 <!-- ABSOLUTE VALUE -->
228 <xsl:template match="m:apply[m:abs]">
229 <xsl:param name="current_indent" select="0"/>
230 <xsl:param name="width" select="$framewidth"/>
231 <xsl:variable name="uri">
232 <xsl:value-of select="m:abs/@definitionURL"/>
234 <xsl:text>|</xsl:text>
235 <xsl:apply-templates select="*[2]">
236 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
237 </xsl:apply-templates>
238 <xsl:text>|</xsl:text>
243 <xsl:template match="m:apply[m:fact]">
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:apply-templates select="*[2]">
250 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
251 </xsl:apply-templates>
252 <xsl:text>!</xsl:text>
257 <xsl:template match="m:apply[m:root]">
258 <xsl:param name="current_indent" select="0"/>
259 <xsl:param name="width" select="$framewidth"/>
260 <xsl:variable name="uri">
261 <xsl:value-of select="m:abs/@definitionURL"/>
263 <xsl:text>(sqr</xsl:text>
264 <xsl:apply-templates select="*[2]">
265 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
266 </xsl:apply-templates>
267 <xsl:text>)</xsl:text>
272 <xsl:template match="m:apply[m:power]">
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:power/@definitionURL"/>
278 <xsl:apply-templates select="*[2]"/>
280 <xsl:apply-templates select="*[3]"/>
284 <!-- MIN and MAX (binari: estendere) -->
286 <xsl:template match="m:apply[m:min|m:max]">
287 <xsl:param name="current_indent" select="0"/>
288 <xsl:param name="width" select="$framewidth"/>
289 <xsl:variable name="uri">
290 <xsl:value-of select="*[1]/@definitionURL"/>
292 <xsl:variable name="charlength">
293 <xsl:apply-templates select="*[1]" mode="charcount"/>
295 <xsl:variable name="symbol">
297 <xsl:when test="m:min">
298 <xsl:value-of select="'min'"/>
300 <xsl:when test="m:max">
301 <xsl:value-of select="'max'"/>
306 <xsl:when test="$charlength > $framewidth">
308 <xsl:attribute name="href">
309 <xsl:call-template name="makeURL">
310 <xsl:with-param name="url" select="$uri"/>
313 <xsl:value-of select="$symbol"/>
315 <xsl:text>{</xsl:text>
316 <xsl:apply-templates select="*[2]">
317 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
318 </xsl:apply-templates>
319 <xsl:text>,</xsl:text>
321 <xsl:call-template name="make_indent">
322 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
324 <xsl:apply-templates select="*[3]">
325 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
326 </xsl:apply-templates>
327 <xsl:text>}</xsl:text>
330 <xsl:apply-templates mode="inline" select="."/>
337 <xsl:template match="m:abs|m:fact|m:root
338 |m:limit|m:diff|m:min|m:max" mode="charcount">
339 <xsl:param name="incurrent_length" select="0"/>
341 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
342 <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>
344 <xsl:when test="string($siblength) = """>
345 <xsl:value-of select="$incurrent_length + string-length()"/>
348 <xsl:value-of select="number($siblength)"/>
353 <xsl:value-of select="$incurrent_length + string-length()"/>