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 <xsl:param name="getterURL" select="'http://localhost:8081/'"/>
36 <xsl:param name="processorURL" select="'http://localhost:8080/helm/servlet/uwobo/'"/>
37 <xsl:param name="interfaceURL" select="''"/>
38 <!-- Keys contains the keys of the stylesheets to be applied following links-->
39 <xsl:param name="keys" select="'C1,HC2,L'"/>
40 <!-- Thkeys contains the keys of the stylesheets to be applied at the first
41 step for expanding objects -->
42 <xsl:param name="thkeys" select="'TC1,HC2,L'"/>
43 <xsl:param name="naturalLanguage" select="'yes'"/>
44 <xsl:param name="annotations" select="'no'"/>
45 <xsl:param name="media-type" select="'text/html'"/>
46 <xsl:param name="doctype-public" select="'-//W3C//DTD XHTML 1.0 Transitional//EN'"/>
47 <xsl:param name="encoding" select="'iso-8859-1'"/>
49 <xsl:template name="quote">
50 <xsl:param name="s" select="''"/>
51 <xsl:param name="news" select="''"/>
53 <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
55 <xsl:variable name="char" select="substring($s,1,1)"/>
57 <xsl:when test="$char = ' '">
58 <xsl:call-template name="quote">
59 <xsl:with-param name="s" select="substring($s,2)"/>
60 <xsl:with-param name="news" select="concat($news,'%20')"/>
63 <xsl:when test="$char = '&'">
64 <xsl:call-template name="quote">
65 <xsl:with-param name="s" select="substring($s,2)"/>
66 <xsl:with-param name="news" select="concat($news,'%26')"/>
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,'%3F')"/>
75 <xsl:when test="$char = '='">
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,'%3D')"/>
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,'%25')"/>
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,'%2C')"/>
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,$char)"/>
104 <xsl:variable name="absPath">
105 <xsl:call-template name="quote">
106 <xsl:with-param name="s"><xsl:value-of select="$getterURL"/>getxml?uri=</xsl:with-param>
110 <xsl:variable name="escaped-doctype-public">
111 <xsl:call-template name="quote">
112 <xsl:with-param name="s" select="$doctype-public"/>
116 <xsl:variable name="escaped-processorURL">
117 <xsl:call-template name="quote">
118 <xsl:with-param name="s" select="$processorURL"/>
122 <xsl:variable name="escaped-getterURL">
123 <xsl:call-template name="quote">
124 <xsl:with-param name="s" select="$getterURL"/>
128 <xsl:variable name="escaped-interfaceURL">
129 <xsl:call-template name="quote">
130 <xsl:with-param name="s" select="$interfaceURL"/>
134 <xsl:variable name="quotedthkeys">
135 <xsl:call-template name="quote">
136 <xsl:with-param name="s" select="'T1,T2,L,E'"/>
140 <xsl:variable name="quotedekeys">
141 <xsl:call-template name="quote">
142 <xsl:with-param name="s" select="$thkeys"/>
146 <xsl:variable name="quotedkeys">
147 <xsl:call-template name="quote">
148 <xsl:with-param name="s" select="$keys"/>
152 <xsl:variable name="quotedquotedkeys">
153 <xsl:call-template name="quote">
154 <xsl:with-param name="s" select="$quotedkeys"/>
158 <xsl:variable name="quotedquotedthkeys">
159 <xsl:call-template name="quote">
160 <xsl:with-param name="s" select="$quotedthkeys"/>
164 <xsl:variable name="header0"><xsl:value-of select="$interfaceURL"/>?url=</xsl:variable>
165 <xsl:variable name="header1"><xsl:value-of select="$escaped-processorURL"/>apply?keys=</xsl:variable>
166 <xsl:variable name="header2">&param.naturalLanguage=<xsl:value-of select="$naturalLanguage"/>&param.annotations=<xsl:value-of select="$annotations"/>&prop.media-type=<xsl:value-of select="$media-type"/>&param.media-type=<xsl:value-of select="$media-type"/>&prop.doctype-public=<xsl:value-of select="$escaped-doctype-public"/>&param.doctype-public=<xsl:value-of select="$escaped-doctype-public"/>&prop.encoding=<xsl:value-of select="$encoding"/>&param.encoding=<xsl:value-of select="$encoding"/>&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>
167 <xsl:variable name="header3">&param.thkeys=<xsl:value-of select="$quotedekeys"/></xsl:variable>
169 <xsl:variable name="quotedheader1">
170 <xsl:call-template name="quote">
171 <xsl:with-param name="s" select="$header1"/>
175 <xsl:variable name="quotedheader2">
176 <xsl:call-template name="quote">
177 <xsl:with-param name="s" select="$header2"/>
181 <xsl:variable name="quotedheader3">
182 <xsl:call-template name="quote">
183 <xsl:with-param name="s" select="$header3"/>
187 <!-- makeURL() maps URIs into URLs -->
188 <!-- The target of the URL is the whole frameset -->
190 <xsl:variable name="biquotedfixedheader">
191 <xsl:value-of select="$header0"/>
192 <xsl:value-of select="$quotedheader1"/>
193 <xsl:value-of select="$quotedquotedkeys"/>
194 <xsl:value-of select="$quotedheader2"/>
197 <xsl:variable name="biquotedthfixedheader">
198 <xsl:value-of select="$header0"/>
199 <xsl:value-of select="$quotedheader1"/>
200 <xsl:value-of select="$quotedquotedthkeys"/>
201 <xsl:value-of select="$quotedheader2"/>
204 <!-- NOTE: thkeys are propagated, but we are sure (for now!!!) that -->
205 <!-- they won't never be used. -->
206 <!-- type, instead, is not propagated -->
207 <xsl:template name="makeURL">
208 <xsl:param name="uri" select="''"/>
209 <xsl:value-of select="$biquotedfixedheader"/>
210 <xsl:value-of select="$uri"/>%26param.CICURI%3D<xsl:value-of select="$uri"/>
212 <xsl:template name="makeTheoryURL">
213 <xsl:param name="uri" select="''"/>
214 <xsl:value-of select="$biquotedthfixedheader"/>
215 <xsl:value-of select="$uri"/>%26param.CICURI%3D<xsl:value-of select="$uri"/>
216 <xsl:value-of select="$quotedheader3"/>
219 <!-- makeURL4embedding() maps URIs into URLs -->
220 <!-- The target of the URL is only the processed document -->
222 <xsl:template name="makeURL4embedding">
223 <xsl:param name="uri" select="''"/>
224 <xsl:param name="type" select="0"/>
225 <xsl:value-of select="$header1"/>
226 <xsl:value-of select="$quotedekeys"/>
227 <xsl:value-of select="$header2"/>
228 <xsl:value-of select="$uri"/>&param.CICURI=<xsl:value-of select="$uri"/>&param.type=<xsl:value-of select="$type"/>