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