]> matita.cs.unibo.it Git - helm.git/blob - helm/style/html_reals.xsl
Modified Files:
[helm.git] / helm / style / html_reals.xsl
1 <?xml version="1.0"?>
2
3 <!-- Copyright (C) 2000, HELM Team                                     -->
4 <!--                                                                   -->
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.                         -->
8 <!--                                                                   -->
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.            -->
13 <!--                                                                   -->
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.                      -->
18 <!--                                                                   -->
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.                                              -->
23 <!--                                                                   -->
24 <!-- For details, see the HELM World-Wide-Web page,                    -->
25 <!-- http://cs.unibo.it/helm/.                                         -->
26
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">
29
30 <!--***********************************************************************--> 
31 <!-- INIT style for HTML                                                   -->
32 <!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena                      -->
33 <!--***********************************************************************--> 
34
35 <xsl:variable name="absPath">http://localhost:8081/getciconly?uri=</xsl:variable>
36
37 <!-- LIMIT -->
38
39 <xsl:template match="m:apply[m:limit]">
40   <xsl:param name="current_indent" select="0"/> 
41   <xsl:param name="width" select="$framewidth"/>
42   <xsl:variable name="uri">
43    <xsl:value-of select="m:limit/@definitionURL"/>
44   </xsl:variable>
45   <xsl:variable name="charlength">
46    <xsl:apply-templates select="m:limit" mode="charcount"/>
47   </xsl:variable>
48   <xsl:choose>
49     <xsl:when test="$charlength > $framewidth">
50      <a>
51      <xsl:attribute name="href">
52       <xsl:value-of select="concat(string($header),string($uri))"/>
53      </xsl:attribute>
54      <xsl:text>lim</xsl:text>
55      </a>
56      <SUB>
57       <xsl:apply-templates select="m:bvar/m:ci"/>
58       <FONT FACE="symbol" mathcolor="blue">&#174;</FONT>
59       <xsl:apply-templates select="m:lowlimit"/>
60      </SUB>
61      <BR/> 
62      <xsl:call-template name="make_indent">
63       <xsl:with-param name="current_indent" select="$current_indent + 5"/> 
64      </xsl:call-template>
65      <xsl:apply-templates select="*[4]">
66       <xsl:with-param name="current_indent" select="$current_indent + 5"/>
67      </xsl:apply-templates>
68     </xsl:when>
69     <xsl:otherwise>
70      <a>
71      <xsl:attribute name="href">
72       <xsl:value-of select="concat(string($header),string($uri))"/>
73      </xsl:attribute>
74      <xsl:text>lim</xsl:text>
75      </a>
76      <SUB>
77       <xsl:apply-templates select="m:bvar/m:ci"/>
78       <FONT FACE="symbol" mathcolor="blue">&#174;</FONT>
79       <xsl:apply-templates select="m:lowlimit"/>
80      </SUB>
81      <xsl:apply-templates select="*[4]">
82       <xsl:with-param name="current_indent" select="$current_indent + 5"/>
83      </xsl:apply-templates>
84     </xsl:otherwise>
85    </xsl:choose>
86  </xsl:template>
87
88 <!-- DIFFERENTIATION -->
89
90 <xsl:template match="m:apply[m:diff]">
91   <xsl:param name="current_indent" select="0"/> 
92   <xsl:param name="width" select="$framewidth"/>
93   <xsl:variable name="uri">
94    <xsl:value-of select="m:diff/@definitionURL"/>
95   </xsl:variable>
96      <a>
97      <xsl:attribute name="href">
98       <xsl:value-of select="concat(string($header),string($uri))"/>
99      </xsl:attribute>
100      <SUP>d</SUP>
101       <xsl:text>/</xsl:text>
102      <SUB>
103       <xsl:text>d</xsl:text>
104       <xsl:value-of select="m:bvar/m:ci"/>
105      </SUB>
106      </a>
107      <xsl:apply-templates select="*[3]">
108       <xsl:with-param name="current_indent" select="$current_indent + 5"/>
109      </xsl:apply-templates>
110  </xsl:template>
111
112 <!-- ABSOLUTE VALUE -->
113 <xsl:template match="m:apply[m:abs]">
114   <xsl:param name="current_indent" select="0"/> 
115   <xsl:param name="width" select="$framewidth"/>
116   <xsl:variable name="uri">
117    <xsl:value-of select="m:abs/@definitionURL"/>
118   </xsl:variable>
119   <xsl:text>|</xsl:text>
120   <xsl:apply-templates select="*[2]">
121    <xsl:with-param name="current_indent" select="$current_indent + 2"/>
122   </xsl:apply-templates>
123   <xsl:text>|</xsl:text>
124  </xsl:template>
125
126 <!-- FACTORIAL -->
127
128 <xsl:template match="m:apply[m:fact]">
129   <xsl:param name="current_indent" select="0"/> 
130   <xsl:param name="width" select="$framewidth"/>
131   <xsl:variable name="uri">
132    <xsl:value-of select="m:abs/@definitionURL"/>
133   </xsl:variable>
134   <xsl:apply-templates select="*[2]">
135    <xsl:with-param name="current_indent" select="$current_indent + 2"/>
136   </xsl:apply-templates>
137   <xsl:text>!</xsl:text>
138  </xsl:template>
139
140 <!-- SQUARE ROOT -->
141
142 <xsl:template match="m:apply[m:root]">
143   <xsl:param name="current_indent" select="0"/> 
144   <xsl:param name="width" select="$framewidth"/>
145   <xsl:variable name="uri">
146    <xsl:value-of select="m:abs/@definitionURL"/>
147   </xsl:variable>
148   <xsl:text>(sqr</xsl:text>
149   <xsl:apply-templates select="*[2]">
150    <xsl:with-param name="current_indent" select="$current_indent + 5"/>
151   </xsl:apply-templates>
152   <xsl:text>)</xsl:text>
153  </xsl:template>
154
155 <!-- POWER -->
156
157 <xsl:template match="m:apply[m:power]">
158   <xsl:param name="current_indent" select="0"/> 
159   <xsl:param name="width" select="$framewidth"/>
160   <xsl:variable name="uri">
161    <xsl:value-of select="m:power/@definitionURL"/>
162   </xsl:variable>
163   <xsl:apply-templates select="*[2]"/>
164   <SUP>
165   <xsl:apply-templates select="*[3]"/>
166   </SUP>
167  </xsl:template>
168
169 <!-- MIN and MAX (binari: estendere) -->
170
171  <xsl:template match="m:apply[m:min|m:max]">
172   <xsl:param name="current_indent" select="0"/> 
173   <xsl:param name="width" select="$framewidth"/>
174   <xsl:variable name="uri">
175    <xsl:value-of select="*[1]/@definitionURL"/>
176   </xsl:variable>
177   <xsl:variable name="charlength">
178    <xsl:apply-templates select="*[1]" mode="charcount"/>
179   </xsl:variable>
180   <xsl:variable name="symbol">
181    <xsl:choose>
182     <xsl:when test="m:min">
183      <xsl:value-of select="'min'"/>
184     </xsl:when>
185     <xsl:when test="m:max">
186      <xsl:value-of select="'max'"/>
187     </xsl:when>
188    </xsl:choose>
189   </xsl:variable>
190   <xsl:choose>
191     <xsl:when test="$charlength > $framewidth">
192      <a>
193      <xsl:attribute name="href">
194       <xsl:value-of select="concat(string($header),string($uri))"/>
195      </xsl:attribute>
196      <xsl:value-of select="$symbol"/>
197      </a>
198      <xsl:text>{</xsl:text>
199      <xsl:apply-templates select="*[2]">
200       <xsl:with-param name="current_indent" select="$current_indent + 2"/>
201      </xsl:apply-templates>
202      <xsl:text>,</xsl:text>
203      <BR/> 
204      <xsl:call-template name="make_indent">
205       <xsl:with-param name="current_indent" select="$current_indent + 5"/> 
206      </xsl:call-template>
207      <xsl:apply-templates select="*[3]">
208       <xsl:with-param name="current_indent" select="$current_indent + 2"/>
209      </xsl:apply-templates>
210      <xsl:text>}</xsl:text>
211     </xsl:when>
212     <xsl:otherwise>
213      <a>
214      <xsl:attribute name="href">
215       <xsl:value-of select="concat(string($header),string($uri))"/>
216      </xsl:attribute>
217      <xsl:value-of select="$symbol"/>
218      </a>
219      <xsl:text>{</xsl:text>
220      <xsl:apply-templates select="*[2]"/>
221      <xsl:text>, </xsl:text>
222      <xsl:apply-templates select="*[3]"/>
223      <xsl:text>}</xsl:text>
224     </xsl:otherwise>
225    </xsl:choose>
226  </xsl:template>
227
228 <!-- COUNTING -->
229
230 <xsl:template match="m:abs|m:fact|m:root
231            |m:limit|m:diff|m:min|m:max" mode="charcount">
232 <xsl:param name="incurrent_length" select="0"/> 
233     <xsl:choose>
234     <xsl:when test="$framewidth >= ($incurrent_length + string-length())">
235      <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>
236      <xsl:choose>
237      <xsl:when test="string($siblength) = &quot;&quot;">
238       <xsl:value-of select="$incurrent_length + string-length()"/>
239      </xsl:when>
240      <xsl:otherwise>
241       <xsl:value-of select="number($siblength)"/>
242      </xsl:otherwise>
243      </xsl:choose>
244     </xsl:when>
245     <xsl:otherwise>
246      <xsl:value-of select="$incurrent_length + string-length()"/>
247     </xsl:otherwise>
248     </xsl:choose>
249 </xsl:template> 
250
251 </xsl:stylesheet> 
252
253
254
255
256
257
258