]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/resolve_topurl.xsl
ocaml 3.09 transition
[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:choose>
107   <xsl:when test="$uri_before_body = ''">
108    <xsl:variable name="uri_before_sharp" select="substring-before($uri,'#')"/>
109    <xsl:choose>
110     <xsl:when test="$uri_before_sharp = ''">
111      <xsl:value-of select="$uri"/>
112     </xsl:when>
113     <xsl:otherwise>
114      <xsl:value-of select="$uri_before_sharp"/>
115     </xsl:otherwise>
116    </xsl:choose>
117   </xsl:when>
118   <xsl:otherwise>
119    <xsl:value-of select="$uri_before_body"/>
120   </xsl:otherwise>
121  </xsl:choose>
122 </xsl:template>
123
124 <xsl:template match="subst:base_CICURI">
125   <xsl:variable name="len" select="string-length($CICURI)" />
126   <xsl:variable name="extension">
127     <xsl:choose>
128       <xsl:when test="substring($CICURI,$len)='/'">#</xsl:when>
129       <xsl:when test="substring($CICURI,$len - 6)='.theory'">.theory</xsl:when>
130       <xsl:when test="substring($CICURI,$len - 3)='.con'">.con</xsl:when>
131       <xsl:when test="substring($CICURI,$len - 3)='.ind'">.ind</xsl:when>
132       <xsl:when test="substring($CICURI,$len - 3)='.var'">.var</xsl:when>
133       <xsl:when test="substring($CICURI,$len - 8)='.con.body'">.con.body</xsl:when>
134       <xsl:otherwise>
135 <!--
136         <xsl:message terminate="no">
137           resolve_topurl.xsl: assertion failed
138         </xsl:message>
139 -->
140       </xsl:otherwise>
141     </xsl:choose>
142   </xsl:variable>
143   <xsl:call-template name="name_of_uri">
144     <xsl:with-param name="uri">
145       <xsl:choose>
146         <xsl:when test="substring($CICURI,$len)='/'">
147           <xsl:value-of select="concat(substring($CICURI,1,$len - 1),'#')" />
148         </xsl:when>
149         <xsl:otherwise>
150           <xsl:value-of select="$CICURI" />
151         </xsl:otherwise>
152       </xsl:choose>
153     </xsl:with-param>
154     <xsl:with-param name="extension" select="$extension" />
155   </xsl:call-template>
156 </xsl:template>
157
158 <xsl:template match="subst:annotations">
159  <xsl:value-of select="$annotations"/>
160 </xsl:template>
161
162 <xsl:template match="subst:makeURL">
163  <xsl:call-template name="makeURL">
164   <xsl:with-param name="uri" select="$CICURI"/>
165   <xsl:with-param name="createframeset" select="false()"/>
166  </xsl:call-template>
167 </xsl:template>
168
169 <xsl:template match="subst:makeProofTreeURL">
170  <xsl:call-template name="makeProofTreeURL">
171   <xsl:with-param name="uri" select="$CICURI"/>
172   <xsl:with-param name="createframeset" select="false()"/>
173  </xsl:call-template>
174 </xsl:template>
175
176 <xsl:template match="subst:makeHTMLURLwithProfile">
177  <xsl:call-template name="makeHTMLURLwithProfile">
178   <xsl:with-param name="uri" select="$CICURI"/>
179   <xsl:with-param name="profile" select="@profile"/>
180  </xsl:call-template>
181 </xsl:template>
182
183 <xsl:template match="subst:makeTheoryURL">
184  <xsl:call-template name="makeTheoryURL">
185   <xsl:with-param name="uri" select="$CICURI"/>
186   <xsl:with-param name="createframeset" select="false()"/>
187  </xsl:call-template>
188 </xsl:template>
189
190 <xsl:template match="subst:makeTheoryURLwithProfile">
191  <xsl:call-template name="makeTheoryURLwithProfile">
192   <xsl:with-param name="uri" select="$CICURI"/>
193   <xsl:with-param name="createframeset" select="true()"/>
194   <xsl:with-param name="profile" select="@profile"/>
195  </xsl:call-template>
196 </xsl:template>
197
198 <xsl:template match="subst:makeDirectDependencyURL">
199   <xsl:call-template name="makeDirectDependenciesURL">
200     <xsl:with-param name="uri" select="$CICURI"/>
201   </xsl:call-template>
202 </xsl:template>
203
204 <xsl:template match="subst:makeRecDependencyURL">
205   <xsl:call-template name="makeGraphURL">
206     <xsl:with-param name="uri" select="$CICURI"/>
207     <xsl:with-param name="keys" select="'MDG'"/>
208     <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
209   </xsl:call-template>
210 </xsl:template>
211
212 <xsl:template match="subst:makeInverseDirectDependencyURL">
213   <xsl:call-template name="makeInverseDirectDependenciesURL">
214     <xsl:with-param name="uri" select="$CICURI"/>
215   </xsl:call-template>
216 </xsl:template>
217
218 <xsl:template match="subst:makeInverseRecDependencyURL">
219   <xsl:call-template name="makeGraphURL">
220     <xsl:with-param name="uri" select="$CICURI"/>
221     <xsl:with-param name="keys" select="'MMG'"/>
222     <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
223   </xsl:call-template>
224 </xsl:template>
225
226 <!-- used by moogle -->
227
228 <xsl:template match="helm:uwobo_form">
229  <form action="{concat($processorURL,'apply?')}" method="get">
230   <xsl:apply-templates select="*"/>
231  </form>
232 </xsl:template>
233
234 <xsl:template match = "helm:hidden_params">
235  <xsl:call-template name="hidden_params"/>
236 </xsl:template>
237
238 <xsl:template match = "helm:j_params">
239  <xsl:call-template name="j_params"/>
240 </xsl:template>
241
242 <xsl:template name="hidden_params">
243  <input type="hidden" name="xmluri" value="{concat($getterURL,'getempty')}"/>
244  <input type="hidden" name="param.profile" value="{$profile}"/>
245  <input type="hidden" name="profile" value="{$profile}"/>
246  <input type="hidden" name="param.keys" value="{$keys}"/>
247  <input type="hidden" name="param.embedkeys" value="{$embedkeys}"/>
248  <input type="hidden" name="param.thkeys" value="{$thkeys}"/>
249  <input type="hidden" name="param.prooftreekeys" value="{$prooftreekeys}"/>
250
251  <input type="hidden" name="param.media-type" value="{$media-type}"/>
252  <input type="hidden" name="param.thmedia-type" select="{$thmedia-type}"/>
253  <input type="hidden" name="prooftreemedia-type" select="{$prooftreemedia-type}"/>
254  <input type="hidden" name="param.doctype-public" select="{$doctype-public}"/>
255  <input type="hidden" name="param.encoding" select="{$encoding}"/>
256  <input type="hidden" name="param.thencoding" select="{$thencoding}"/>
257  <input type="hidden" name="param.prooftreeencoding" select="{$prooftreeencoding}"/>
258 </xsl:template>
259
260 <xsl:template name="j_params">
261  <input type="hidden" name="j_xmluri" value="{concat($getterURL,'getempty')}"/>
262  <input type="hidden" name="j_processorURL" value="{$processorURL}"/> 
263  <input type="hidden" name="j_profile" value="{$profile}"/>
264  <input type="hidden" name="j_keys" value="{$keys}"/>
265  <input type="hidden" name="j_embedkeys" value="{$embedkeys}"/>
266  <input type="hidden" name="j_thkeys" value="{$thkeys}"/>
267  <input type="hidden" name="j_prooftreekeys" value="{$prooftreekeys}"/>
268
269  <input type="hidden" name="j_media_type" value="{$media-type}"/>
270  <input type="hidden" name="j_thmedia_type" select="{$thmedia-type}"/>
271  <input type="hidden" name="j_prooftreemedia_type" select="{$prooftreemedia-type}"/>
272  <input type="hidden" name="j_doctype_public" select="{$doctype-public}"/>
273  <input type="hidden" name="j_encoding" select="{$encoding}"/>
274  <input type="hidden" name="j_thencoding" select="{$thencoding}"/>
275  <input type="hidden" name="j_prooftreeencoding" select="{$prooftreeencoding}"/>
276 </xsl:template>
277
278 <xsl:template match="/|*">
279  <xsl:copy>
280   <xsl:copy-of select="@*"/>
281   <xsl:apply-templates/>
282  </xsl:copy>
283 </xsl:template>
284
285 </xsl:stylesheet>