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 <xsl:template name="mksymbol">
36 <xsl:param name="symbol" select="''"/>
38 <xsl:when test="$UNICODEvsSYMBOL = 'symbol'">
39 <xsl:variable name="fontsymbol">
41 <xsl:when test="$symbol = 'emptyset'">
42 <xsl:value-of select="'Æ'"/>
44 <xsl:when test="$symbol = 'in'">
45 <xsl:value-of select="'Î'"/>
47 <xsl:when test="$symbol = 'notin'">
48 <xsl:value-of select="'Ï'"/>
50 <xsl:when test="$symbol = 'intersect'">
51 <xsl:value-of select="'Ç'"/>
53 <xsl:when test="$symbol = 'union'">
54 <xsl:value-of select="'È'"/>
56 <xsl:when test="$symbol = 'subset'">
57 <xsl:value-of select="'Í'"/>
59 <xsl:when test="$symbol = 'prsubset'">
60 <xsl:value-of select="'Ì'"/>
62 <xsl:when test="$symbol = 'setdiff'">
63 <xsl:value-of select="'/'"/>
67 <FONT FACE="symbol" mathcolor="blue">
68 <xsl:value-of select="$fontsymbol"/>
72 <xsl:variable name="unicodesymbol">
74 <xsl:when test="$symbol = 'emptyset'">
75 <xsl:value-of select="'∅'"/>
77 <xsl:when test="$symbol = 'in'">
78 <xsl:value-of select="'∈'"/>
80 <xsl:when test="$symbol = 'notin'">
81 <xsl:value-of select="'∉'"/>
83 <xsl:when test="$symbol = 'intersect'">
84 <xsl:value-of select="'∩'"/>
86 <xsl:when test="$symbol = 'union'">
87 <xsl:value-of select="'∪'"/>
89 <xsl:when test="$symbol = 'subset'">
90 <xsl:value-of select="'⊆'"/>
92 <xsl:when test="$symbol = 'prsubset'">
93 <xsl:value-of select="'⊂'"/>
95 <xsl:when test="$symbol = 'setdiff'">
96 <xsl:value-of select="'/'"/>
100 <xsl:value-of select="$unicodesymbol"/>
105 <!-- **************************************************************** -->
107 <!-- **************************************************************** -->
111 <xsl:template mode="inline" match="m:set">
112 <xsl:variable name="uri" select="@definitionURL"/>
113 <!-- <xsl:value-of select="concat(string($absPath), @definitionURL)"/>
116 <xsl:when test="count(child::*) = 0">
117 <xsl:call-template name="mksymbol">
118 <xsl:with-param name="symbol" select="'emptyset'"/>
123 <xsl:when test="name(*[1]) = 'm:bvar'">
124 <xsl:text>{</xsl:text>
125 <xsl:apply-templates mode="inline" select="m:bvar/m:ci"/>
126 <xsl:text>:</xsl:text>
127 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
128 <xsl:text>|</xsl:text>
129 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
130 <xsl:text>}</xsl:text>
133 <xsl:text>{</xsl:text>
134 <xsl:for-each select="*">
135 <xsl:apply-templates mode="inline" select="."/>
137 <xsl:when test="position() = last()">
138 <xsl:text>}</xsl:text>
141 <xsl:text>,</xsl:text>
153 <xsl:template mode="inline" match="m:apply[m:card]">
154 <xsl:param name="current_indent" select="0"/>
155 <xsl:param name="width" select="$framewidth"/>
156 <xsl:variable name="uri">
157 <xsl:value-of select="m:card/@definitionURL"/>
159 <xsl:text>|</xsl:text>
160 <xsl:apply-templates mode="inline" select="*[2]"/>
161 <xsl:text>|</xsl:text>
164 <xsl:template mode="inline" match="m:apply[m:in|m:notin|m:intersect|m:union
165 |m:subset|m:prsubset|m:setdiff]">
166 <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
167 <xsl:variable name="symbol">
169 <xsl:when test="m:in">
170 <xsl:value-of select="'Î'"/>
172 <xsl:when test="m:notin">
173 <xsl:value-of select="'Ï'"/>
175 <xsl:when test="m:intersect">
176 <xsl:value-of select="'Ç'"/>
178 <xsl:when test="m:union">
179 <xsl:value-of select="'È'"/>
181 <xsl:when test="m:subset">
182 <xsl:value-of select="'Í'"/>
184 <xsl:when test="m:prsubset">
185 <xsl:value-of select="'Ì'"/>
187 <xsl:when test="m:setdiff">
188 <xsl:value-of select="'/'"/>
192 <xsl:text>(</xsl:text>
193 <xsl:apply-templates mode="inline" select="*[2]"/>
195 <xsl:when test="$uri != ''">
197 <xsl:call-template name="mksymbol">
198 <xsl:with-param name="symbol">
199 <xsl:value-of select="local-name(*[1])"/>
205 <xsl:call-template name="mksymbol">
206 <xsl:with-param name="symbol">
207 <xsl:value-of select="local-name(*[1])"/>
212 <xsl:apply-templates mode="inline" select="*[3]"/>
213 <xsl:text>)</xsl:text>
216 <!-- *************************************************************** -->
218 <xsl:template match="m:apply[m:in|m:notin|m:intersect|m:union
219 |m:subset|m:prsubset|m:setdiff]">
220 <xsl:param name="current_indent" select="0"/>
221 <xsl:param name="width" select="$framewidth"/>
222 <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
223 <xsl:variable name="charlength">
224 <xsl:apply-templates select="*[1]" mode="charcount"/>
226 <xsl:variable name="symbol">
228 <xsl:when test="m:in">
229 <xsl:value-of select="'Î'"/>
231 <xsl:when test="m:notin">
232 <xsl:value-of select="'Ï'"/>
234 <xsl:when test="m:intersect">
235 <xsl:value-of select="'Ç'"/>
237 <xsl:when test="m:union">
238 <xsl:value-of select="'È'"/>
240 <xsl:when test="m:subset">
241 <xsl:value-of select="'Í'"/>
243 <xsl:when test="m:prsubset">
244 <xsl:value-of select="'Ì'"/>
246 <xsl:when test="m:setdiff">
247 <xsl:value-of select="'/'"/>
252 <xsl:when test="$charlength > $framewidth">
253 <xsl:text>(</xsl:text>
254 <xsl:apply-templates select="*[2]">
255 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
256 </xsl:apply-templates>
258 <xsl:call-template name="make_indent">
259 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
262 <xsl:when test="$uri != ''">
264 <xsl:call-template name="mksymbol">
265 <xsl:with-param name="symbol">
266 <xsl:value-of select="local-name(*[1])"/>
272 <xsl:call-template name="mksymbol">
273 <xsl:with-param name="symbol">
274 <xsl:value-of select="local-name(*[1])"/>
279 <xsl:apply-templates select="*[3]">
280 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
281 </xsl:apply-templates>
282 <xsl:text>)</xsl:text>
285 <xsl:apply-templates mode="inline" select="."/>
293 <xsl:template match="m:set">
294 <xsl:param name="current_indent" select="0"/>
295 <xsl:param name="width" select="$framewidth"/>
296 <xsl:variable name="uri" select="@definitionURL"/>
297 <!-- <xsl:value-of select="concat(string($absPath), @definitionURL)"/>
300 <xsl:when test="count(child::*) = 0">
301 <xsl:call-template name="mksymbol">
302 <xsl:with-param name="symbol" select="'emptyset'"/>
306 <xsl:variable name="charlength">
307 <xsl:apply-templates select="." mode="charcount"/>
310 <xsl:when test="$charlength > $framewidth">
312 <xsl:when test="name(*[1]) = 'm:bvar'">
313 <xsl:text>{</xsl:text>
314 <xsl:apply-templates select="m:bvar/m:ci"/>
315 <xsl:text>:</xsl:text>
316 <xsl:apply-templates select="m:bvar/m:type">
317 <xsl:with-param name="current_indent"
318 select="$current_indent + 2 + string-length(m:bvar/m:ci)"/>
319 </xsl:apply-templates><BR/>
320 <xsl:call-template name="make_indent">
321 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
323 <xsl:text>|</xsl:text>
324 <xsl:apply-templates select="m:condition">
325 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
326 </xsl:apply-templates>
327 <xsl:text>}</xsl:text>
330 <xsl:text>{</xsl:text>
331 <xsl:apply-templates select="*[position()=1]">
332 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
333 </xsl:apply-templates>
334 <xsl:for-each select="*[position()>1]">
335 <xsl:text>,</xsl:text>
337 <xsl:call-template name="make_indent">
338 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
340 <xsl:apply-templates select=".">
341 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
342 </xsl:apply-templates>
344 <xsl:text>}</xsl:text>
349 <xsl:apply-templates mode="inline" select="."/>
357 <xsl:template match="m:apply[m:card]">
358 <xsl:param name="current_indent" select="0"/>
359 <xsl:param name="width" select="$framewidth"/>
360 <xsl:variable name="uri">
361 <xsl:value-of select="m:card/@definitionURL"/>
363 <xsl:text>|</xsl:text>
364 <xsl:apply-templates select="*[2]">
365 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
366 </xsl:apply-templates>
367 <xsl:text>|</xsl:text>
372 <xsl:template match="m:in|m:notin|m:intersect|m:union
373 |m:subset|m:prsubset|m:setdiff|m:card" mode="charcount">
374 <xsl:param name="incurrent_length" select="0"/>
376 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
377 <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>
379 <xsl:when test="string($siblength) = """>
380 <xsl:value-of select="$incurrent_length + string-length()"/>
383 <xsl:value-of select="number($siblength)"/>
388 <xsl:value-of select="$incurrent_length + string-length()"/>