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:text>lim</xsl:text>
50 <xsl:apply-templates select="m:bvar/m:ci"/>
51 <FONT FACE="symbol" mathcolor="blue">®</FONT>
52 <xsl:apply-templates mode="inline" select="m:lowlimit"/>
54 <xsl:apply-templates mode="inline" select="*[4]"/>
57 <!-- DIFFERENTIATION -->
59 <xsl:template mode="inline" match="m:apply[m:diff]">
60 <xsl:variable name="uri">
61 <xsl:value-of select="m:diff/@definitionURL"/>
65 <xsl:text>/</xsl:text>
67 <xsl:text>d</xsl:text>
68 <xsl:value-of select="m:bvar/m:ci"/>
71 <xsl:apply-templates mode="inline" select="*[3]"/>
74 <!-- ABSOLUTE VALUE -->
75 <xsl:template mode="inline" match="m:apply[m:abs]">
76 <xsl:variable name="uri">
77 <xsl:value-of select="m:abs/@definitionURL"/>
79 <xsl:text>|</xsl:text>
80 <xsl:apply-templates mode="inline" select="*[2]"/>
81 <xsl:text>|</xsl:text>
86 <xsl:template mode="inline" match="m:apply[m:fact]">
87 <xsl:variable name="uri">
88 <xsl:value-of select="m:abs/@definitionURL"/>
90 <xsl:apply-templates mode="inline" select="*[2]"/>
91 <xsl:text>!</xsl:text>
96 <xsl:template match="m:apply[m:root]">
97 <xsl:variable name="uri">
98 <xsl:value-of select="m:abs/@definitionURL"/>
100 <xsl:text>(sqr</xsl:text>
101 <xsl:apply-templates mode="inline" select="*[2]"/>
102 <xsl:text>)</xsl:text>
107 <xsl:template mode="inline" match="m:apply[m:power]">
108 <xsl:variable name="uri">
109 <xsl:value-of select="m:power/@definitionURL"/>
111 <xsl:apply-templates mode="inline" select="*[2]"/>
113 <xsl:apply-templates mode="inline" select="*[3]"/>
117 <!-- MIN and MAX (binari: estendere) -->
119 <xsl:template mode="inline" match="m:apply[m:min|m:max]">
120 <xsl:variable name="uri">
121 <xsl:value-of select="*[1]/@definitionURL"/>
123 <xsl:variable name="symbol">
125 <xsl:when test="m:min">
126 <xsl:value-of select="'min'"/>
128 <xsl:when test="m:max">
129 <xsl:value-of select="'max'"/>
134 <xsl:value-of select="$symbol"/>
136 <xsl:text>{</xsl:text>
137 <xsl:apply-templates mode="inline" select="*[2]"/>
138 <xsl:text>, </xsl:text>
139 <xsl:apply-templates mode="inline" select="*[3]"/>
140 <xsl:text>}</xsl:text>
143 <!-- **************************************************************** -->
144 <!-- COUNTING MODE -->
145 <!-- **************************************************************** -->
148 <xsl:template match="m:apply[m:limit]">
149 <xsl:param name="current_indent" select="0"/>
150 <xsl:param name="width" select="$framewidth"/>
151 <xsl:variable name="uri">
152 <xsl:value-of select="m:limit/@definitionURL"/>
154 <xsl:variable name="charlength">
155 <xsl:apply-templates select="m:limit" mode="charcount"/>
158 <xsl:when test="$charlength > $framewidth">
160 <xsl:text>lim</xsl:text>
163 <xsl:apply-templates select="m:bvar/m:ci"/>
164 <FONT FACE="symbol" mathcolor="blue">®</FONT>
165 <xsl:apply-templates select="m:lowlimit"/>
168 <xsl:call-template name="make_indent">
169 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
171 <xsl:apply-templates select="*[4]">
172 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
173 </xsl:apply-templates>
176 <xsl:apply-templates mode="inline" select="."/>
181 <!-- DIFFERENTIATION -->
182 <xsl:template match="m:apply[m:diff]">
183 <xsl:param name="current_indent" select="0"/>
184 <xsl:param name="width" select="$framewidth"/>
185 <xsl:variable name="uri">
186 <xsl:value-of select="m:diff/@definitionURL"/>
190 <xsl:text>/</xsl:text>
192 <xsl:text>d</xsl:text>
193 <xsl:value-of select="m:bvar/m:ci"/>
196 <xsl:apply-templates select="*[3]">
197 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
198 </xsl:apply-templates>
202 <!-- ABSOLUTE VALUE -->
203 <xsl:template match="m:apply[m:abs]">
204 <xsl:param name="current_indent" select="0"/>
205 <xsl:param name="width" select="$framewidth"/>
206 <xsl:variable name="uri">
207 <xsl:value-of select="m:abs/@definitionURL"/>
209 <xsl:text>|</xsl:text>
210 <xsl:apply-templates select="*[2]">
211 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
212 </xsl:apply-templates>
213 <xsl:text>|</xsl:text>
218 <xsl:template match="m:apply[m:fact]">
219 <xsl:param name="current_indent" select="0"/>
220 <xsl:param name="width" select="$framewidth"/>
221 <xsl:variable name="uri">
222 <xsl:value-of select="m:abs/@definitionURL"/>
224 <xsl:apply-templates select="*[2]">
225 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
226 </xsl:apply-templates>
227 <xsl:text>!</xsl:text>
232 <xsl:template match="m:apply[m:root]">
233 <xsl:param name="current_indent" select="0"/>
234 <xsl:param name="width" select="$framewidth"/>
235 <xsl:variable name="uri">
236 <xsl:value-of select="m:abs/@definitionURL"/>
238 <xsl:text>(sqr</xsl:text>
239 <xsl:apply-templates select="*[2]">
240 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
241 </xsl:apply-templates>
242 <xsl:text>)</xsl:text>
247 <xsl:template match="m:apply[m:power]">
248 <xsl:param name="current_indent" select="0"/>
249 <xsl:param name="width" select="$framewidth"/>
250 <xsl:variable name="uri">
251 <xsl:value-of select="m:power/@definitionURL"/>
253 <xsl:apply-templates select="*[2]"/>
255 <xsl:apply-templates select="*[3]"/>
259 <!-- MIN and MAX (binari: estendere) -->
261 <xsl:template match="m:apply[m:min|m:max]">
262 <xsl:param name="current_indent" select="0"/>
263 <xsl:param name="width" select="$framewidth"/>
264 <xsl:variable name="uri">
265 <xsl:value-of select="*[1]/@definitionURL"/>
267 <xsl:variable name="charlength">
268 <xsl:apply-templates select="*[1]" mode="charcount"/>
270 <xsl:variable name="symbol">
272 <xsl:when test="m:min">
273 <xsl:value-of select="'min'"/>
275 <xsl:when test="m:max">
276 <xsl:value-of select="'max'"/>
281 <xsl:when test="$charlength > $framewidth">
283 <xsl:value-of select="$symbol"/>
285 <xsl:text>{</xsl:text>
286 <xsl:apply-templates select="*[2]">
287 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
288 </xsl:apply-templates>
289 <xsl:text>,</xsl:text>
291 <xsl:call-template name="make_indent">
292 <xsl:with-param name="current_indent" select="$current_indent + 5"/>
294 <xsl:apply-templates select="*[3]">
295 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
296 </xsl:apply-templates>
297 <xsl:text>}</xsl:text>
300 <xsl:apply-templates mode="inline" select="."/>
307 <xsl:template match="m:abs|m:fact|m:root
308 |m:limit|m:diff|m:min|m:max" mode="charcount">
309 <xsl:param name="incurrent_length" select="0"/>
311 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
312 <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>
314 <xsl:when test="string($siblength) = """>
315 <xsl:value-of select="$incurrent_length + string-length()"/>
318 <xsl:value-of select="number($siblength)"/>
323 <xsl:value-of select="$incurrent_length + string-length()"/>