]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/resolve_topurl.xsl
Links in the control frame when the URI ends with .body are now handled
[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:subst="http://www.cs.unibo.it/helm/subst">
5
6 <xsl:import href="links_library.xsl"/>
7 <xsl:import href="params.xsl"/>
8
9 <xsl:output
10            method="html" 
11            encoding="ISO-8859-1" 
12            media-type="text/html" />
13
14 <xsl:param name="proofcheckerURL" select="''"/>
15 <xsl:param name="interfaceURL" select="''"/>
16 <xsl:param name="processorURL" select="''"/>
17 <xsl:param name="getterURL" select="''"/>
18 <xsl:param name="draw_graphURL" select="''"/>
19 <xsl:param name="profile" select="''"/>
20 <xsl:param name="url" select="''"/>
21 <xsl:param name="CICURI" select="''"/>
22 <xsl:param name="annotations" select="''"/>
23
24 <xsl:template match="subst:script">
25  <xsl:copy-of select="document(concat($interfaceURL,@src,'_xml'))" />
26 </xsl:template>
27
28 <xsl:template match="subst:proofcheckerURL">
29  <xsl:value-of select="$proofcheckerURL"/>
30 </xsl:template>
31
32 <xsl:template match="subst:interfaceURL">
33  <xsl:value-of select="$interfaceURL"/>
34 </xsl:template>
35
36 <xsl:template match="subst:processorURL">
37  <xsl:value-of select="$processorURL"/>
38 </xsl:template>
39
40 <xsl:template match="subst:getterURL">
41  <xsl:value-of select="$getterURL"/>
42 </xsl:template>
43
44 <xsl:template match="subst:draw_graphURL">
45  <xsl:value-of select="$draw_graphURL"/>
46 </xsl:template>
47
48 <xsl:template match="subst:profile">
49  <xsl:value-of select="$profile"/>
50 </xsl:template>
51
52 <xsl:template match="subst:url">
53  <xsl:value-of select="$url"/>
54 </xsl:template>
55
56 <xsl:template match="subst:CICURL">
57  <xsl:call-template name="makeCICURL">
58   <xsl:with-param name="uri" select="$CICURI"/>
59  </xsl:call-template>
60 </xsl:template>
61
62 <xsl:template match="subst:HTMLURL">
63  <xsl:call-template name="makeHTMLURL">
64   <xsl:with-param name="uri" select="$CICURI"/>
65  </xsl:call-template>
66 </xsl:template>
67
68 <xsl:template match="subst:MathMLPresentationURL">
69  <xsl:call-template name="makeMathMLPresentationURL">
70   <xsl:with-param name="uri" select="$CICURI"/>
71  </xsl:call-template>
72 </xsl:template>
73
74 <xsl:template match="subst:MathMLContentURL">
75  <xsl:call-template name="makeMathMLContentURL">
76   <xsl:with-param name="uri" select="$CICURI"/>
77  </xsl:call-template>
78 </xsl:template>
79
80 <xsl:template match="subst:DirectRDFURL">
81  <xsl:call-template name="makeDirectRDFURL">
82   <xsl:with-param name="uri" select="$CICURI"/>
83  </xsl:call-template>
84 </xsl:template>
85
86 <xsl:template match="subst:InverseRDFURL">
87  <xsl:call-template name="makeInverseRDFURL">
88   <xsl:with-param name="uri" select="$CICURI"/>
89  </xsl:call-template>
90 </xsl:template>
91
92 <xsl:template match="subst:DCRDFURL">
93  <xsl:call-template name="makeDCRDFURL">
94   <xsl:with-param name="uri" select="$CICURI"/>
95  </xsl:call-template>
96 </xsl:template>
97
98 <xsl:template match="subst:CICURI">
99  <xsl:value-of select="$CICURI"/>
100 </xsl:template>
101
102 <xsl:template match="subst:cleanCICURI">
103  <xsl:variable name="uri" select="$CICURI"/>
104  <xsl:variable name="uri_before_body" select="substring-before($uri,'.body')"/>
105  <xsl:variable name="cleanuri">
106   <xsl:choose>
107    <xsl:when test="$uri_before_body = ''">
108     <xsl:value-of select="$uri"/>
109    </xsl:when>
110    <xsl:otherwise>
111     <xsl:value-of select="$uri_before_body"/>
112    </xsl:otherwise>
113   </xsl:choose>
114  </xsl:variable>
115  <xsl:value-of select="$cleanuri"/>
116 </xsl:template>
117
118 <xsl:template match="subst:base_CICURI">
119   <xsl:variable name="len" select="string-length($CICURI)" />
120   <xsl:variable name="extension">
121     <xsl:choose>
122       <xsl:when test="substring($CICURI,$len)='/'">#</xsl:when>
123       <xsl:when test="substring($CICURI,$len - 6)='.theory'">.theory</xsl:when>
124       <xsl:when test="substring($CICURI,$len - 3)='.con'">.con</xsl:when>
125       <xsl:when test="substring($CICURI,$len - 3)='.ind'">.ind</xsl:when>
126       <xsl:when test="substring($CICURI,$len - 3)='.var'">.var</xsl:when>
127       <xsl:when test="substring($CICURI,$len - 8)='.con.body'">.con.body</xsl:when>
128       <xsl:otherwise>
129 <!--
130         <xsl:message terminate="no">
131           resolve_topurl.xsl: assertion failed
132         </xsl:message>
133 -->
134       </xsl:otherwise>
135     </xsl:choose>
136   </xsl:variable>
137   <xsl:call-template name="name_of_uri">
138     <xsl:with-param name="uri">
139       <xsl:choose>
140         <xsl:when test="substring($CICURI,$len)='/'">
141           <xsl:value-of select="concat(substring($CICURI,1,$len - 1),'#')" />
142         </xsl:when>
143         <xsl:otherwise>
144           <xsl:value-of select="$CICURI" />
145         </xsl:otherwise>
146       </xsl:choose>
147     </xsl:with-param>
148     <xsl:with-param name="extension" select="$extension" />
149   </xsl:call-template>
150 </xsl:template>
151
152 <xsl:template match="subst:annotations">
153  <xsl:value-of select="$annotations"/>
154 </xsl:template>
155
156 <xsl:template match="subst:makeURL">
157  <xsl:call-template name="makeURL">
158   <xsl:with-param name="uri" select="$CICURI"/>
159   <xsl:with-param name="createframeset" select="false()"/>
160  </xsl:call-template>
161 </xsl:template>
162
163 <xsl:template match="subst:makeHTMLURLwithProfile">
164  <xsl:call-template name="makeHTMLURLwithProfile">
165   <xsl:with-param name="uri" select="$CICURI"/>
166   <xsl:with-param name="profile" select="@profile"/>
167  </xsl:call-template>
168 </xsl:template>
169
170 <xsl:template match="subst:makeTheoryURL">
171  <xsl:call-template name="makeTheoryURL">
172   <xsl:with-param name="uri" select="$CICURI"/>
173   <xsl:with-param name="createframeset" select="false()"/>
174  </xsl:call-template>
175 </xsl:template>
176
177 <xsl:template match="subst:makeTheoryURLwithProfile">
178  <xsl:call-template name="makeTheoryURLwithProfile">
179   <xsl:with-param name="uri" select="$CICURI"/>
180   <xsl:with-param name="createframeset" select="true()"/>
181   <xsl:with-param name="profile" select="@profile"/>
182  </xsl:call-template>
183 </xsl:template>
184
185 <xsl:template match="subst:makeDirectDependencyURL">
186   <xsl:call-template name="makeDirectDependenciesURL">
187     <xsl:with-param name="uri" select="$CICURI"/>
188   </xsl:call-template>
189 </xsl:template>
190
191 <xsl:template match="subst:makeRecDependencyURL">
192   <xsl:call-template name="makeGraphURL">
193     <xsl:with-param name="uri" select="$CICURI"/>
194     <xsl:with-param name="keys" select="'MDG'"/>
195     <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
196   </xsl:call-template>
197 </xsl:template>
198
199 <xsl:template match="subst:makeInverseDirectDependencyURL">
200   <xsl:call-template name="makeInverseDirectDependenciesURL">
201     <xsl:with-param name="uri" select="$CICURI"/>
202   </xsl:call-template>
203 </xsl:template>
204
205 <xsl:template match="subst:makeInverseRecDependencyURL">
206   <xsl:call-template name="makeGraphURL">
207     <xsl:with-param name="uri" select="$CICURI"/>
208     <xsl:with-param name="keys" select="'MMG'"/>
209     <xsl:with-param name="uri_set_size" select="$uri_set_size"/>
210   </xsl:call-template>
211 </xsl:template>
212
213 <xsl:template match="/|*">
214  <xsl:copy>
215   <xsl:copy-of select="@*"/>
216   <xsl:apply-templates/>
217  </xsl:copy>
218 </xsl:template>
219
220 </xsl:stylesheet>