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 <!-- INLINE MODE : BASIC OPERATORS -->
37 <xsl:template mode="inline" match="m:apply[m:and|m:or|m:eq|m:neq|m:leq|m:lt
38 |m:geq|m:gt|m:plus|m:times]">
39 <xsl:variable name="uri">
40 <xsl:value-of select="*[1]/@definitionURL"/>
42 <xsl:variable name="symbol">
44 <xsl:when test="m:and">
45 <xsl:value-of select="'Ù'"/>
47 <xsl:when test="m:or">
48 <xsl:value-of select="'Ú'"/>
50 <xsl:when test="m:eq">
51 <xsl:value-of select="'='"/>
53 <xsl:when test="m:neq">
54 <xsl:value-of select="'¹'"/>
56 <xsl:when test="m:leq">
57 <xsl:value-of select="'£'"/>
59 <xsl:when test="m:lt">
60 <xsl:value-of select="'<'"/>
62 <xsl:when test="m:geq">
63 <xsl:value-of select="'³'"/>
65 <xsl:when test="m:gt">
66 <xsl:value-of select="'>'"/>
68 <xsl:when test="m:plus">
69 <xsl:value-of select="'+'"/>
71 <xsl:when test="m:times">
72 <xsl:value-of select="'*'"/>
76 <xsl:text>(</xsl:text>
77 <xsl:apply-templates mode="inline" select="*[2]"/>
79 <xsl:attribute name="href">
80 <xsl:call-template name="makeURL">
81 <xsl:with-param name="url" select="$uri"/>
84 <FONT FACE="symbol" mathcolor="blue">
85 <xsl:value-of select="$symbol"/>
88 <xsl:apply-templates mode="inline" select="*[3]"/>
89 <xsl:text>)</xsl:text>
92 <!-- INLINE MODE - MINUS (can be unary!) -->
94 <xsl:template mode="inline" match="m:apply[m:minus]">
95 <xsl:variable name="uri">
96 <xsl:value-of select="*[1]/@definitionURL"/>
99 <xsl:when test="count(child::*)=2">
101 <xsl:attribute name="href">
102 <xsl:call-template name="makeURL">
103 <xsl:with-param name="url" select="$uri"/>
106 <xsl:text>-</xsl:text>
108 <xsl:apply-templates mode="inline" select="*[2]"/>
111 <xsl:text>(</xsl:text>
112 <xsl:apply-templates mode="inline" select="*[2]"/>
114 <xsl:attribute name="href">
115 <xsl:call-template name="makeURL">
116 <xsl:with-param name="url" select="$uri"/>
119 <xsl:text>-</xsl:text>
121 <xsl:apply-templates mode="inline" select="*[3]"/>
122 <xsl:text>)</xsl:text>
127 <!-- INLINE MODE NOT -->
129 <xsl:template mode="inline" match="m:apply[m:not]">
130 <xsl:variable name="uri">
131 <xsl:value-of select="m:not/@definitionURL"/>
134 <xsl:attribute name="href">
135 <xsl:call-template name="makeURL">
136 <xsl:with-param name="url" select="$uri"/>
139 <FONT FACE="symbol" mathcolor="blue">Ø</FONT>
141 <xsl:apply-templates mode="inline" select="*[2]"/>
144 <!-- INLINE MODE EXISTS -->
146 <xsl:template mode="inline" match="m:apply[m:exists]">
147 <xsl:variable name="uri">
148 <xsl:value-of select="m:exists/@definitionURL"/>
151 <xsl:attribute name="href">
152 <xsl:call-template name="makeURL">
153 <xsl:with-param name="url" select="$uri"/>
156 <FONT FACE="symbol" mathcolor="blue">$</FONT>
158 <xsl:apply-templates select="m:bvar/m:ci"/>
159 <xsl:text>:</xsl:text>
160 <xsl:apply-templates mode="inline" select="m:condition"/>
161 <xsl:text>.</xsl:text>
162 <xsl:apply-templates mode="inline" select="*[last()]"/>
165 <!-- COUNTING MODE -->
167 <!-- BASIC OPERATORS -->
169 <xsl:template match="m:apply[m:and|m:or|m:eq|m:neq|m:leq|m:lt
170 |m:geq|m:gt|m:plus|m:times]">
171 <xsl:param name="current_indent" select="0"/>
172 <xsl:param name="width" select="$framewidth"/>
173 <xsl:variable name="uri">
174 <xsl:value-of select="*[1]/@definitionURL"/>
176 <xsl:variable name="charlength">
177 <xsl:apply-templates select="*[1]" mode="charcount"/>
179 <xsl:variable name="symbol">
181 <xsl:when test="m:and">
182 <xsl:value-of select="'Ù'"/>
184 <xsl:when test="m:or">
185 <xsl:value-of select="'Ú'"/>
187 <xsl:when test="m:eq">
188 <xsl:value-of select="'='"/>
190 <xsl:when test="m:neq">
191 <xsl:value-of select="'¹'"/>
193 <xsl:when test="m:leq">
194 <xsl:value-of select="'£'"/>
196 <xsl:when test="m:lt">
197 <xsl:value-of select="'<'"/>
199 <xsl:when test="m:geq">
200 <xsl:value-of select="'³'"/>
202 <xsl:when test="m:gt">
203 <xsl:value-of select="'>'"/>
205 <xsl:when test="m:plus">
206 <xsl:value-of select="'+'"/>
208 <xsl:when test="m:times">
209 <xsl:value-of select="'*'"/>
214 <xsl:when test="$charlength > $framewidth">
215 <xsl:text>(</xsl:text>
216 <xsl:apply-templates select="*[2]">
217 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
218 </xsl:apply-templates>
220 <xsl:call-template name="make_indent">
221 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
224 <xsl:attribute name="href">
225 <xsl:call-template name="makeURL">
226 <xsl:with-param name="url" select="$uri"/>
229 <FONT FACE="symbol" mathcolor="blue">
230 <xsl:value-of select="$symbol"/>
233 <xsl:apply-templates select="*[3]">
234 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
235 </xsl:apply-templates>
236 <xsl:text>)</xsl:text>
239 <xsl:apply-templates mode="inline" select="."/>
244 <!-- MINUS (can be unary!) -->
246 <xsl:template match="m:apply[m:minus]">
247 <xsl:param name="current_indent" select="0"/>
248 <xsl:param name="width" select="$framewidth"/>
249 <xsl:variable name="uri">
250 <xsl:value-of select="*[1]/@definitionURL"/>
253 <xsl:when test="count(child::*)=2">
255 <xsl:attribute name="href">
256 <xsl:call-template name="makeURL">
257 <xsl:with-param name="url" select="$uri"/>
260 <xsl:text>-</xsl:text>
262 <xsl:apply-templates select="*[2]">
263 <xsl:with-param name="current_indent" select="$current_indent + 1"/>
264 </xsl:apply-templates>
267 <xsl:variable name="charlength">
268 <xsl:apply-templates select="*[1]" mode="charcount"/>
271 <xsl:when test="$charlength > $framewidth">
272 <xsl:text>(</xsl:text>
273 <xsl:apply-templates select="*[2]">
274 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
275 </xsl:apply-templates>
277 <xsl:call-template name="make_indent">
278 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
281 <xsl:attribute name="href">
282 <xsl:call-template name="makeURL">
283 <xsl:with-param name="url" select="$uri"/>
286 <xsl:text>-</xsl:text>
288 <xsl:apply-templates select="*[3]">
289 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
290 </xsl:apply-templates>
291 <xsl:text>)</xsl:text>
294 <xsl:apply-templates mode="inline" select="."/>
303 <xsl:template match="m:apply[m:not]">
304 <xsl:param name="current_indent" select="0"/>
305 <xsl:param name="width" select="$framewidth"/>
306 <xsl:variable name="uri">
307 <xsl:value-of select="m:not/@definitionURL"/>
310 <xsl:attribute name="href">
311 <xsl:call-template name="makeURL">
312 <xsl:with-param name="url" select="$uri"/>
315 <FONT FACE="symbol" mathcolor="blue">Ø</FONT>
317 <xsl:apply-templates select="*[2]"/>
322 <xsl:template match="m:apply[m:exists]">
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:exists/@definitionURL"/>
328 <xsl:variable name="charlength">
329 <xsl:apply-templates select="m:exists" mode="charcount"/>
332 <xsl:when test="$charlength > $framewidth">
334 <xsl:attribute name="href">
335 <xsl:call-template name="makeURL">
336 <xsl:with-param name="url" select="$uri"/>
339 <FONT FACE="symbol" mathcolor="blue">$</FONT>
341 <xsl:apply-templates select="m:bvar/m:ci"/>
342 <xsl:text>:</xsl:text>
343 <xsl:apply-templates select="m:condition">
344 <xsl:with-param name="current_indent" select="$current_indent + 2 +
345 string-length(bvar/ci)"/>
346 </xsl:apply-templates>
348 <xsl:call-template name="make_indent">
349 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
351 <xsl:text>.</xsl:text>
352 <xsl:apply-templates select="*[last()]">
353 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
354 </xsl:apply-templates>
357 <xsl:apply-templates mode="inline" select="."/>
367 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:neq
368 |m:lt|m:leq|m:gt|m:geq|m:plus|m:minus|m:times" mode="charcount">
369 <xsl:param name="incurrent_length" select="0"/>
371 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
372 <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>
374 <xsl:when test="string($siblength) = """>
375 <xsl:value-of select="$incurrent_length + string-length()"/>
378 <xsl:value-of select="number($siblength)"/>
383 <xsl:value-of select="$incurrent_length + string-length()"/>