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 <!-- BASIC OPERATORS -->
37 <xsl:template 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:param name="current_indent" select="0"/>
40 <xsl:param name="width" select="$framewidth"/>
41 <xsl:variable name="uri">
42 <xsl:value-of select="*[1]/@definitionURL"/>
44 <xsl:variable name="charlength">
45 <xsl:apply-templates select="*[1]" mode="charcount"/>
47 <xsl:variable name="symbol">
49 <xsl:when test="m:and">
50 <xsl:value-of select="'Ù'"/>
52 <xsl:when test="m:or">
53 <xsl:value-of select="'Ú'"/>
55 <xsl:when test="m:eq">
56 <xsl:value-of select="'='"/>
58 <xsl:when test="m:neq">
59 <xsl:value-of select="'¹'"/>
61 <xsl:when test="m:leq">
62 <xsl:value-of select="'£'"/>
64 <xsl:when test="m:lt">
65 <xsl:value-of select="'<'"/>
67 <xsl:when test="m:geq">
68 <xsl:value-of select="'³'"/>
70 <xsl:when test="m:gt">
71 <xsl:value-of select="'>'"/>
73 <xsl:when test="m:plus">
74 <xsl:value-of select="'+'"/>
76 <xsl:when test="m:times">
77 <xsl:value-of select="'*'"/>
82 <xsl:when test="$charlength > $framewidth">
83 <xsl:text>(</xsl:text>
84 <xsl:apply-templates select="*[2]">
85 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
86 </xsl:apply-templates>
88 <xsl:call-template name="make_indent">
89 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
92 <xsl:attribute name="href">
93 <xsl:value-of select="concat(string($header),string($uri))"/>
95 <FONT FACE="symbol" mathcolor="blue">
96 <xsl:value-of select="$symbol"/>
99 <xsl:apply-templates select="*[3]">
100 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
101 </xsl:apply-templates>
102 <xsl:text>)</xsl:text>
105 <xsl:text>(</xsl:text>
106 <xsl:apply-templates select="*[2]"/>
108 <xsl:attribute name="href">
109 <xsl:value-of select="concat(string($header),string($uri))"/>
111 <FONT FACE="symbol" mathcolor="blue">
112 <xsl:value-of select="$symbol"/>
115 <xsl:apply-templates select="*[3]"/>
116 <xsl:text>)</xsl:text>
121 <!-- MINUS (can be unary!) -->
123 <xsl:template match="m:apply[m:minus]">
124 <xsl:param name="current_indent" select="0"/>
125 <xsl:param name="width" select="$framewidth"/>
126 <xsl:variable name="uri">
127 <xsl:value-of select="*[1]/@definitionURL"/>
130 <xsl:when test="count(child::*)=2">
132 <xsl:attribute name="href">
133 <xsl:value-of select="concat(string($header),string($uri))"/>
135 <xsl:text>-</xsl:text>
137 <xsl:apply-templates select="*[2]">
138 <xsl:with-param name="current_indent" select="$current_indent + 1"/>
139 </xsl:apply-templates>
142 <xsl:variable name="charlength">
143 <xsl:apply-templates select="*[1]" mode="charcount"/>
146 <xsl:when test="$charlength > $framewidth">
147 <xsl:text>(</xsl:text>
148 <xsl:apply-templates select="*[2]">
149 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
150 </xsl:apply-templates>
152 <xsl:call-template name="make_indent">
153 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
156 <xsl:attribute name="href">
157 <xsl:value-of select="concat(string($header),string($uri))"/>
159 <xsl:text>-</xsl:text>
161 <xsl:apply-templates select="*[3]">
162 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
163 </xsl:apply-templates>
164 <xsl:text>)</xsl:text>
167 <xsl:text>(</xsl:text>
168 <xsl:apply-templates select="*[2]"/>
170 <xsl:attribute name="href">
171 <xsl:value-of select="concat(string($header),string($uri))"/>
173 <xsl:text>-</xsl:text>
175 <xsl:apply-templates select="*[3]"/>
176 <xsl:text>)</xsl:text>
185 <xsl:template match="m:apply[m:not]">
186 <xsl:param name="current_indent" select="0"/>
187 <xsl:param name="width" select="$framewidth"/>
188 <xsl:variable name="uri">
189 <xsl:value-of select="m:not/@definitionURL"/>
192 <xsl:attribute name="href">
193 <xsl:value-of select="concat(string($header),string($uri))"/>
195 <FONT FACE="symbol" mathcolor="blue">Ø</FONT>
197 <xsl:apply-templates select="*[2]"/>
202 <xsl:template match="m:apply[m:exists]">
203 <xsl:param name="current_indent" select="0"/>
204 <xsl:param name="width" select="$framewidth"/>
205 <xsl:variable name="uri">
206 <xsl:value-of select="m:exists/@definitionURL"/>
208 <xsl:variable name="charlength">
209 <xsl:apply-templates select="m:exists" mode="charcount"/>
212 <xsl:when test="$charlength > $framewidth">
214 <xsl:attribute name="href">
215 <xsl:value-of select="concat(string($header),string($uri))"/>
217 <FONT FACE="symbol" mathcolor="blue">$</FONT>
219 <xsl:apply-templates select="m:bvar/m:ci"/>
220 <xsl:text>:</xsl:text>
221 <xsl:apply-templates select="m:condition">
222 <xsl:with-param name="current_indent" select="$current_indent + 2 +
223 string-length(bvar/ci)"/>
224 </xsl:apply-templates>
226 <xsl:call-template name="make_indent">
227 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
229 <xsl:text>.</xsl:text>
230 <xsl:apply-templates select="*[last()]">
231 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
232 </xsl:apply-templates>
236 <xsl:attribute name="href">
237 <xsl:value-of select="concat(string($header),string($uri))"/>
239 <FONT FACE="symbol" mathcolor="blue">$</FONT>
241 <xsl:apply-templates select="m:bvar/m:ci"/>
242 <xsl:text>:</xsl:text>
243 <xsl:apply-templates select="m:condition"/>
244 <xsl:text>.</xsl:text>
245 <xsl:apply-templates select="*[last()]">
246 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
247 </xsl:apply-templates>
257 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:neq
258 |m:lt|m:leq|m:gt|m:geq|m:plus|m:minus|m:times" mode="charcount">
259 <xsl:param name="incurrent_length" select="0"/>
261 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
262 <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>
264 <xsl:when test="string($siblength) = """>
265 <xsl:value-of select="$incurrent_length + string-length()"/>
268 <xsl:value-of select="number($siblength)"/>
273 <xsl:value-of select="$incurrent_length + string-length()"/>