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 <!-- auxiliary functions -->
32 <!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena -->
33 <!--***********************************************************************-->
35 <!-- * is used for objects -->
36 <!-- th* is used for theories -->
37 <!-- embed* is used for objects embedded in theories -->
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="''"/>
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'"/>
53 <xsl:param name="naturalLanguage" select="'yes'"/>
54 <xsl:param name="annotations" select="'no'"/>
55 <xsl:param name="UNICODEvsSYMBOL" select="'symbol'"/>
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'"/>
64 <xsl:template name="quote">
65 <xsl:param name="s" select="''"/>
66 <xsl:param name="news" select="''"/>
68 <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
70 <xsl:variable name="char" select="substring($s,1,1)"/>
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')"/>
78 <xsl:when test="$char = '&'">
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')"/>
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')"/>
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')"/>
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')"/>
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')"/>
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')"/>
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)"/>
127 <xsl:variable name="absPath">
128 <!-- Zack: two levels of quoting because libxslt 'document()'
129 implementation perform an unquoting on the given URL -->
130 <xsl:call-template name="quote">
131 <xsl:with-param name="s">
132 <xsl:call-template name="quote">
133 <xsl:with-param name="s"><xsl:value-of select="$getterURL"/>getxml?uri=</xsl:with-param>
139 <xsl:variable name="escaped-doctype-public">
140 <xsl:call-template name="quote">
141 <xsl:with-param name="s" select="$doctype-public"/>
145 <xsl:variable name="escaped-processorURL">
146 <xsl:call-template name="quote">
147 <xsl:with-param name="s" select="$processorURL"/>
151 <xsl:variable name="escaped-getterURL">
152 <xsl:call-template name="quote">
153 <xsl:with-param name="s" select="$getterURL"/>
157 <xsl:variable name="escaped-interfaceURL">
158 <xsl:call-template name="quote">
159 <xsl:with-param name="s" select="$interfaceURL"/>
163 <xsl:variable name="escaped-topurl">
164 <xsl:call-template name="quote">
165 <xsl:with-param name="s" select="$topurl"/>
169 <xsl:variable name="escaped-thinterfaceURL">
170 <xsl:call-template name="quote">
171 <xsl:with-param name="s" select="$thinterfaceURL"/>
175 <xsl:variable name="quotedthkeys">
176 <xsl:call-template name="quote">
177 <xsl:with-param name="s" select="$thkeys"/>
181 <xsl:variable name="quotedembedkeys">
182 <xsl:call-template name="quote">
183 <xsl:with-param name="s" select="$embedkeys"/>
187 <xsl:variable name="quotedkeys">
188 <xsl:call-template name="quote">
189 <xsl:with-param name="s" select="$keys"/>
193 <xsl:variable name="quotedquotedkeys">
194 <xsl:call-template name="quote">
195 <xsl:with-param name="s" select="$quotedkeys"/>
199 <xsl:variable name="quotedquotedthkeys">
200 <xsl:call-template name="quote">
201 <xsl:with-param name="s" select="$quotedthkeys"/>
205 <xsl:variable name="quotedquotedembedkeys">
206 <xsl:call-template name="quote">
207 <xsl:with-param name="s" select="$quotedembedkeys"/>
211 <xsl:variable name="header0"><xsl:value-of select="$interfaceURL"/>?url=</xsl:variable>
212 <xsl:variable name="thheader0"><xsl:value-of select="$thinterfaceURL"/>?url=</xsl:variable>
213 <xsl:variable name="header1"><xsl:value-of select="$escaped-processorURL"/>apply?keys=</xsl:variable>
214 <xsl:variable name="bothheader2">&param.naturalLanguage=<xsl:value-of select="$naturalLanguage"/>&param.proofcheckerURL=<xsl:value-of select="$proofcheckerURL"/>&param.draw_graphURL=<xsl:value-of select="$draw_graphURL"/>&param.uri_set_queueURL=<xsl:value-of select="$uri_set_queueURL"/>&param.UNICODEvsSYMBOL=<xsl:value-of select="$UNICODEvsSYMBOL"/>&param.annotations=<xsl:value-of select="$annotations"/>&prop.doctype-public=<xsl:value-of select="$escaped-doctype-public"/>&param.doctype-public=<xsl:value-of select="$escaped-doctype-public"/>&param.encoding=<xsl:value-of select="$encoding"/>&param.media-type=<xsl:value-of select="$media-type"/>&param.keys=<xsl:value-of select="$quotedkeys"/>&param.getterURL=<xsl:value-of select="$escaped-getterURL"/>&param.processorURL=<xsl:value-of select="$escaped-processorURL"/>&param.interfaceURL=<xsl:value-of select="$escaped-interfaceURL"/>&param.topurl=<xsl:value-of select="$escaped-topurl"/>&xmluri=<xsl:value-of select="$absPath"/></xsl:variable>
215 <xsl:variable name="header2">&prop.media-type=<xsl:value-of select="$media-type"/>&prop.encoding=<xsl:value-of select="$encoding"/></xsl:variable>
216 <xsl:variable name="thheader2">&prop.media-type=<xsl:value-of select="$thmedia-type"/>&param.thmedia-type=<xsl:value-of select="$thmedia-type"/>&param.thkeys=<xsl:value-of select="$quotedthkeys"/>&param.embedkeys=<xsl:value-of select="$quotedembedkeys"/>&param.thinterfaceURL=<xsl:value-of select="$escaped-thinterfaceURL"/>&param.thencoding=<xsl:value-of select="$thencoding"/>&prop.encoding=<xsl:value-of select="$thencoding"/></xsl:variable>
218 <xsl:variable name="quotedheader1">
219 <xsl:call-template name="quote">
220 <xsl:with-param name="s" select="$header1"/>
224 <xsl:variable name="quotedbothheader2">
225 <xsl:call-template name="quote">
226 <xsl:with-param name="s" select="$bothheader2"/>
230 <xsl:variable name="quotedheader2">
231 <xsl:call-template name="quote">
232 <xsl:with-param name="s" select="$header2"/>
236 <xsl:variable name="quotedthheader2">
237 <xsl:call-template name="quote">
238 <xsl:with-param name="s" select="$thheader2"/>
242 <!-- makeURL() maps URIs into URLs -->
243 <!-- The target of the URL is the whole frameset -->
245 <xsl:variable name="biquotedfixedheader">
246 <xsl:value-of select="$header0"/>
247 <xsl:value-of select="$quotedheader1"/>
248 <xsl:value-of select="$quotedquotedkeys"/>
249 <xsl:value-of select="$quotedheader2"/>
250 <xsl:value-of select="$quotedbothheader2"/>
253 <xsl:variable name="biquotedthfixedheader">
254 <xsl:value-of select="$thheader0"/>
255 <xsl:value-of select="$quotedheader1"/>
256 <xsl:value-of select="$quotedquotedthkeys"/>
257 <xsl:value-of select="$quotedthheader2"/>
258 <xsl:value-of select="$quotedbothheader2"/>
261 <!-- NOTE: embedkeys and thkeys are propagated, but we are sure that -->
262 <!-- they won't never be used. -->
263 <!--CSC: fixare il punto sopra!!! -->
264 <!-- type, instead, is not propagated -->
265 <xsl:template name="makeURL">
266 <xsl:param name="uri" select="''"/>
267 <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
268 <xsl:variable name="cleanuri">
270 <xsl:when test="$uri_after_sharp">
271 <xsl:value-of select="substring-before($uri,'#')"/>
274 <xsl:value-of select="$uri"/>
278 <xsl:variable name="sharpsuffix">
280 <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
281 <xsl:otherwise></xsl:otherwise>
284 <xsl:value-of select="$biquotedfixedheader"/>
285 <xsl:value-of select="$cleanuri"/>%26param.CICURI%3D<xsl:value-of select="$cleanuri"/>
286 <xsl:value-of select="$sharpsuffix"/>
289 <xsl:template name="makeTheoryURL">
290 <xsl:param name="uri" select="''"/>
291 <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
292 <xsl:variable name="cleanuri">
294 <xsl:when test="$uri_after_sharp">
295 <xsl:value-of select="substring-before($uri,'#')"/>
298 <xsl:value-of select="$uri"/>
302 <xsl:variable name="sharpsuffix">
304 <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
305 <xsl:otherwise></xsl:otherwise>
308 <xsl:value-of select="$biquotedthfixedheader"/>
309 <xsl:value-of select="$cleanuri"/>%26param.CICURI%3D<xsl:value-of select="$cleanuri"/>
310 <xsl:value-of select="$sharpsuffix"/>
313 <!-- makeURL4embedding() maps URIs into URLs -->
314 <!-- The target of the URL is only the processed document -->
316 <xsl:template name="makeURL4embedding">
317 <xsl:param name="uri" select="''"/>
318 <xsl:param name="type" select="'standalone'"/>
319 <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
320 <xsl:variable name="cleanuri">
322 <xsl:when test="$uri_after_sharp">
323 <xsl:value-of select="substring-before($uri,'#')"/>
326 <xsl:value-of select="$uri"/>
330 <xsl:variable name="sharpsuffix">
332 <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
333 <xsl:otherwise></xsl:otherwise>
336 <xsl:value-of select="$header1"/>
337 <xsl:value-of select="$quotedembedkeys"/>
338 <xsl:value-of select="$header2"/>
339 <xsl:value-of select="$bothheader2"/>
340 <xsl:value-of select="$cleanuri"/>&param.CICURI=<xsl:value-of select="$cleanuri"/>&param.type=<xsl:value-of select="$type"/><xsl:value-of select="$sharpsuffix"/>
343 <!-- makeURL4InnerTypes() maps URIs into URLs -->
344 <!-- The target of the URL is only the processed document -->
346 <xsl:template name="makeURL4InnerTypes">
347 <xsl:param name="uri" select="''"/>
348 <xsl:variable name="uri_after_sharp" select="substring-after($uri,'#')"/>
349 <xsl:variable name="cleanuri">
351 <xsl:when test="$uri_after_sharp">
352 <xsl:value-of select="substring-before($uri,'#')"/>
355 <xsl:value-of select="$uri"/>
359 <xsl:variable name="sharpsuffix">
361 <xsl:when test="$uri_after_sharp">%23<xsl:value-of select="$uri_after_sharp"/></xsl:when>
362 <xsl:otherwise></xsl:otherwise>
365 <xsl:value-of select="$header1"/>d_c&param.getterURL=<xsl:value-of select="$escaped-getterURL"/>&param.CICURI=<xsl:value-of select="$cleanuri"/>&xmluri=<xsl:value-of select="$absPath"/><xsl:value-of select="$cleanuri"/>
366 <xsl:value-of select="$sharpsuffix"/>