]> matita.cs.unibo.it Git - helm.git/blob - helm/style/links_library.xsl
Bug fixed: following a link to an object inside a theory opened the object
[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 <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 <xsl:param name="thinterfaceURL" select="''"/>
39 <!-- Keys contains the keys of the stylesheets to be applied following links-->
40 <xsl:param name="keys" select="'C1,HC2,L'"/>
41 <!-- Thkeys contains the keys of the stylesheets to be applied at the first 
42 step for expanding objects --> 
43 <xsl:param name="thkeys" select="'TC1,HC2,L'"/>
44 <xsl:param name="naturalLanguage" select="'yes'"/>
45 <xsl:param name="annotations" select="'no'"/>
46 <xsl:param name="media-type" select="'text/html'"/>
47 <xsl:param name="doctype-public" select="'-//W3C//DTD XHTML 1.0 Transitional//EN'"/>
48 <xsl:param name="encoding" select="'iso-8859-1'"/>
49
50 <xsl:template name="quote">
51  <xsl:param name="s" select="''"/>
52  <xsl:param name="news" select="''"/>
53  <xsl:choose>
54   <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
55   <xsl:otherwise>
56    <xsl:variable name="char" select="substring($s,1,1)"/>
57    <xsl:choose>
58     <xsl:when test="$char = ' '">
59      <xsl:call-template name="quote">
60       <xsl:with-param name="s" select="substring($s,2)"/>
61       <xsl:with-param name="news" select="concat($news,'%20')"/>
62      </xsl:call-template>
63     </xsl:when>
64     <xsl:when test="$char = '&amp;'">
65      <xsl:call-template name="quote">
66       <xsl:with-param name="s" select="substring($s,2)"/>
67       <xsl:with-param name="news" select="concat($news,'%26')"/>
68      </xsl:call-template>
69     </xsl:when>
70     <xsl:when test="$char = '?'">
71      <xsl:call-template name="quote">
72       <xsl:with-param name="s" select="substring($s,2)"/>
73       <xsl:with-param name="news" select="concat($news,'%3F')"/>
74      </xsl:call-template>
75     </xsl:when>
76     <xsl:when test="$char = '='">
77      <xsl:call-template name="quote">
78       <xsl:with-param name="s" select="substring($s,2)"/>
79       <xsl:with-param name="news" select="concat($news,'%3D')"/>
80      </xsl:call-template>
81     </xsl:when>
82     <xsl:when test="$char = '%'">
83      <xsl:call-template name="quote">
84       <xsl:with-param name="s" select="substring($s,2)"/>
85       <xsl:with-param name="news" select="concat($news,'%25')"/>
86      </xsl:call-template>
87     </xsl:when>
88     <xsl:when test="$char = ','">
89      <xsl:call-template name="quote">
90       <xsl:with-param name="s" select="substring($s,2)"/>
91       <xsl:with-param name="news" select="concat($news,'%2C')"/>
92      </xsl:call-template>
93     </xsl:when>
94     <xsl:otherwise>
95      <xsl:call-template name="quote">
96       <xsl:with-param name="s" select="substring($s,2)"/>
97       <xsl:with-param name="news" select="concat($news,$char)"/>
98      </xsl:call-template>
99     </xsl:otherwise>
100    </xsl:choose>
101   </xsl:otherwise>
102  </xsl:choose>
103 </xsl:template>
104
105 <xsl:variable name="absPath">
106  <xsl:call-template name="quote">
107   <xsl:with-param name="s"><xsl:value-of select="$getterURL"/>getxml?uri=</xsl:with-param>
108  </xsl:call-template>
109 </xsl:variable>
110
111 <xsl:variable name="escaped-doctype-public">
112  <xsl:call-template name="quote">
113   <xsl:with-param name="s" select="$doctype-public"/>
114  </xsl:call-template>
115 </xsl:variable>
116
117 <xsl:variable name="escaped-processorURL">
118  <xsl:call-template name="quote">
119   <xsl:with-param name="s" select="$processorURL"/>
120  </xsl:call-template>
121 </xsl:variable>
122
123 <xsl:variable name="escaped-getterURL">
124  <xsl:call-template name="quote">
125   <xsl:with-param name="s" select="$getterURL"/>
126  </xsl:call-template>
127 </xsl:variable>
128
129 <xsl:variable name="escaped-interfaceURL">
130  <xsl:call-template name="quote">
131   <xsl:with-param name="s" select="$interfaceURL"/>
132  </xsl:call-template>
133 </xsl:variable>
134
135 <xsl:variable name="escaped-thinterfaceURL">
136  <xsl:call-template name="quote">
137   <xsl:with-param name="s" select="$thinterfaceURL"/>
138  </xsl:call-template>
139 </xsl:variable>
140
141 <xsl:variable name="quotedthkeys">
142  <xsl:call-template name="quote">
143   <xsl:with-param name="s" select="'T1,T2,L,E'"/>
144  </xsl:call-template>
145 </xsl:variable>
146
147 <xsl:variable name="quotedekeys">
148  <xsl:call-template name="quote">
149   <xsl:with-param name="s" select="$thkeys"/>
150  </xsl:call-template>
151 </xsl:variable>
152
153 <xsl:variable name="quotedkeys">
154  <xsl:call-template name="quote">
155   <xsl:with-param name="s" select="$keys"/>
156  </xsl:call-template>
157 </xsl:variable>
158
159 <xsl:variable name="quotedquotedkeys">
160  <xsl:call-template name="quote">
161   <xsl:with-param name="s" select="$quotedkeys"/>
162  </xsl:call-template>
163 </xsl:variable>
164
165 <xsl:variable name="quotedquotedthkeys">
166  <xsl:call-template name="quote">
167   <xsl:with-param name="s" select="$quotedthkeys"/>
168  </xsl:call-template>
169 </xsl:variable>
170
171 <xsl:variable name="header0"><xsl:value-of select="$interfaceURL"/>?url=</xsl:variable>
172 <xsl:variable name="thheader0"><xsl:value-of select="$thinterfaceURL"/>?url=</xsl:variable>
173 <xsl:variable name="header1"><xsl:value-of select="$escaped-processorURL"/>apply?keys=</xsl:variable>
174 <xsl:variable name="header2">&#x26;param.naturalLanguage=<xsl:value-of select="$naturalLanguage"/>&#x26;param.annotations=<xsl:value-of select="$annotations"/>&#x26;prop.media-type=<xsl:value-of select="$media-type"/>&#x26;param.media-type=<xsl:value-of select="$media-type"/>&#x26;prop.doctype-public=<xsl:value-of select="$escaped-doctype-public"/>&#x26;param.doctype-public=<xsl:value-of select="$escaped-doctype-public"/>&#x26;prop.encoding=<xsl:value-of select="$encoding"/>&#x26;param.encoding=<xsl:value-of select="$encoding"/>&#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;xmluri=<xsl:value-of select="$absPath"/></xsl:variable>
175 <xsl:variable name="header3">&#x26;param.thkeys=<xsl:value-of select="$quotedekeys"/>&#x26;param.thinterfaceURL=<xsl:value-of select="$escaped-thinterfaceURL"/></xsl:variable>
176
177 <xsl:variable name="quotedheader1">
178  <xsl:call-template name="quote">
179   <xsl:with-param name="s" select="$header1"/>
180  </xsl:call-template>
181 </xsl:variable>
182
183 <xsl:variable name="quotedheader2">
184  <xsl:call-template name="quote">
185   <xsl:with-param name="s" select="$header2"/>
186  </xsl:call-template>
187 </xsl:variable>
188
189 <xsl:variable name="quotedheader3">
190  <xsl:call-template name="quote">
191   <xsl:with-param name="s" select="$header3"/>
192  </xsl:call-template>
193 </xsl:variable>
194
195 <!-- makeURL() maps URIs into URLs               -->
196 <!-- The target of the URL is the whole frameset -->
197
198 <xsl:variable name="biquotedfixedheader">
199  <xsl:value-of select="$header0"/>
200  <xsl:value-of select="$quotedheader1"/>
201  <xsl:value-of select="$quotedquotedkeys"/>
202  <xsl:value-of select="$quotedheader2"/>
203 </xsl:variable>
204
205 <xsl:variable name="biquotedthfixedheader">
206  <xsl:value-of select="$thheader0"/>
207  <xsl:value-of select="$quotedheader1"/>
208  <xsl:value-of select="$quotedquotedthkeys"/>
209  <xsl:value-of select="$quotedheader2"/>
210 </xsl:variable>
211
212 <!-- NOTE: thkeys are propagated, but we are sure (for now!!!) that -->
213 <!-- they won't never be used.                                      -->
214 <!-- type, instead, is not propagated                               -->
215 <xsl:template name="makeURL">
216 <xsl:param name="uri" select="''"/>
217      <xsl:value-of select="$biquotedfixedheader"/>
218      <xsl:value-of select="$uri"/>%26param.CICURI%3D<xsl:value-of select="$uri"/>
219 </xsl:template>
220 <xsl:template name="makeTheoryURL">
221 <xsl:param name="uri" select="''"/>
222      <xsl:value-of select="$biquotedthfixedheader"/>
223      <xsl:value-of select="$uri"/>%26param.CICURI%3D<xsl:value-of select="$uri"/>
224      <xsl:value-of select="$quotedheader3"/>
225 </xsl:template>
226
227 <!-- makeURL4embedding() maps URIs into URLs              -->
228 <!-- The target of the URL is only the processed document -->
229
230 <xsl:template name="makeURL4embedding">
231 <xsl:param name="uri" select="''"/>
232 <xsl:param name="type" select="0"/>
233  <xsl:value-of select="$header1"/>
234  <xsl:value-of select="$quotedekeys"/>
235  <xsl:value-of select="$header2"/>
236  <xsl:value-of select="$uri"/>&#x26;param.CICURI=<xsl:value-of select="$uri"/>&#x26;param.type=<xsl:value-of select="$type"/>
237 </xsl:template>
238
239 </xsl:stylesheet> 
240
241
242