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 <!-- URL to the frameset (control + output) -->
42 <xsl:param name="interfaceURL" select="''"/>
43 <xsl:param name="thinterfaceURL" select="''"/>
45 <xsl:param name="keys" select="'C1,HC2,L'"/>
46 <xsl:param name="embedkeys" select="'TC1,HC2,L'"/>
47 <xsl:param name="thkeys" select="'T1,T2,L,E'"/>
49 <xsl:param name="naturalLanguage" select="'yes'"/>
50 <xsl:param name="annotations" select="'no'"/>
52 <xsl:param name="media-type" select="'text/html'"/>
53 <xsl:param name="thmedia-type" select="'text/html'"/>
54 <xsl:param name="doctype-public" select="'-//W3C//DTD XHTML 1.0 Transitional//EN'"/>
55 <xsl:param name="encoding" select="'iso-8859-1'"/>
56 <xsl:param name="thencoding" select="'iso-8859-1'"/>
59 <xsl:template name="quote">
60 <xsl:param name="s" select="''"/>
61 <xsl:param name="news" select="''"/>
63 <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
65 <xsl:variable name="char" select="substring($s,1,1)"/>
67 <xsl:when test="$char = ' '">
68 <xsl:call-template name="quote">
69 <xsl:with-param name="s" select="substring($s,2)"/>
70 <xsl:with-param name="news" select="concat($news,'%20')"/>
73 <xsl:when test="$char = '&'">
74 <xsl:call-template name="quote">
75 <xsl:with-param name="s" select="substring($s,2)"/>
76 <xsl:with-param name="news" select="concat($news,'%26')"/>
79 <xsl:when test="$char = '?'">
80 <xsl:call-template name="quote">
81 <xsl:with-param name="s" select="substring($s,2)"/>
82 <xsl:with-param name="news" select="concat($news,'%3F')"/>
85 <xsl:when test="$char = '='">
86 <xsl:call-template name="quote">
87 <xsl:with-param name="s" select="substring($s,2)"/>
88 <xsl:with-param name="news" select="concat($news,'%3D')"/>
91 <xsl:when test="$char = '%'">
92 <xsl:call-template name="quote">
93 <xsl:with-param name="s" select="substring($s,2)"/>
94 <xsl:with-param name="news" select="concat($news,'%25')"/>
97 <xsl:when test="$char = ','">
98 <xsl:call-template name="quote">
99 <xsl:with-param name="s" select="substring($s,2)"/>
100 <xsl:with-param name="news" select="concat($news,'%2C')"/>
104 <xsl:call-template name="quote">
105 <xsl:with-param name="s" select="substring($s,2)"/>
106 <xsl:with-param name="news" select="concat($news,$char)"/>
114 <xsl:variable name="absPath">
115 <xsl:call-template name="quote">
116 <xsl:with-param name="s"><xsl:value-of select="$getterURL"/>getxml?uri=</xsl:with-param>
120 <xsl:variable name="escaped-doctype-public">
121 <xsl:call-template name="quote">
122 <xsl:with-param name="s" select="$doctype-public"/>
126 <xsl:variable name="escaped-processorURL">
127 <xsl:call-template name="quote">
128 <xsl:with-param name="s" select="$processorURL"/>
132 <xsl:variable name="escaped-getterURL">
133 <xsl:call-template name="quote">
134 <xsl:with-param name="s" select="$getterURL"/>
138 <xsl:variable name="escaped-interfaceURL">
139 <xsl:call-template name="quote">
140 <xsl:with-param name="s" select="$interfaceURL"/>
144 <xsl:variable name="escaped-thinterfaceURL">
145 <xsl:call-template name="quote">
146 <xsl:with-param name="s" select="$thinterfaceURL"/>
150 <xsl:variable name="quotedthkeys">
151 <xsl:call-template name="quote">
152 <xsl:with-param name="s" select="$thkeys"/>
156 <xsl:variable name="quotedembedkeys">
157 <xsl:call-template name="quote">
158 <xsl:with-param name="s" select="$embedkeys"/>
162 <xsl:variable name="quotedkeys">
163 <xsl:call-template name="quote">
164 <xsl:with-param name="s" select="$keys"/>
168 <xsl:variable name="quotedquotedkeys">
169 <xsl:call-template name="quote">
170 <xsl:with-param name="s" select="$quotedkeys"/>
174 <xsl:variable name="quotedquotedthkeys">
175 <xsl:call-template name="quote">
176 <xsl:with-param name="s" select="$quotedthkeys"/>
180 <xsl:variable name="quotedquotedembedkeys">
181 <xsl:call-template name="quote">
182 <xsl:with-param name="s" select="$quotedembedkeys"/>
186 <xsl:variable name="header0"><xsl:value-of select="$interfaceURL"/>?url=</xsl:variable>
187 <xsl:variable name="thheader0"><xsl:value-of select="$thinterfaceURL"/>?url=</xsl:variable>
188 <xsl:variable name="header1"><xsl:value-of select="$escaped-processorURL"/>apply?keys=</xsl:variable>
189 <xsl:variable name="bothheader2">&param.naturalLanguage=<xsl:value-of select="$naturalLanguage"/>&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"/>&xmluri=<xsl:value-of select="$absPath"/></xsl:variable>
190 <xsl:variable name="header2">&prop.media-type=<xsl:value-of select="$media-type"/>&prop.encoding=<xsl:value-of select="$encoding"/></xsl:variable>
191 <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>
193 <xsl:variable name="quotedheader1">
194 <xsl:call-template name="quote">
195 <xsl:with-param name="s" select="$header1"/>
199 <xsl:variable name="quotedbothheader2">
200 <xsl:call-template name="quote">
201 <xsl:with-param name="s" select="$bothheader2"/>
205 <xsl:variable name="quotedheader2">
206 <xsl:call-template name="quote">
207 <xsl:with-param name="s" select="$header2"/>
211 <xsl:variable name="quotedthheader2">
212 <xsl:call-template name="quote">
213 <xsl:with-param name="s" select="$thheader2"/>
217 <!-- makeURL() maps URIs into URLs -->
218 <!-- The target of the URL is the whole frameset -->
220 <xsl:variable name="biquotedfixedheader">
221 <xsl:value-of select="$header0"/>
222 <xsl:value-of select="$quotedheader1"/>
223 <xsl:value-of select="$quotedquotedkeys"/>
224 <xsl:value-of select="$quotedheader2"/>
225 <xsl:value-of select="$quotedbothheader2"/>
228 <xsl:variable name="biquotedthfixedheader">
229 <xsl:value-of select="$thheader0"/>
230 <xsl:value-of select="$quotedheader1"/>
231 <xsl:value-of select="$quotedquotedthkeys"/>
232 <xsl:value-of select="$quotedthheader2"/>
233 <xsl:value-of select="$quotedbothheader2"/>
236 <!-- NOTE: embedkeys and thkeys are propagated, but we are sure that -->
237 <!-- they won't never be used. -->
238 <!--CSC: fixare il punto sopra!!! -->
239 <!-- type, instead, is not propagated -->
240 <xsl:template name="makeURL">
241 <xsl:param name="uri" select="''"/>
242 <xsl:value-of select="$biquotedfixedheader"/>
243 <xsl:value-of select="$uri"/>%26param.CICURI%3D<xsl:value-of select="$uri"/>
245 <xsl:template name="makeTheoryURL">
246 <xsl:param name="uri" select="''"/>
247 <xsl:value-of select="$biquotedthfixedheader"/>
248 <xsl:value-of select="$uri"/>%26param.CICURI%3D<xsl:value-of select="$uri"/>
251 <!-- makeURL4embedding() maps URIs into URLs -->
252 <!-- The target of the URL is only the processed document -->
254 <xsl:template name="makeURL4embedding">
255 <xsl:param name="uri" select="''"/>
256 <xsl:param name="type" select="0"/>
257 <xsl:value-of select="$header1"/>
258 <xsl:value-of select="$quotedembedkeys"/>
259 <xsl:value-of select="$header2"/>
260 <xsl:value-of select="$bothheader2"/>
261 <xsl:value-of select="$uri"/>&param.CICURI=<xsl:value-of select="$uri"/>&param.type=<xsl:value-of select="$type"/>