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 <FONT FACE="symbol" SIZE="+0" mathcolor="blue">
80 <xsl:value-of select="$symbol"/>
83 <xsl:apply-templates mode="inline" select="*[3]"/>
84 <xsl:text>)</xsl:text>
87 <!-- INLINE MODE - MINUS (can be unary!) -->
89 <xsl:template mode="inline" match="m:apply[m:minus]">
90 <xsl:variable name="uri">
91 <xsl:value-of select="*[1]/@definitionURL"/>
94 <xsl:when test="count(child::*)=2">
96 <FONT FACE="symbol" SIZE="+0" mathcolor="blue">-</FONT>
98 <xsl:apply-templates mode="inline" select="*[2]"/>
101 <xsl:text>(</xsl:text>
102 <xsl:apply-templates mode="inline" select="*[2]"/>
104 <FONT FACE="symbol" SIZE="+0" mathcolor="blue">-</FONT>
106 <xsl:apply-templates mode="inline" select="*[3]"/>
107 <xsl:text>)</xsl:text>
112 <!-- INLINE MODE NOT -->
114 <xsl:template mode="inline" match="m:apply[m:not]">
115 <xsl:variable name="uri">
116 <xsl:value-of select="m:not/@definitionURL"/>
119 <FONT FACE="symbol" SIZE="+0" mathcolor="blue">Ø</FONT>
121 <xsl:apply-templates mode="inline" select="*[2]"/>
124 <!-- INLINE MODE EXISTS -->
126 <xsl:template mode="inline" match="m:apply[m:exists]">
127 <xsl:variable name="uri">
128 <xsl:value-of select="m:exists/@definitionURL"/>
131 <FONT FACE="symbol" SIZE="+0" mathcolor="blue">$</FONT>
133 <xsl:apply-templates select="m:bvar/m:ci"/>
134 <xsl:text>:</xsl:text>
135 <xsl:apply-templates mode="inline" select="m:condition"/>
136 <xsl:text>.</xsl:text>
137 <xsl:apply-templates mode="inline" select="*[last()]"/>
140 <!-- COUNTING MODE -->
142 <!-- BASIC OPERATORS -->
144 <xsl:template match="m:apply[m:and|m:or|m:eq|m:neq|m:leq|m:lt
145 |m:geq|m:gt|m:plus|m:times]">
146 <xsl:param name="current_indent" select="0"/>
147 <xsl:param name="width" select="$framewidth"/>
148 <xsl:variable name="uri">
149 <xsl:value-of select="*[1]/@definitionURL"/>
151 <xsl:variable name="charlength">
152 <xsl:apply-templates select="*[1]" mode="charcount"/>
154 <xsl:variable name="symbol">
156 <xsl:when test="m:and">
157 <xsl:value-of select="'Ù'"/>
159 <xsl:when test="m:or">
160 <xsl:value-of select="'Ú'"/>
162 <xsl:when test="m:eq">
163 <xsl:value-of select="'='"/>
165 <xsl:when test="m:neq">
166 <xsl:value-of select="'¹'"/>
168 <xsl:when test="m:leq">
169 <xsl:value-of select="'£'"/>
171 <xsl:when test="m:lt">
172 <xsl:value-of select="'<'"/>
174 <xsl:when test="m:geq">
175 <xsl:value-of select="'³'"/>
177 <xsl:when test="m:gt">
178 <xsl:value-of select="'>'"/>
180 <xsl:when test="m:plus">
181 <xsl:value-of select="'+'"/>
183 <xsl:when test="m:times">
184 <xsl:value-of select="'*'"/>
189 <xsl:when test="$charlength > $framewidth">
190 <xsl:text>(</xsl:text>
191 <xsl:apply-templates select="*[2]">
192 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
193 </xsl:apply-templates>
195 <xsl:call-template name="make_indent">
196 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
199 <FONT FACE="symbol" SIZE="+0" mathcolor="blue">
200 <xsl:value-of select="$symbol"/>
203 <xsl:apply-templates select="*[3]">
204 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
205 </xsl:apply-templates>
206 <xsl:text>)</xsl:text>
209 <xsl:apply-templates mode="inline" select="."/>
214 <!-- MINUS (can be unary!) -->
216 <xsl:template match="m:apply[m:minus]">
217 <xsl:param name="current_indent" select="0"/>
218 <xsl:param name="width" select="$framewidth"/>
219 <xsl:variable name="uri">
220 <xsl:value-of select="*[1]/@definitionURL"/>
223 <xsl:when test="count(child::*)=2">
225 <FONT FACE="symbol" SIZE="+0" mathcolor="blue">-</FONT>
227 <xsl:apply-templates select="*[2]">
228 <xsl:with-param name="current_indent" select="$current_indent + 1"/>
229 </xsl:apply-templates>
232 <xsl:variable name="charlength">
233 <xsl:apply-templates select="*[1]" mode="charcount"/>
236 <xsl:when test="$charlength > $framewidth">
237 <xsl:text>(</xsl:text>
238 <xsl:apply-templates select="*[2]">
239 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
240 </xsl:apply-templates>
242 <xsl:call-template name="make_indent">
243 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
246 <FONT FACE="symbol" SIZE="+0" mathcolor="blue">-</FONT>
248 <xsl:apply-templates select="*[3]">
249 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
250 </xsl:apply-templates>
251 <xsl:text>)</xsl:text>
254 <xsl:apply-templates mode="inline" select="."/>
263 <xsl:template match="m:apply[m:not]">
264 <xsl:param name="current_indent" select="0"/>
265 <xsl:param name="width" select="$framewidth"/>
266 <xsl:variable name="uri">
267 <xsl:value-of select="m:not/@definitionURL"/>
270 <FONT FACE="symbol" SIZE="+0" mathcolor="blue">Ø</FONT>
272 <xsl:apply-templates select="*[2]"/>
277 <xsl:template match="m:apply[m:exists]">
278 <xsl:param name="current_indent" select="0"/>
279 <xsl:param name="width" select="$framewidth"/>
280 <xsl:variable name="uri">
281 <xsl:value-of select="m:exists/@definitionURL"/>
283 <xsl:variable name="charlength">
284 <xsl:apply-templates select="m:exists" mode="charcount"/>
287 <xsl:when test="$charlength > $framewidth">
289 <FONT FACE="symbol" SIZE="+0" mathcolor="blue">$</FONT>
291 <xsl:apply-templates select="m:bvar/m:ci"/>
292 <xsl:text>:</xsl:text>
293 <xsl:apply-templates select="m:condition">
294 <xsl:with-param name="current_indent" select="$current_indent + 2 +
295 string-length(bvar/ci)"/>
296 </xsl:apply-templates>
298 <xsl:call-template name="make_indent">
299 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
301 <xsl:text>.</xsl:text>
302 <xsl:apply-templates select="*[last()]">
303 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
304 </xsl:apply-templates>
307 <xsl:apply-templates mode="inline" select="."/>
317 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:neq
318 |m:lt|m:leq|m:gt|m:geq|m:plus|m:minus|m:times" mode="charcount">
319 <xsl:param name="incurrent_length" select="0"/>
321 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
322 <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>
324 <xsl:when test="string($siblength) = """>
325 <xsl:value-of select="$incurrent_length + string-length()"/>
328 <xsl:value-of select="number($siblength)"/>
333 <xsl:value-of select="$incurrent_length + string-length()"/>