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:value-of select="concat(string($header),string($uri))"/>
82 <FONT FACE="symbol" mathcolor="blue">
83 <xsl:value-of select="$symbol"/>
86 <xsl:apply-templates mode="inline" select="*[3]"/>
87 <xsl:text>)</xsl:text>
90 <!-- INLINE MODE - MINUS (can be unary!) -->
92 <xsl:template mode="inline" match="m:apply[m:minus]">
93 <xsl:variable name="uri">
94 <xsl:value-of select="*[1]/@definitionURL"/>
97 <xsl:when test="count(child::*)=2">
99 <xsl:attribute name="href">
100 <xsl:value-of select="concat(string($header),string($uri))"/>
102 <xsl:text>-</xsl:text>
104 <xsl:apply-templates mode="inline" select="*[2]"/>
107 <xsl:text>(</xsl:text>
108 <xsl:apply-templates mode="inline" select="*[2]"/>
110 <xsl:attribute name="href">
111 <xsl:value-of select="concat(string($header),string($uri))"/>
113 <xsl:text>-</xsl:text>
115 <xsl:apply-templates mode="inline" select="*[3]"/>
116 <xsl:text>)</xsl:text>
121 <!-- INLINE MODE NOT -->
123 <xsl:template mode="inline" match="m:apply[m:not]">
124 <xsl:variable name="uri">
125 <xsl:value-of select="m:not/@definitionURL"/>
128 <xsl:attribute name="href">
129 <xsl:value-of select="concat(string($header),string($uri))"/>
131 <FONT FACE="symbol" mathcolor="blue">Ø</FONT>
133 <xsl:apply-templates mode="inline" select="*[2]"/>
136 <!-- INLINE MODE EXISTS -->
138 <xsl:template mode="inline" match="m:apply[m:exists]">
139 <xsl:variable name="uri">
140 <xsl:value-of select="m:exists/@definitionURL"/>
143 <xsl:attribute name="href">
144 <xsl:value-of select="concat(string($header),string($uri))"/>
146 <FONT FACE="symbol" mathcolor="blue">$</FONT>
148 <xsl:apply-templates select="m:bvar/m:ci"/>
149 <xsl:text>:</xsl:text>
150 <xsl:apply-templates mode="inline" select="m:condition"/>
151 <xsl:text>.</xsl:text>
152 <xsl:apply-templates mode="inline" select="*[last()]"/>
155 <!-- COUNTING MODE -->
157 <!-- BASIC OPERATORS -->
159 <xsl:template match="m:apply[m:and|m:or|m:eq|m:neq|m:leq|m:lt
160 |m:geq|m:gt|m:plus|m:times]">
161 <xsl:param name="current_indent" select="0"/>
162 <xsl:param name="width" select="$framewidth"/>
163 <xsl:variable name="uri">
164 <xsl:value-of select="*[1]/@definitionURL"/>
166 <xsl:variable name="charlength">
167 <xsl:apply-templates select="*[1]" mode="charcount"/>
169 <xsl:variable name="symbol">
171 <xsl:when test="m:and">
172 <xsl:value-of select="'Ù'"/>
174 <xsl:when test="m:or">
175 <xsl:value-of select="'Ú'"/>
177 <xsl:when test="m:eq">
178 <xsl:value-of select="'='"/>
180 <xsl:when test="m:neq">
181 <xsl:value-of select="'¹'"/>
183 <xsl:when test="m:leq">
184 <xsl:value-of select="'£'"/>
186 <xsl:when test="m:lt">
187 <xsl:value-of select="'<'"/>
189 <xsl:when test="m:geq">
190 <xsl:value-of select="'³'"/>
192 <xsl:when test="m:gt">
193 <xsl:value-of select="'>'"/>
195 <xsl:when test="m:plus">
196 <xsl:value-of select="'+'"/>
198 <xsl:when test="m:times">
199 <xsl:value-of select="'*'"/>
204 <xsl:when test="$charlength > $framewidth">
205 <xsl:text>(</xsl:text>
206 <xsl:apply-templates select="*[2]">
207 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
208 </xsl:apply-templates>
210 <xsl:call-template name="make_indent">
211 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
214 <xsl:attribute name="href">
215 <xsl:value-of select="concat(string($header),string($uri))"/>
217 <FONT FACE="symbol" mathcolor="blue">
218 <xsl:value-of select="$symbol"/>
221 <xsl:apply-templates select="*[3]">
222 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
223 </xsl:apply-templates>
224 <xsl:text>)</xsl:text>
227 <xsl:apply-templates mode="inline" select="."/>
232 <!-- MINUS (can be unary!) -->
234 <xsl:template match="m:apply[m:minus]">
235 <xsl:param name="current_indent" select="0"/>
236 <xsl:param name="width" select="$framewidth"/>
237 <xsl:variable name="uri">
238 <xsl:value-of select="*[1]/@definitionURL"/>
241 <xsl:when test="count(child::*)=2">
243 <xsl:attribute name="href">
244 <xsl:value-of select="concat(string($header),string($uri))"/>
246 <xsl:text>-</xsl:text>
248 <xsl:apply-templates select="*[2]">
249 <xsl:with-param name="current_indent" select="$current_indent + 1"/>
250 </xsl:apply-templates>
253 <xsl:variable name="charlength">
254 <xsl:apply-templates select="*[1]" mode="charcount"/>
257 <xsl:when test="$charlength > $framewidth">
258 <xsl:text>(</xsl:text>
259 <xsl:apply-templates select="*[2]">
260 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
261 </xsl:apply-templates>
263 <xsl:call-template name="make_indent">
264 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
267 <xsl:attribute name="href">
268 <xsl:value-of select="concat(string($header),string($uri))"/>
270 <xsl:text>-</xsl:text>
272 <xsl:apply-templates select="*[3]">
273 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
274 </xsl:apply-templates>
275 <xsl:text>)</xsl:text>
278 <xsl:apply-templates mode="inline" select="."/>
287 <xsl:template match="m:apply[m:not]">
288 <xsl:param name="current_indent" select="0"/>
289 <xsl:param name="width" select="$framewidth"/>
290 <xsl:variable name="uri">
291 <xsl:value-of select="m:not/@definitionURL"/>
294 <xsl:attribute name="href">
295 <xsl:value-of select="concat(string($header),string($uri))"/>
297 <FONT FACE="symbol" mathcolor="blue">Ø</FONT>
299 <xsl:apply-templates select="*[2]"/>
304 <xsl:template match="m:apply[m:exists]">
305 <xsl:param name="current_indent" select="0"/>
306 <xsl:param name="width" select="$framewidth"/>
307 <xsl:variable name="uri">
308 <xsl:value-of select="m:exists/@definitionURL"/>
310 <xsl:variable name="charlength">
311 <xsl:apply-templates select="m:exists" mode="charcount"/>
314 <xsl:when test="$charlength > $framewidth">
316 <xsl:attribute name="href">
317 <xsl:value-of select="concat(string($header),string($uri))"/>
319 <FONT FACE="symbol" mathcolor="blue">$</FONT>
321 <xsl:apply-templates select="m:bvar/m:ci"/>
322 <xsl:text>:</xsl:text>
323 <xsl:apply-templates select="m:condition">
324 <xsl:with-param name="current_indent" select="$current_indent + 2 +
325 string-length(bvar/ci)"/>
326 </xsl:apply-templates>
328 <xsl:call-template name="make_indent">
329 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
331 <xsl:text>.</xsl:text>
332 <xsl:apply-templates select="*[last()]">
333 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
334 </xsl:apply-templates>
337 <xsl:apply-templates mode="inline" select="."/>
347 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:neq
348 |m:lt|m:leq|m:gt|m:geq|m:plus|m:minus|m:times" mode="charcount">
349 <xsl:param name="incurrent_length" select="0"/>
351 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
352 <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>
354 <xsl:when test="string($siblength) = """>
355 <xsl:value-of select="$incurrent_length + string-length()"/>
358 <xsl:value-of select="number($siblength)"/>
363 <xsl:value-of select="$incurrent_length + string-length()"/>