]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/resolve_topurl.xsl
- moogle replaces the old search engine
[helm.git] / helm / on-line / xslt / resolve_topurl.xsl
1 <?xml version="1.0"?>
2
3 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4                               xmlns:helm="http://www.cs.unibo.it/helm"
5                               xmlns:subst="http://www.cs.unibo.it/helm/subst">
6
7 <xsl:import href="links_library.xsl"/>
8 <xsl:import href="params.xsl"/>
9
10 <xsl:output
11            method="html" 
12            encoding="ISO-8859-1" 
13            media-type="text/html" />
14
15 <xsl:param name="proofcheckerURL" select="''"/>
16 <xsl:param name="interfaceURL" select="''"/>
17 <xsl:param name="processorURL" select="''"/>
18 <xsl:param name="getterURL" select="''"/>
19 <xsl:param name="draw_graphURL" select="''"/>
20 <xsl:param name="profile" select="''"/>
21 <xsl:param name="url" select="''"/>
22 <xsl:param name="CICURI" select="''"/>
23 <xsl:param name="annotations" select="''"/>
24
25 <xsl:template match="subst:script">
26  <xsl:copy-of select="document(concat($interfaceURL,@src,'_xml'))" />
27 </xsl:template>
28
29 <xsl:template match="subst:proofcheckerURL">
30  <xsl:value-of select="$proofcheckerURL"/>
31 </xsl:template>
32
33 <xsl:template match="subst:interfaceURL">
34  <xsl:value-of select="$interfaceURL"/>
35 </xsl:template>
36
37 <xsl:template match="subst:processorURL">
38  <xsl:value-of select="$processorURL"/>
39 </xsl:template>
40
41 <xsl:template match="subst:getterURL">
42  <xsl:value-of select="$getterURL"/>
43 </xsl:template>
44
45 <xsl:template match="subst:draw_graphURL">
46  <xsl:value-of select="$draw_graphURL"/>
47 </xsl:template>
48
49 <xsl:template match="subst:profile">
50  <xsl:value-of select="$profile"/>
51 </xsl:template>
52
53 <xsl:template match="subst:url">
54  <xsl:value-of select="$url"/>
55 </xsl:template>
56
57 <xsl:template match="subst:CICURL">
58  <xsl:call-template name="makeCICURL">
59   <xsl:with-param name="uri" select="$CICURI"/>
60  </xsl:call-template>
61 </xsl:template>
62
63 <xsl:template match="subst:HTMLURL">
64  <xsl:call-template name="makeHTMLURL">
65   <xsl:with-param name="uri" select="$CICURI"/>
66  </xsl:call-template>
67 </xsl:template>
68
69 <xsl:template match="subst:MathMLPresentationURL">
70  <xsl:call-template name="makeMathMLPresentationURL">
71   <xsl:with-param name="uri" select="$CICURI"/>
72  </xsl:call-template>
73 </xsl:template>
74
75 <xsl:template match="subst:MathMLContentURL">
76  <xsl:call-template name="makeMathMLContentURL">
77   <xsl:with-param name="uri" select="$CICURI"/>
78  </xsl:call-template>
79 </xsl:template>
80
81 <xsl:template match="subst:DirectRDFURL">
82  <xsl:call-template name="makeDirectRDFURL">
83   <xsl:with-param name="uri" select="$CICURI"/>
84  </xsl:call-template>
85 </xsl:template>
86
87 <xsl:template match="subst:InverseRDFURL">
88  <xsl:call-template name="makeInverseRDFURL">
89   <xsl:with-param name="uri" select="$CICURI"/>
90  </xsl:call-template>
91 </xsl:template>
92
93 <xsl:template match="subst:DCRDFURL">
94  <xsl:call-template name="makeDCRDFURL">
95   <xsl:with-param name="uri" select="$CICURI"/>
96  </xsl:call-template>
97 </xsl:template>
98
99 <xsl:template match="subst:CICURI">
100  <xsl:value-of select="$CICURI"/>
101 </xsl:template>
102
103 <xsl:template match="subst:cleanCICURI">
104  <xsl:variable name="uri" select="$CICURI"/>
105  <xsl:variable name="uri_before_body" select="substring-before($uri,'.body')"/>
106  <xsl:variable name="cleanuri">
107   <xsl:choose>
108    <xsl:when test="$uri_before_body = ''">
109     <xsl:value-of select="$uri"/>
110    </xsl:when>
111    <xsl:otherwise>
112     <xsl:value-of select="$uri_before_body"/>
113    </xsl:otherwise>
114   </xsl:choose>
115  </xsl:variable>
116  <xsl:value-of select="$cleanuri"/>
117 </xsl:template>
118
119 <xsl:template match="subst:base_CICURI">
120   <xsl:variable name="len" select="string-length($CICURI)" />
121   <xsl:variable name="extension">
122     <xsl:choose>
123       <xsl:when test="substring($CICURI,$len)='/'">#</xsl:when>
124       <xsl:when test="substring($CICURI,$len - 6)='.theory'">.theory</xsl:when>
125       <xsl:when test="substring($CICURI,$len - 3)='.con'">.con</xsl:when>
126       <xsl:when test="substring($CICURI,$len - 3)='.ind'">.ind</xsl:when>
127       <xsl:when test="substring($CICURI,$len - 3)='.var'">.var</xsl:when>
128       <xsl:when test="substring($CICURI,$len - 8)='.con.body'">.con.body</xsl:when>
129       <xsl:otherwise>
130 <!--
131         <xsl:message terminate="no">
132           resolve_topurl.xsl: assertion failed
133         </xsl:message>
134 -->
135       </xsl:otherwise>
136     </xsl:choose>
137   </xsl:variable>
138   <xsl:call-template name="name_of_uri">
139     <xsl:with-param name="uri">
140       <xsl:choose>
141         <xsl:when test="substring($CICURI,$len)='/'">
142           <xsl:value-of select="concat(substring($CICURI,1,$len - 1),'#')" />
143         </xsl:when>
144         <xsl:otherwise>
145           <xsl:value-of select="$CICURI" />
146         </xsl:otherwise>
147       </xsl:choose>
148     </xsl:with-param>
149     <xsl:with-param name="extension" select="$extension" />
150   </xsl:call-template>
151 </xsl:template>
152
153 <xsl:template match="subst:annotations">
154  <xsl:value-of select="$annotations"/>
155 </xsl:template>
156
157 <xsl:template match="subst:makeURL">
158  <xsl:call-template name="makeURL">
159   <xsl:with-param name="uri" select="$CICURI"/>
160   <xsl:with-param name="createframeset" select="false()"/>
161  </xsl:call-template>
162 </xsl:template>
163
164 <xsl:template match="subst:makeProofTreeURL">
165  <xsl:call-template name="makeProofTreeURL">
166   <xsl:with-param name="uri" select="$CICURI"/>
167   <xsl:with-param name="createframeset" select="false()"/>
168  </xsl:call-template>
169 </xsl:template>
170
171 <xsl:template match="subst:makeHTMLURLwithProfile">
172  <xsl:call-template name="makeHTMLURLwithProfile">
173   <xsl:with-param name="uri" select="$CICURI"/>
174   <xsl:with-param name="profile" select="@profile"/>
175  </xsl:call-template>
176 </xsl:template>
177
178 <xsl:template match="subst:makeTheoryURL">
179  <xsl:call-template name="makeTheoryURL">
180   <xsl:with-param name="uri" select="$CICURI"/>
181   <xsl:with-param name="createframeset" select="false()"/>
182  </xsl:call-template>
183 </xsl:template>
184
185 <xsl:template match="subst:makeTheoryURLwithProfile">
186  <xsl:call-template name="makeTheoryURLwithProfile">
187   <xsl:with-param name="uri" select="$CICURI"/>
188   <xsl:with-param name="createframeset" select="true()"/>
189   <xsl:with-param name="profile" select="@profile"/>
190  </xsl:call-template>
191 </xsl:template>
192
193 <xsl:template match="subst:makeDirectDependencyURL">
194   <xsl:call-template name="makeDirectDependenciesURL">
195     <xsl:with-param name="uri" select="$CICURI"/>
196   </xsl:call-template>
197 </xsl:template>
198
199 <xsl:template match="subst:makeRecDependencyURL">
200   <xsl:call-template name="makeGraphURL">
201     <xsl:with-param name="uri" select="$CICURI"/>
202     <xsl:with-param name="keys" select="'MDG'"/>
203     <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
204   </xsl:call-template>
205 </xsl:template>
206
207 <xsl:template match="subst:makeInverseDirectDependencyURL">
208   <xsl:call-template name="makeInverseDirectDependenciesURL">
209     <xsl:with-param name="uri" select="$CICURI"/>
210   </xsl:call-template>
211 </xsl:template>
212
213 <xsl:template match="subst:makeInverseRecDependencyURL">
214   <xsl:call-template name="makeGraphURL">
215     <xsl:with-param name="uri" select="$CICURI"/>
216     <xsl:with-param name="keys" select="'MMG'"/>
217     <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
218   </xsl:call-template>
219 </xsl:template>
220
221 <!-- used by moogle -->
222
223 <xsl:template match="helm:uwobo_form">
224  <form action="{concat($processorURL,'apply?')}" method="get">
225   <xsl:apply-templates select="*"/>
226  </form>
227 </xsl:template>
228
229 <xsl:template match = "helm:hidden_params">
230  <xsl:call-template name="hidden_params"/>
231 </xsl:template>
232
233 <xsl:template match = "helm:j_params">
234  <xsl:call-template name="j_params"/>
235 </xsl:template>
236
237 <xsl:template name="hidden_params">
238  <input type="hidden" name="xmluri" value="{concat($getterURL,'getempty')}"/>
239  <input type="hidden" name="param.profile" value="{$profile}"/>
240  <input type="hidden" name="profile" value="{$profile}"/>
241  <input type="hidden" name="param.keys" value="{$keys}"/>
242  <input type="hidden" name="param.embedkeys" value="{$embedkeys}"/>
243  <input type="hidden" name="param.thkeys" value="{$thkeys}"/>
244  <input type="hidden" name="param.prooftreekeys" value="{$prooftreekeys}"/>
245
246  <input type="hidden" name="param.media-type" value="{$media-type}"/>
247  <input type="hidden" name="param.thmedia-type" select="{$thmedia-type}"/>
248  <input type="hidden" name="prooftreemedia-type" select="{$prooftreemedia-type}"/>
249  <input type="hidden" name="param.doctype-public" select="{$doctype-public}"/>
250  <input type="hidden" name="param.encoding" select="{$encoding}"/>
251  <input type="hidden" name="param.thencoding" select="{$thencoding}"/>
252  <input type="hidden" name="param.prooftreeencoding" select="{$prooftreeencoding}"/>
253 </xsl:template>
254
255 <xsl:template name="j_params">
256  <input type="hidden" name="j_xmluri" value="{concat($getterURL,'getempty')}"/>
257  <input type="hidden" name="j_processorURL" value="{$processorURL}"/> 
258  <input type="hidden" name="j_profile" value="{$profile}"/>
259  <input type="hidden" name="j_keys" value="{$keys}"/>
260  <input type="hidden" name="j_embedkeys" value="{$embedkeys}"/>
261  <input type="hidden" name="j_thkeys" value="{$thkeys}"/>
262  <input type="hidden" name="j_prooftreekeys" value="{$prooftreekeys}"/>
263
264  <input type="hidden" name="j_media_type" value="{$media-type}"/>
265  <input type="hidden" name="j_thmedia_type" select="{$thmedia-type}"/>
266  <input type="hidden" name="j_prooftreemedia_type" select="{$prooftreemedia-type}"/>
267  <input type="hidden" name="j_doctype_public" select="{$doctype-public}"/>
268  <input type="hidden" name="j_encoding" select="{$encoding}"/>
269  <input type="hidden" name="j_thencoding" select="{$thencoding}"/>
270  <input type="hidden" name="j_prooftreeencoding" select="{$prooftreeencoding}"/>
271 </xsl:template>
272
273 <xsl:template match="/|*">
274  <xsl:copy>
275   <xsl:copy-of select="@*"/>
276   <xsl:apply-templates/>
277  </xsl:copy>
278 </xsl:template>
279
280 </xsl:stylesheet>