]> matita.cs.unibo.it Git - helm.git/blob - helm/style/links_library.xsl
Two parameters used but not declared. Fixed.
[helm.git] / helm / style / links_library.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 <!-- auxiliary functions                                                   -->
32 <!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena                      -->
33 <!--***********************************************************************--> 
34
35 <!--      * is used for objects                      -->
36 <!--    th* is used for theories                     -->
37 <!-- embed* is used for objects embedded in theories -->
38
39 <xsl:param name="getterURL" select="'http://localhost:8081/'"/>
40 <xsl:param name="processorURL" select="'http://localhost:8080/helm/servlet/uwobo/'"/>
41 <!-- URL to the frameset (control + output) -->
42 <xsl:param name="topurl" select="''"/>
43 <xsl:param name="interfaceURL" select="''"/>
44 <xsl:param name="thinterfaceURL" select="''"/>
45
46 <xsl:param name="keys" select="'C1,HC2,L'"/>
47 <xsl:param name="embedkeys" select="'TC1,HC2,L'"/>
48 <xsl:param name="thkeys" select="'T1,T2,L,E'"/>
49
50 <xsl:param name="naturalLanguage" select="'yes'"/>
51 <xsl:param name="annotations" select="'no'"/>
52 <xsl:param name="UNICODEvsSYMBOL" select="'symbol'"/>
53
54 <xsl:param name="media-type" select="'text/html'"/>
55 <xsl:param name="thmedia-type" select="'text/html'"/>
56 <xsl:param name="doctype-public" select="'-//W3C//DTD XHTML 1.0 Transitional//EN'"/>
57 <xsl:param name="encoding" select="'iso-8859-1'"/>
58 <xsl:param name="thencoding" select="'iso-8859-1'"/>
59
60
61 <xsl:template name="quote">
62  <xsl:param name="s" select="''"/>
63  <xsl:param name="news" select="''"/>
64  <xsl:choose>
65   <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
66   <xsl:otherwise>
67    <xsl:variable name="char" select="substring($s,1,1)"/>
68    <xsl:choose>
69     <xsl:when test="$char = ' '">
70      <xsl:call-template name="quote">
71       <xsl:with-param name="s" select="substring($s,2)"/>
72       <xsl:with-param name="news" select="concat($news,'%20')"/>
73      </xsl:call-template>
74     </xsl:when>
75     <xsl:when test="$char = '&amp;'">
76      <xsl:call-template name="quote">
77       <xsl:with-param name="s" select="substring($s,2)"/>
78       <xsl:with-param name="news" select="concat($news,'%26')"/>
79      </xsl:call-template>
80     </xsl:when>
81     <xsl:when test="$char = '?'">
82      <xsl:call-template name="quote">
83       <xsl:with-param name="s" select="substring($s,2)"/>
84       <xsl:with-param name="news" select="concat($news,'%3F')"/>
85      </xsl:call-template>
86     </xsl:when>
87     <xsl:when test="$char = '='">
88      <xsl:call-template name="quote">
89       <xsl:with-param name="s" select="substring($s,2)"/>
90       <xsl:with-param name="news" select="concat($news,'%3D')"/>
91      </xsl:call-template>
92     </xsl:when>
93     <xsl:when test="$char = '%'">
94      <xsl:call-template name="quote">
95       <xsl:with-param name="s" select="substring($s,2)"/>
96       <xsl:with-param name="news" select="concat($news,'%25')"/>
97      </xsl:call-template>
98     </xsl:when>
99     <xsl:when test="$char = ','">
100      <xsl:call-template name="quote">
101       <xsl:with-param name="s" select="substring($s,2)"/>
102       <xsl:with-param name="news" select="concat($news,'%2C')"/>
103      </xsl:call-template>
104     </xsl:when>
105 <!--CSC: This breaks all the rest ;-)
106     <xsl:when test="$char = ':'">
107      <xsl:call-template name="quote">
108       <xsl:with-param name="s" select="substring($s,2)"/>
109       <xsl:with-param name="news" select="concat($news,'%3A')"/>
110      </xsl:call-template>
111     </xsl:when>
112 -->
113     <xsl:otherwise>
114      <xsl:call-template name="quote">
115       <xsl:with-param name="s" select="substring($s,2)"/>
116       <xsl:with-param name="news" select="concat($news,$char)"/>
117      </xsl:call-template>
118     </xsl:otherwise>
119    </xsl:choose>
120   </xsl:otherwise>
121  </xsl:choose>
122 </xsl:template>
123
124 <xsl:variable name="absPath">
125  <xsl:call-template name="quote">
126   <xsl:with-param name="s"><xsl:value-of select="$getterURL"/>getxml?uri=</xsl:with-param>
127  </xsl:call-template>
128 </xsl:variable>
129
130 <xsl:variable name="escaped-doctype-public">
131  <xsl:call-template name="quote">
132   <xsl:with-param name="s" select="$doctype-public"/>
133  </xsl:call-template>
134 </xsl:variable>
135
136 <xsl:variable name="escaped-processorURL">
137  <xsl:call-template name="quote">
138   <xsl:with-param name="s" select="$processorURL"/>
139  </xsl:call-template>
140 </xsl:variable>
141
142 <xsl:variable name="escaped-getterURL">
143  <xsl:call-template name="quote">
144   <xsl:with-param name="s" select="$getterURL"/>
145  </xsl:call-template>
146 </xsl:variable>
147
148 <xsl:variable name="escaped-interfaceURL">
149  <xsl:call-template name="quote">
150   <xsl:with-param name="s" select="$interfaceURL"/>
151  </xsl:call-template>
152 </xsl:variable>
153
154 <xsl:variable name="escaped-topurl">
155  <xsl:call-template name="quote">
156   <xsl:with-param name="s" select="$topurl"/>
157  </xsl:call-template>
158 </xsl:variable>
159
160 <xsl:variable name="escaped-thinterfaceURL">
161  <xsl:call-template name="quote">
162   <xsl:with-param name="s" select="$thinterfaceURL"/>
163  </xsl:call-template>
164 </xsl:variable>
165
166 <xsl:variable name="quotedthkeys">
167  <xsl:call-template name="quote">
168   <xsl:with-param name="s" select="$thkeys"/>
169  </xsl:call-template>
170 </xsl:variable>
171
172 <xsl:variable name="quotedembedkeys">
173  <xsl:call-template name="quote">
174   <xsl:with-param name="s" select="$embedkeys"/>
175  </xsl:call-template>
176 </xsl:variable>
177
178 <xsl:variable name="quotedkeys">
179  <xsl:call-template name="quote">
180   <xsl:with-param name="s" select="$keys"/>
181  </xsl:call-template>
182 </xsl:variable>
183
184 <xsl:variable name="quotedquotedkeys">
185  <xsl:call-template name="quote">
186   <xsl:with-param name="s" select="$quotedkeys"/>
187  </xsl:call-template>
188 </xsl:variable>
189
190 <xsl:variable name="quotedquotedthkeys">
191  <xsl:call-template name="quote">
192   <xsl:with-param name="s" select="$quotedthkeys"/>
193  </xsl:call-template>
194 </xsl:variable>
195
196 <xsl:variable name="quotedquotedembedkeys">
197  <xsl:call-template name="quote">
198   <xsl:with-param name="s" select="$quotedembedkeys"/>
199  </xsl:call-template>
200 </xsl:variable>
201
202 <xsl:variable name="header0"><xsl:value-of select="$interfaceURL"/>?url=</xsl:variable>
203 <xsl:variable name="thheader0"><xsl:value-of select="$thinterfaceURL"/>?url=</xsl:variable>
204 <xsl:variable name="header1"><xsl:value-of select="$escaped-processorURL"/>apply?keys=</xsl:variable>
205 <xsl:variable name="bothheader2">&#x26;param.naturalLanguage=<xsl:value-of select="$naturalLanguage"/>&#x26;param.UNICODEvsSYMBOL=<xsl:value-of select="$UNICODEvsSYMBOL"/>&#x26;param.annotations=<xsl:value-of select="$annotations"/>&#x26;prop.doctype-public=<xsl:value-of select="$escaped-doctype-public"/>&#x26;param.doctype-public=<xsl:value-of select="$escaped-doctype-public"/>&#x26;param.encoding=<xsl:value-of select="$encoding"/>&#x26;param.media-type=<xsl:value-of select="$media-type"/>&#x26;param.keys=<xsl:value-of select="$quotedkeys"/>&#x26;param.getterURL=<xsl:value-of select="$escaped-getterURL"/>&#x26;param.processorURL=<xsl:value-of select="$escaped-processorURL"/>&#x26;param.interfaceURL=<xsl:value-of select="$escaped-interfaceURL"/>&#x26;param.topurl=<xsl:value-of select="$escaped-topurl"/>&#x26;xmluri=<xsl:value-of select="$absPath"/></xsl:variable>
206 <xsl:variable name="header2">&#x26;prop.media-type=<xsl:value-of select="$media-type"/>&#x26;prop.encoding=<xsl:value-of select="$encoding"/></xsl:variable>
207 <xsl:variable name="thheader2">&#x26;prop.media-type=<xsl:value-of select="$thmedia-type"/>&#x26;param.thmedia-type=<xsl:value-of select="$thmedia-type"/>&#x26;param.thkeys=<xsl:value-of select="$quotedthkeys"/>&#x26;param.embedkeys=<xsl:value-of select="$quotedembedkeys"/>&#x26;param.thinterfaceURL=<xsl:value-of select="$escaped-thinterfaceURL"/>&#x26;param.thencoding=<xsl:value-of select="$thencoding"/>&#x26;prop.encoding=<xsl:value-of select="$thencoding"/></xsl:variable>
208
209 <xsl:variable name="quotedheader1">
210  <xsl:call-template name="quote">
211   <xsl:with-param name="s" select="$header1"/>
212  </xsl:call-template>
213 </xsl:variable>
214
215 <xsl:variable name="quotedbothheader2">
216  <xsl:call-template name="quote">
217   <xsl:with-param name="s" select="$bothheader2"/>
218  </xsl:call-template>
219 </xsl:variable>
220
221 <xsl:variable name="quotedheader2">
222  <xsl:call-template name="quote">
223   <xsl:with-param name="s" select="$header2"/>
224  </xsl:call-template>
225 </xsl:variable>
226
227 <xsl:variable name="quotedthheader2">
228  <xsl:call-template name="quote">
229   <xsl:with-param name="s" select="$thheader2"/>
230  </xsl:call-template>
231 </xsl:variable>
232
233 <!-- makeURL() maps URIs into URLs               -->
234 <!-- The target of the URL is the whole frameset -->
235
236 <xsl:variable name="biquotedfixedheader">
237  <xsl:value-of select="$header0"/>
238  <xsl:value-of select="$quotedheader1"/>
239  <xsl:value-of select="$quotedquotedkeys"/>
240  <xsl:value-of select="$quotedheader2"/>
241  <xsl:value-of select="$quotedbothheader2"/>
242 </xsl:variable>
243
244 <xsl:variable name="biquotedthfixedheader">
245  <xsl:value-of select="$thheader0"/>
246  <xsl:value-of select="$quotedheader1"/>
247  <xsl:value-of select="$quotedquotedthkeys"/>
248  <xsl:value-of select="$quotedthheader2"/>
249  <xsl:value-of select="$quotedbothheader2"/>
250 </xsl:variable>
251
252 <!-- NOTE: embedkeys and thkeys are propagated, but we are sure that -->
253 <!-- they won't never be used.                                       -->
254 <!--CSC: fixare il punto sopra!!! -->
255 <!-- type, instead, is not propagated                                -->
256 <xsl:template name="makeURL">
257 <xsl:param name="uri" select="''"/>
258  <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
259  <xsl:variable name="cleanuri">
260   <xsl:choose>
261    <xsl:when test="$uri_after_sharp">
262     <xsl:value-of select="substring-before($uri,'#')"/>
263    </xsl:when>
264    <xsl:otherwise>
265     <xsl:value-of select="$uri"/>
266    </xsl:otherwise>
267   </xsl:choose>
268  </xsl:variable>
269  <xsl:variable name="sharpsuffix">
270   <xsl:choose>
271    <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
272    <xsl:otherwise></xsl:otherwise>
273   </xsl:choose>
274  </xsl:variable>
275      <xsl:value-of select="$biquotedfixedheader"/>
276      <xsl:value-of select="$cleanuri"/>%26param.CICURI%3D<xsl:value-of select="$cleanuri"/>
277      <xsl:value-of select="$sharpsuffix"/>
278 </xsl:template>
279
280 <xsl:template name="makeTheoryURL">
281 <xsl:param name="uri" select="''"/>
282  <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
283  <xsl:variable name="cleanuri">
284   <xsl:choose>
285    <xsl:when test="$uri_after_sharp">
286     <xsl:value-of select="substring-before($uri,'#')"/>
287    </xsl:when>
288    <xsl:otherwise>
289     <xsl:value-of select="$uri"/>
290    </xsl:otherwise>
291   </xsl:choose>
292  </xsl:variable>
293  <xsl:variable name="sharpsuffix">
294   <xsl:choose>
295    <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
296    <xsl:otherwise></xsl:otherwise>
297   </xsl:choose>
298  </xsl:variable>
299      <xsl:value-of select="$biquotedthfixedheader"/>
300      <xsl:value-of select="$cleanuri"/>%26param.CICURI%3D<xsl:value-of select="$cleanuri"/>
301      <xsl:value-of select="$sharpsuffix"/>
302 </xsl:template>
303
304 <!-- makeURL4embedding() maps URIs into URLs              -->
305 <!-- The target of the URL is only the processed document -->
306
307 <xsl:template name="makeURL4embedding">
308 <xsl:param name="uri" select="''"/>
309 <xsl:param name="type" select="'standalone'"/>
310  <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
311  <xsl:variable name="cleanuri">
312   <xsl:choose>
313    <xsl:when test="$uri_after_sharp">
314     <xsl:value-of select="substring-before($uri,'#')"/>
315    </xsl:when>
316    <xsl:otherwise>
317     <xsl:value-of select="$uri"/>
318    </xsl:otherwise>
319   </xsl:choose>
320  </xsl:variable>
321  <xsl:variable name="sharpsuffix">
322   <xsl:choose>
323    <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
324    <xsl:otherwise></xsl:otherwise>
325   </xsl:choose>
326  </xsl:variable>
327  <xsl:value-of select="$header1"/>
328  <xsl:value-of select="$quotedembedkeys"/>
329  <xsl:value-of select="$header2"/>
330  <xsl:value-of select="$bothheader2"/>
331  <xsl:value-of select="$cleanuri"/>&#x26;param.CICURI=<xsl:value-of select="$cleanuri"/>&#x26;param.type=<xsl:value-of select="$type"/><xsl:value-of select="$sharpsuffix"/>
332 </xsl:template>
333
334 <!-- makeURL4InnerTypes() maps URIs into URLs              -->
335 <!-- The target of the URL is only the processed document -->
336
337 <xsl:template name="makeURL4InnerTypes">
338 <xsl:param name="uri" select="''"/>
339  <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
340  <xsl:variable name="cleanuri">
341   <xsl:choose>
342    <xsl:when test="$uri_after_sharp">
343     <xsl:value-of select="substring-before($uri,'#')"/>
344    </xsl:when>
345    <xsl:otherwise>
346     <xsl:value-of select="$uri"/>
347    </xsl:otherwise>
348   </xsl:choose>
349  </xsl:variable>
350  <xsl:variable name="sharpsuffix">
351   <xsl:choose>
352    <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
353    <xsl:otherwise></xsl:otherwise>
354   </xsl:choose>
355  </xsl:variable>
356  <xsl:value-of select="$header1"/>d_c&#x26;param.getterURL=<xsl:value-of select="$escaped-getterURL"/>&#x26;param.CICURI=<xsl:value-of select="$cleanuri"/>&#x26;xmluri=<xsl:value-of select="$absPath"/><xsl:value-of select="$cleanuri"/>
357  <xsl:value-of select="$sharpsuffix"/>
358 </xsl:template>
359
360 </xsl:stylesheet> 
361
362
363