3 <!-- Copyright (C) 2000, HELM Team -->
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. -->
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. -->
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. -->
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. -->
24 <!-- For details, see the HELM World-Wide-Web page, -->
25 <!-- http://cs.unibo.it/helm/. -->
27 <!--******************************************************************-->
28 <!-- XSLT version 0.1 of CIC objects to MathML content: -->
29 <!-- First draft: February 14 2000, Andrea Asperti, Irene Schena -->
30 <!-- Revised: March 3 2000, Irene Schena -->
31 <!-- Revised: March 10 2000, Irene Schena -->
32 <!-- Revised: March 15 2000, Claudio Sacerdoti Coen, Irene Schena -->
33 <!--******************************************************************-->
35 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
36 xmlns:m="http://www.w3.org/1998/Math/MathML"
37 xmlns:helm="http://www.cs.unibo.it/helm">
39 <xsl:include href="params.xsl"/>
40 <!-- adesso sono preprocessate -->
41 <!-- <xsl:include href="coercions.xsl"/> -->
47 omit-xml-declaration="no"
49 doctype-public="http://www.w3.org/TR/REC-MathML"
51 media-type="text/mathml" /> -->
54 1)risolvere nella fase di pre-processing le uri relative delle var, settando
56 definitionURL dell'oggetto corrispondente (alcuni punteranno a nulla! -quelli
57 che non hanno il file di definizione corrispondente-); [le uri assolute hanno
58 la forma cic:/.../ in definitionURL e questo schema di uri verra' risolto da
59 Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
66 <xsl:template match="LAMBDA" mode="pure">
67 <xsl:apply-templates select="*[1]" mode="lambda"/>
70 <xsl:template match="decl" mode="lambda">
71 <m:lambda helm:xref="{@id}">
74 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
77 <xsl:apply-templates select="*[1]" mode="noannot"/>
80 <xsl:apply-templates select="following-sibling::*[1]" mode="lambda"/>
85 <xsl:template match="target" mode="lambda">
86 <xsl:apply-templates select="*[1]" mode="noannot"/>
90 <xsl:template match="LETIN" mode="pure">
91 <xsl:apply-templates select="*[1]" mode="letin"/>
95 <xsl:template match="def" mode="letin">
96 <m:apply helm:xref="{@id}">
97 <m:csymbol>let_in</m:csymbol>
100 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
103 <xsl:apply-templates select="*[1]" mode="noannot"/>
104 <xsl:apply-templates select="following-sibling::*[1]" mode="letin"/>
109 <xsl:template match="target" mode="letin">
110 <xsl:apply-templates select="*[1]" mode="noannot"/>
114 <xsl:template match="PROD" mode="pure">
115 <xsl:apply-templates select="*[1]" mode="prod"/>
119 <xsl:template match="decl" mode="prod">
120 <m:apply helm:xref="{@id}">
122 <xsl:when test="string(@binder)= """>
123 <m:csymbol>arrow</m:csymbol>
124 <xsl:apply-templates select="*[1]" mode="noannot"/>
128 <xsl:when test="../@type = 'Prop'">
129 <m:csymbol>forall</m:csymbol>
132 <m:csymbol>prod</m:csymbol>
137 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
140 <xsl:apply-templates select="*[1]" mode="noannot"/>
145 <xsl:apply-templates select="following-sibling::*[1]" mode="prod"/>
150 <xsl:template match="target" mode="prod">
151 <xsl:apply-templates select="*[1]" mode="noannot"/>
155 <xsl:template match="CAST" mode="pure">
156 <m:apply helm:xref="{@id}">
157 <m:csymbol>cast</m:csymbol>
158 <xsl:apply-templates mode="noannot" select="*/*"/>
163 <xsl:template match="REL" mode="pure">
164 <m:ci helm:xref="{@id}">
165 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
170 <xsl:template match="SORT" mode="pure">
171 <m:apply helm:xref="{@id}">
173 <xsl:value-of select="@value"/>
179 <xsl:template match="APPLY" mode="pure">
180 <m:apply helm:xref="{@id}">
181 <m:csymbol>app</m:csymbol>
182 <xsl:apply-templates mode="noannot" select="*"/>
187 <!-- Gestione senza pre-processing -->
189 <xsl:template match="APPLY" mode="pure">
190 <xsl:apply-templates mode="coercion" select="."/>
193 <xsl:template match="APPLY" mode="no_coercion">
194 <m:apply helm:xref="{@id}">
195 <m:csymbol>app</m:csymbol>
196 <xsl:apply-templates mode="noannot" select="*"/>
201 <xsl:template match="VAR" mode="pure">
202 <m:ci helm:xref="{@id}">
203 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:call-template name="name_of_uri_bis">
204 <xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:with-param></xsl:call-template>
209 <xsl:template match="META" mode="pure">
210 <m:apply helm:xref="{@id}">
211 <m:csymbol>meta</m:csymbol>
213 <xsl:call-template name="insert_subscript">
214 <xsl:with-param name="node_value">
215 <xsl:text>?</xsl:text>
216 <xsl:value-of select="@no"/>
220 <xsl:for-each select="substitution">
222 <xsl:when test="*[1]">
223 <xsl:apply-templates select="*[1]" mode="noannot"/>
234 <xsl:template match="CONST" mode="pure">
235 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
236 <xsl:call-template name="insert_subscript">
237 <xsl:with-param name="node_value">
238 <xsl:call-template name="name_of_uri">
239 <xsl:with-param name="uri" select="@uri"/>
247 <xsl:template match="MUTIND" mode="pure">
248 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
249 <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:variable>
250 <xsl:variable name="index"><xsl:value-of select="@noType"/></xsl:variable>
251 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document($InductiveTypeUrl)/InductiveDefinition/InductiveType[position()=number($index)+1]/@name"/></xsl:with-param></xsl:call-template>
256 <xsl:template match="MUTCONSTRUCT" mode="pure">
257 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
258 <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:variable>
259 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
260 <xsl:variable name="Cindex"><xsl:value-of select="@noConstr"/></xsl:variable>
261 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document($InductiveTypeUrl)/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($Cindex)]/@name"/></xsl:with-param></xsl:call-template>
266 <xsl:template match="MUTCASE" mode="pure">
267 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
268 <xsl:variable name="Turi"><xsl:value-of select="@uriType"/></xsl:variable>
269 <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="$Turi"/></xsl:call-template></xsl:variable>
270 <xsl:variable name="InductiveTypeDoc" select="document($InductiveTypeUrl)"/>
271 <m:apply helm:xref="{@id}">
272 <m:csymbol>mutcase</m:csymbol>
273 <xsl:apply-templates select="patternsType/*[1]" mode="noannot"/>
274 <xsl:apply-templates select="inductiveTerm/*[1]" mode="noannot"/>
275 <xsl:variable name="nop"><xsl:value-of select="$InductiveTypeDoc/InductiveDefinition/@noParams"/></xsl:variable>
277 <xsl:for-each select="pattern">
278 <xsl:variable name="pos" select="position()"/>
279 <xsl:variable name="nopar"><xsl:apply-templates select="$InductiveTypeDoc/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/*[1]" mode="counting"><xsl:with-param name="noparams" select="$nop"/></xsl:apply-templates></xsl:variable>
281 <xsl:apply-templates select="./*[1]" mode="abstparams"><xsl:with-param name="noparams" select="$nopar"/><xsl:with-param name="target" select="1"/><xsl:with-param name="binder">LAMBDA</xsl:with-param></xsl:apply-templates>
283 <xsl:when test="$nopar = 0">
285 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="$InductiveTypeDoc/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/></xsl:with-param></xsl:call-template>
290 <m:csymbol>app</m:csymbol>
292 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="$InductiveTypeDoc/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/></xsl:with-param></xsl:call-template>
294 <xsl:apply-templates select="./*[1]" mode="abstparams"><xsl:with-param name="noparams" select="$nopar"/><xsl:with-param name="binder">LAMBDA</xsl:with-param></xsl:apply-templates>
305 <xsl:template match="FIX" mode="pure">
306 <m:apply helm:xref="{@id}">
307 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
308 <m:csymbol>fix</m:csymbol>
309 <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="FixFunction[position()=number($findex)+1]/@name"/></xsl:with-param></xsl:call-template></m:ci>
310 <xsl:apply-templates mode="pure" select="*"/>
315 <xsl:template match="COFIX" mode="pure">
316 <m:apply helm:xref="{@id}">
317 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
318 <m:csymbol>cofix</m:csymbol>
319 <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="CofixFunction[position()=number($findex)+1]/@name"/></xsl:with-param></xsl:call-template></m:ci>
320 <xsl:apply-templates mode="pure" select="*"/>
324 <xsl:template match="instantiate" mode="pure">
325 <m:apply helm:xref="{@id}">
326 <m:csymbol>inst</m:csymbol>
327 <xsl:apply-templates mode="noannot" select="*[1]" />
328 <xsl:for-each select="arg">
329 <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:call-template name="name_of_uri"><xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:with-param></xsl:call-template></m:ci>
330 <xsl:apply-templates mode ="noannot" select="*[1]" />
335 <!-- ELEMENTS OF CIC TERMS -->
337 <xsl:template match="FixFunction" mode="pure">
339 <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template></m:ci>
340 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
342 <xsl:apply-templates select="body/*[1]" mode="noannot"/>
346 <xsl:template match="CofixFunction" mode="pure">
348 <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template></m:ci>
349 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
351 <xsl:apply-templates select="body/*[1]" mode="noannot"/>