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_pure"/>
94 <!-- Andrea: mode letin already exists in proofs.xsl, with a
97 <xsl:template match="def" mode="letin_pure">
98 <m:apply helm:xref="{@id}">
99 <m:csymbol>let_in</m:csymbol>
102 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
105 <xsl:apply-templates select="*[1]" mode="noannot"/>
106 <xsl:apply-templates select="following-sibling::*[1]" mode="letin_pure"/>
111 <xsl:template match="target" mode="letin_pure">
112 <xsl:apply-templates select="*[1]" mode="noannot"/>
116 <xsl:template match="PROD" mode="pure">
117 <xsl:apply-templates select="*[1]" mode="prod"/>
121 <xsl:template match="decl" mode="prod">
122 <m:apply helm:xref="{@id}">
124 <xsl:when test="string(@binder)= """>
125 <m:csymbol>arrow</m:csymbol>
126 <xsl:apply-templates select="*[1]" mode="noannot"/>
130 <xsl:when test="../@type = 'Prop'">
131 <m:csymbol>forall</m:csymbol>
134 <m:csymbol>prod</m:csymbol>
139 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
142 <xsl:apply-templates select="*[1]" mode="noannot"/>
147 <xsl:apply-templates select="following-sibling::*[1]" mode="prod"/>
152 <xsl:template match="target" mode="prod">
153 <xsl:apply-templates select="*[1]" mode="noannot"/>
157 <xsl:template match="CAST" mode="pure">
158 <m:apply helm:xref="{@id}">
159 <m:csymbol>cast</m:csymbol>
160 <xsl:apply-templates mode="noannot" select="*/*"/>
165 <xsl:template match="REL" mode="pure">
166 <m:ci helm:xref="{@id}">
167 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
172 <xsl:template match="SORT" mode="pure">
173 <m:apply helm:xref="{@id}">
175 <xsl:value-of select="@value"/>
181 <xsl:template match="APPLY" mode="pure">
182 <m:apply helm:xref="{@id}">
183 <m:csymbol>app</m:csymbol>
184 <xsl:apply-templates mode="noannot" select="*"/>
189 <!-- Gestione senza pre-processing -->
191 <xsl:template match="APPLY" mode="pure">
192 <xsl:apply-templates mode="coercion" select="."/>
195 <xsl:template match="APPLY" mode="no_coercion">
196 <m:apply helm:xref="{@id}">
197 <m:csymbol>app</m:csymbol>
198 <xsl:apply-templates mode="noannot" select="*"/>
203 <xsl:template match="VAR" mode="pure">
204 <m:ci helm:xref="{@id}">
205 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:call-template name="name_of_uri_bis">
206 <xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:with-param></xsl:call-template>
211 <xsl:template match="META" mode="pure">
212 <m:apply helm:xref="{@id}">
213 <m:csymbol>meta</m:csymbol>
215 <xsl:call-template name="insert_subscript">
216 <xsl:with-param name="node_value">
217 <xsl:text>?</xsl:text>
218 <xsl:value-of select="@no"/>
222 <xsl:for-each select="substitution">
224 <xsl:when test="*[1]">
225 <xsl:apply-templates select="*[1]" mode="noannot"/>
236 <xsl:template match="CONST" mode="pure">
237 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
238 <xsl:call-template name="insert_subscript">
239 <xsl:with-param name="node_value">
240 <xsl:call-template name="name_of_uri">
241 <xsl:with-param name="uri" select="@uri"/>
249 <xsl:template match="MUTIND" mode="pure">
250 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
251 <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:variable>
252 <xsl:variable name="index"><xsl:value-of select="@noType"/></xsl:variable>
253 <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>
258 <xsl:template match="MUTCONSTRUCT" mode="pure">
259 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
260 <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:variable>
261 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
262 <xsl:variable name="Cindex"><xsl:value-of select="@noConstr"/></xsl:variable>
263 <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>
268 <xsl:template match="MUTCASE" mode="pure">
269 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
270 <xsl:variable name="Turi"><xsl:value-of select="@uriType"/></xsl:variable>
271 <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="$Turi"/></xsl:call-template></xsl:variable>
272 <xsl:variable name="InductiveTypeDoc" select="document($InductiveTypeUrl)"/>
273 <m:apply helm:xref="{@id}">
274 <m:csymbol>mutcase</m:csymbol>
275 <xsl:apply-templates select="patternsType/*[1]" mode="noannot"/>
276 <xsl:apply-templates select="inductiveTerm/*[1]" mode="noannot"/>
277 <xsl:variable name="nop"><xsl:value-of select="$InductiveTypeDoc/InductiveDefinition/@noParams"/></xsl:variable>
279 <xsl:for-each select="pattern">
280 <xsl:variable name="pos" select="position()"/>
281 <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>
283 <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>
285 <xsl:when test="$nopar = 0">
287 <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>
292 <m:csymbol>app</m:csymbol>
294 <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>
296 <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>
307 <xsl:template match="FIX" mode="pure">
308 <m:apply helm:xref="{@id}">
309 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
310 <m:csymbol>fix</m:csymbol>
311 <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>
312 <xsl:apply-templates mode="pure" select="*"/>
317 <xsl:template match="COFIX" mode="pure">
318 <m:apply helm:xref="{@id}">
319 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
320 <m:csymbol>cofix</m:csymbol>
321 <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>
322 <xsl:apply-templates mode="pure" select="*"/>
326 <xsl:template match="instantiate" mode="pure">
327 <m:apply helm:xref="{@id}">
328 <m:csymbol>inst</m:csymbol>
329 <xsl:apply-templates mode="noannot" select="*[1]" />
330 <xsl:for-each select="arg">
331 <xsl:variable name="base_path">
332 <xsl:call-template name="path">
333 <xsl:with-param name="uri" select="../*[1]/@uri"/>
336 <xsl:variable name="varUri" select="concat($base_path,@relUri)"/>
337 <m:ci definitionURL="{$varUri}">
338 <xsl:call-template name="insert_subscript">
339 <xsl:with-param name="node_value">
340 <xsl:call-template name="name_of_uri">
341 <xsl:with-param name="uri" select="$varUri"/>
342 <xsl:with-param name="extension" select="'.var'"/>
347 <xsl:apply-templates mode ="noannot" select="*[1]" />
352 <!-- ELEMENTS OF CIC TERMS -->
354 <xsl:template match="FixFunction" mode="pure">
356 <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>
357 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
359 <xsl:apply-templates select="body/*[1]" mode="noannot"/>
363 <xsl:template match="CofixFunction" mode="pure">
365 <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>
366 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
368 <xsl:apply-templates select="body/*[1]" mode="noannot"/>