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