]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/xslt/resolve_topurl.xsl
###############################################################
[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:CICURI">
57  <xsl:value-of select="$CICURI"/>
58 </xsl:template>
59
60 <xsl:template match="subst:base_CICURI">
61   <xsl:variable name="len" select="string-length($CICURI)" />
62   <xsl:variable name="extension">
63     <xsl:choose>
64       <xsl:when test="substring($CICURI,$len)='/'">#</xsl:when>
65       <xsl:when test="substring($CICURI,$len - 6)='.theory'">.theory</xsl:when>
66       <xsl:when test="substring($CICURI,$len - 3)='.con'">.con</xsl:when>
67       <xsl:when test="substring($CICURI,$len - 3)='.ind'">.ind</xsl:when>
68       <xsl:when test="substring($CICURI,$len - 3)='.var'">.var</xsl:when>
69       <xsl:when test="substring($CICURI,$len - 8)='.con.body'">.con.body</xsl:when>
70       <xsl:otherwise>
71 <!--
72         <xsl:message terminate="no">
73           resolve_topurl.xsl: assertion failed
74         </xsl:message>
75 -->
76       </xsl:otherwise>
77     </xsl:choose>
78   </xsl:variable>
79   <xsl:call-template name="name_of_uri">
80     <xsl:with-param name="uri">
81       <xsl:choose>
82         <xsl:when test="substring($CICURI,$len)='/'">
83           <xsl:value-of select="concat(substring($CICURI,1,$len - 1),'#')" />
84         </xsl:when>
85         <xsl:otherwise>
86           <xsl:value-of select="$CICURI" />
87         </xsl:otherwise>
88       </xsl:choose>
89     </xsl:with-param>
90     <xsl:with-param name="extension" select="$extension" />
91   </xsl:call-template>
92 </xsl:template>
93
94 <xsl:template match="subst:annotations">
95  <xsl:value-of select="$annotations"/>
96 </xsl:template>
97
98 <xsl:template match="subst:makeURL">
99  <xsl:call-template name="makeURL">
100   <xsl:with-param name="uri" select="$CICURI"/>
101   <xsl:with-param name="createframeset" select="false()"/>
102  </xsl:call-template>
103 </xsl:template>
104
105 <xsl:template match="subst:makeTheoryURL">
106  <xsl:call-template name="makeTheoryURL">
107   <xsl:with-param name="uri" select="$CICURI"/>
108   <xsl:with-param name="createframeset" select="false()"/>
109  </xsl:call-template>
110 </xsl:template>
111
112 <xsl:template match="/|*">
113  <xsl:copy>
114   <xsl:copy-of select="@*"/>
115   <xsl:apply-templates/>
116  </xsl:copy>
117 </xsl:template>
118
119 </xsl:stylesheet>