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:variable name="absPath">http://localhost:8081/getciconly?uri=</xsl:variable>
38 <!-- BASIC OPERATORS -->
40 <xsl:template match="m:apply[m:and|m:or|m:eq|m:neq|m:leq|m:lt
41 |m:geq|m:gt|m:plus|m:times]">
42 <xsl:param name="current_indent" select="0"/>
43 <xsl:param name="width" select="$framewidth"/>
44 <xsl:variable name="uri">
45 <xsl:value-of select="*[1]/@definitionURL"/>
47 <xsl:variable name="charlength">
48 <xsl:apply-templates select="*[1]" mode="charcount"/>
50 <xsl:variable name="symbol">
52 <xsl:when test="m:and">
53 <xsl:value-of select="'Ù'"/>
55 <xsl:when test="m:or">
56 <xsl:value-of select="'Ú'"/>
58 <xsl:when test="m:eq">
59 <xsl:value-of select="'='"/>
61 <xsl:when test="m:neq">
62 <xsl:value-of select="'¹'"/>
64 <xsl:when test="m:leq">
65 <xsl:value-of select="'£'"/>
67 <xsl:when test="m:lt">
68 <xsl:value-of select="'<'"/>
70 <xsl:when test="m:geq">
71 <xsl:value-of select="'³'"/>
73 <xsl:when test="m:gt">
74 <xsl:value-of select="'>'"/>
76 <xsl:when test="m:plus">
77 <xsl:value-of select="'+'"/>
79 <xsl:when test="m:times">
80 <xsl:value-of select="'*'"/>
85 <xsl:when test="$charlength > $framewidth">
86 <xsl:text>(</xsl:text>
87 <xsl:apply-templates select="*[2]">
88 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
89 </xsl:apply-templates>
91 <xsl:call-template name="make_indent">
92 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
95 <xsl:attribute name="href">
96 <xsl:value-of select="concat(string($header),string($uri))"/>
98 <FONT FACE="symbol" mathcolor="blue">
99 <xsl:value-of select="$symbol"/>
102 <xsl:apply-templates select="*[3]">
103 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
104 </xsl:apply-templates>
105 <xsl:text>)</xsl:text>
108 <xsl:text>(</xsl:text>
109 <xsl:apply-templates select="*[2]"/>
111 <xsl:attribute name="href">
112 <xsl:value-of select="concat(string($header),string($uri))"/>
114 <FONT FACE="symbol" mathcolor="blue">
115 <xsl:value-of select="$symbol"/>
118 <xsl:apply-templates select="*[3]"/>
119 <xsl:text>)</xsl:text>
124 <!-- MINUS (can be unary!) -->
126 <xsl:template match="m:apply[m:minus]">
127 <xsl:param name="current_indent" select="0"/>
128 <xsl:param name="width" select="$framewidth"/>
129 <xsl:variable name="uri">
130 <xsl:value-of select="*[1]/@definitionURL"/>
133 <xsl:when test="count(child::*)=2">
135 <xsl:attribute name="href">
136 <xsl:value-of select="concat(string($header),string($uri))"/>
138 <xsl:text>-</xsl:text>
140 <xsl:apply-templates select="*[2]">
141 <xsl:with-param name="current_indent" select="$current_indent + 1"/>
142 </xsl:apply-templates>
145 <xsl:variable name="charlength">
146 <xsl:apply-templates select="*[1]" mode="charcount"/>
149 <xsl:when test="$charlength > $framewidth">
150 <xsl:text>(</xsl:text>
151 <xsl:apply-templates select="*[2]">
152 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
153 </xsl:apply-templates>
155 <xsl:call-template name="make_indent">
156 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
159 <xsl:attribute name="href">
160 <xsl:value-of select="concat(string($header),string($uri))"/>
162 <xsl:text>-</xsl:text>
164 <xsl:apply-templates select="*[3]">
165 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
166 </xsl:apply-templates>
167 <xsl:text>)</xsl:text>
170 <xsl:text>(</xsl:text>
171 <xsl:apply-templates select="*[2]"/>
173 <xsl:attribute name="href">
174 <xsl:value-of select="concat(string($header),string($uri))"/>
176 <xsl:text>-</xsl:text>
178 <xsl:apply-templates select="*[3]"/>
179 <xsl:text>)</xsl:text>
188 <xsl:template match="m:apply[m:not]">
189 <xsl:param name="current_indent" select="0"/>
190 <xsl:param name="width" select="$framewidth"/>
191 <xsl:variable name="uri">
192 <xsl:value-of select="m:not/@definitionURL"/>
195 <xsl:attribute name="href">
196 <xsl:value-of select="concat(string($header),string($uri))"/>
198 <FONT FACE="symbol" mathcolor="blue">Ø</FONT>
200 <xsl:apply-templates select="*[2]"/>
205 <xsl:template match="m:apply[m:exists]">
206 <xsl:param name="current_indent" select="0"/>
207 <xsl:param name="width" select="$framewidth"/>
208 <xsl:variable name="uri">
209 <xsl:value-of select="m:exists/@definitionURL"/>
211 <xsl:variable name="charlength">
212 <xsl:apply-templates select="m:exists" mode="charcount"/>
215 <xsl:when test="$charlength > $framewidth">
217 <xsl:attribute name="href">
218 <xsl:value-of select="concat(string($header),string($uri))"/>
220 <FONT FACE="symbol" mathcolor="blue">$</FONT>
222 <xsl:apply-templates select="m:bvar/m:ci"/>
223 <xsl:text>:</xsl:text>
224 <xsl:apply-templates select="m:condition">
225 <xsl:with-param name="current_indent" select="$current_indent + 2 +
226 string-length(bvar/ci)"/>
227 </xsl:apply-templates>
229 <xsl:call-template name="make_indent">
230 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
232 <xsl:text>.</xsl:text>
233 <xsl:apply-templates select="*[last()]">
234 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
235 </xsl:apply-templates>
239 <xsl:attribute name="href">
240 <xsl:value-of select="concat(string($header),string($uri))"/>
242 <FONT FACE="symbol" mathcolor="blue">$</FONT>
244 <xsl:apply-templates select="m:bvar/m:ci"/>
245 <xsl:text>:</xsl:text>
246 <xsl:apply-templates select="m:condition"/>
247 <xsl:text>.</xsl:text>
248 <xsl:apply-templates select="*[last()]">
249 <xsl:with-param name="current_indent" select="$current_indent + 2"/>
250 </xsl:apply-templates>
260 <xsl:template match="m:cn|m:and|m:or|m:not|m:exists|m:eq|m:neq
261 |m:lt|m:leq|m:gt|m:geq|m:plus|m:minus|m:times" mode="charcount">
262 <xsl:param name="incurrent_length" select="0"/>
264 <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
265 <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>
267 <xsl:when test="string($siblength) = """>
268 <xsl:value-of select="$incurrent_length + string-length()"/>
271 <xsl:value-of select="number($siblength)"/>
276 <xsl:value-of select="$incurrent_length + string-length()"/>