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"/>
114 <xsl:when test="count(child::*) = 0">
115 <xsl:call-template name="mksymbol">
116 <xsl:with-param name="symbol" select="'emptyset'"/>
121 <xsl:when test="name(*[1]) = 'm:bvar'">
122 <xsl:text>{</xsl:text>
123 <xsl:apply-templates mode="inline" select="m:bvar/m:ci"/>
124 <xsl:text>:</xsl:text>
125 <xsl:apply-templates mode="inline" select="m:bvar/m:type"/>
126 <xsl:text>|</xsl:text>
127 <xsl:apply-templates mode="inline" select="*[position()=2]"/>
128 <xsl:text>}</xsl:text>
131 <xsl:text>{</xsl:text>
132 <xsl:for-each select="*">
133 <xsl:apply-templates mode="inline" select="."/>
135 <xsl:when test="position() = last()">
136 <xsl:text>}</xsl:text>
139 <xsl:text>,</xsl:text>
151 <xsl:template mode="inline" match="m:apply[m:card]">
152 <xsl:param name="current_indent" select="0"/>
153 <xsl:param name="width" select="$framewidth"/>
154 <xsl:variable name="uri">
155 <xsl:value-of select="m:card/@definitionURL"/>
157 <xsl:text>|</xsl:text>
158 <xsl:apply-templates mode="inline" select="*[2]"/>
159 <xsl:text>|</xsl:text>
162 <xsl:template mode="inline" match="m:apply[m:in|m:notin|m:intersect|m:union
163 |m:subset|m:prsubset|m:setdiff]">
164 <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
165 <xsl:variable name="symbol">
167 <xsl:when test="m:in">
168 <xsl:value-of select="'Î'"/>
170 <xsl:when test="m:notin">
171 <xsl:value-of select="'Ï'"/>
173 <xsl:when test="m:intersect">
174 <xsl:value-of select="'Ç'"/>
176 <xsl:when test="m:union">
177 <xsl:value-of select="'È'"/>
179 <xsl:when test="m:subset">
180 <xsl:value-of select="'Í'"/>
182 <xsl:when test="m:prsubset">
183 <xsl:value-of select="'Ì'"/>
185 <xsl:when test="m:setdiff">
186 <xsl:value-of select="'/'"/>
190 <xsl:text>(</xsl:text>
191 <xsl:apply-templates mode="inline" select="*[2]"/>
193 <xsl:when test="$uri != ''">
195 <xsl:call-template name="mksymbol">
196 <xsl:with-param name="symbol">
197 <xsl:value-of select="local-name(*[1])"/>
203 <xsl:call-template name="mksymbol">
204 <xsl:with-param name="symbol">
205 <xsl:value-of select="local-name(*[1])"/>
210 <xsl:apply-templates mode="inline" select="*[3]"/>
211 <xsl:text>)</xsl:text>
214 <!-- *************************************************************** -->
216 <xsl:template match="m:apply[m:in|m:notin|m:intersect|m:union
217 |m:subset|m:prsubset|m:setdiff]">
218 <xsl:param name="current_indent" select="0"/>
219 <xsl:param name="width" select="$framewidth"/>
220 <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
221 <xsl:variable name="charlength">
222 <xsl:apply-templates select="*[1]" mode="charcount"/>
224 <xsl:variable name="symbol">
226 <xsl:when test="m:in">
227 <xsl:value-of select="'Î'"/>
229 <xsl:when test="m:notin">
230 <xsl:value-of select="'Ï'"/>
232 <xsl:when test="m:intersect">
233 <xsl:value-of select="'Ç'"/>
235 <xsl:when test="m:union">
236 <xsl:value-of select="'È'"/>
238 <xsl:when test="m:subset">
239 <xsl:value-of select="'Í'"/>
241 <xsl:when test="m:prsubset">
242 <xsl:value-of select="'Ì'"/>
244 <xsl:when test="m:setdiff">
245 <xsl:value-of select="'/'"/>
250 <xsl:when test="$charlength > $framewidth">
251 <xsl:text>(</xsl:text>
252 <xsl:apply-templates select="*[2]">
253 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
254 </xsl:apply-templates>
256 <xsl:call-template name="make_indent">
257 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
260 <xsl:when test="$uri != ''">
262 <xsl:call-template name="mksymbol">
263 <xsl:with-param name="symbol">
264 <xsl:value-of select="local-name(*[1])"/>
270 <xsl:call-template name="mksymbol">
271 <xsl:with-param name="symbol">
272 <xsl:value-of select="local-name(*[1])"/>
277 <xsl:apply-templates select="*[3]">
278 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
279 </xsl:apply-templates>
280 <xsl:text>)</xsl:text>
283 <xsl:apply-templates mode="inline" select="."/>
291 <xsl:template match="m:set">
292 <xsl:param name="current_indent" select="0"/>
293 <xsl:param name="width" select="$framewidth"/>
294 <xsl:variable name="uri" select="@definitionURL"/>
296 <xsl:when test="count(child::*) = 0">
297 <xsl:call-template name="mksymbol">
298 <xsl:with-param name="symbol" select="'emptyset'"/>
302 <xsl:variable name="charlength">
303 <xsl:apply-templates select="." mode="charcount"/>
306 <xsl:when test="$charlength > $framewidth">
308 <xsl:when test="name(*[1]) = 'm:bvar'">
309 <xsl:text>{</xsl:text>
310 <xsl:apply-templates select="m:bvar/m:ci"/>
311 <xsl:text>:</xsl:text>
312 <xsl:apply-templates select="m:bvar/m:type">
313 <xsl:with-param name="current_indent"
314 select="$current_indent + 2 + string-length(m:bvar/m:ci)"/>
315 </xsl:apply-templates><BR/>
316 <xsl:call-template name="make_indent">
317 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
319 <xsl:text>|</xsl:text>
320 <xsl:apply-templates select="m:condition">
321 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
322 </xsl:apply-templates>
323 <xsl:text>}</xsl:text>
326 <xsl:text>{</xsl:text>
327 <xsl:apply-templates select="*[position()=1]">
328 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
329 </xsl:apply-templates>
330 <xsl:for-each select="*[position()>1]">
331 <xsl:text>,</xsl:text>
333 <xsl:call-template name="make_indent">
334 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
336 <xsl:apply-templates select=".">
337 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
338 </xsl:apply-templates>
340 <xsl:text>}</xsl:text>
345 <xsl:apply-templates mode="inline" select="."/>
353 <xsl:template match="m:apply[m:card]">
354 <xsl:param name="current_indent" select="0"/>
355 <xsl:param name="width" select="$framewidth"/>
356 <xsl:variable name="uri">
357 <xsl:value-of select="m:card/@definitionURL"/>
359 <xsl:text>|</xsl:text>
360 <xsl:apply-templates select="*[2]">
361 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
362 </xsl:apply-templates>
363 <xsl:text>|</xsl:text>
368 <xsl:template match="m:in|m:notin|m:intersect|m:union
369 |m:subset|m:prsubset|m:setdiff|m:card" mode="charcount">
370 <xsl:param name="incurrent_length" select="0"/>
372 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
373 <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>
375 <xsl:when test="string($siblength) = """>
376 <xsl:value-of select="$incurrent_length + string-length()"/>
379 <xsl:value-of select="number($siblength)"/>
384 <xsl:value-of select="$incurrent_length + string-length()"/>