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 <xsl:include href="ite.xsl"/>
41 <!-- adesso sono preprocessate -->
42 <!-- <xsl:include href="coercions.xsl"/> -->
48 omit-xml-declaration="no"
50 doctype-public="http://www.w3.org/TR/REC-MathML"
52 media-type="text/mathml" /> -->
55 1)risolvere nella fase di pre-processing le uri relative delle var, settando
57 definitionURL dell'oggetto corrispondente (alcuni punteranno a nulla! -quelli
58 che non hanno il file di definizione corrispondente-); [le uri assolute hanno
59 la forma cic:/.../ in definitionURL e questo schema di uri verra' risolto da
60 Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
67 <xsl:template match="LAMBDA" mode="pure">
68 <xsl:apply-templates select="*[1]" mode="lambda"/>
71 <xsl:template match="decl" mode="lambda">
72 <m:lambda helm:xref="{@id}">
75 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
78 <xsl:apply-templates select="*[1]" mode="noannot"/>
81 <xsl:apply-templates select="following-sibling::*[1]" mode="lambda"/>
86 <xsl:template match="target" mode="lambda">
87 <xsl:apply-templates select="*[1]" mode="noannot"/>
91 <xsl:template match="LETIN" mode="pure">
92 <xsl:apply-templates select="*[1]" mode="letin_pure"/>
95 <!-- Andrea: mode letin already exists in proofs.xsl, with a
98 <xsl:template match="def" mode="letin_pure">
99 <m:apply helm:xref="{@id}">
100 <m:csymbol>let_in</m:csymbol>
103 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
106 <xsl:apply-templates select="*[1]" mode="noannot"/>
107 <xsl:apply-templates select="following-sibling::*[1]" mode="letin_pure"/>
112 <xsl:template match="target" mode="letin_pure">
113 <xsl:apply-templates select="*[1]" mode="noannot"/>
117 <xsl:template match="PROD" mode="pure">
118 <xsl:apply-templates select="*[1]" mode="prod"/>
122 <xsl:template match="decl" mode="prod">
123 <m:apply helm:xref="{@id}">
125 <xsl:when test="string(@binder)= """>
126 <m:csymbol>arrow</m:csymbol>
127 <xsl:apply-templates select="*[1]" mode="noannot"/>
131 <xsl:when test="../@type = 'Prop'">
132 <m:csymbol>forall</m:csymbol>
135 <m:csymbol>prod</m:csymbol>
140 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
143 <xsl:apply-templates select="*[1]" mode="noannot"/>
148 <xsl:apply-templates select="following-sibling::*[1]" mode="prod"/>
153 <xsl:template match="target" mode="prod">
154 <xsl:apply-templates select="*[1]" mode="noannot"/>
158 <xsl:template match="CAST" mode="pure">
159 <m:apply helm:xref="{@id}">
160 <m:csymbol>cast</m:csymbol>
161 <xsl:apply-templates mode="noannot" select="*/*"/>
166 <xsl:template match="REL" mode="pure">
167 <m:ci helm:xref="{@id}">
168 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
173 <xsl:template match="SORT" mode="pure">
174 <m:apply helm:xref="{@id}">
176 <xsl:value-of select="@value"/>
182 <xsl:template match="APPLY" mode="pure">
183 <m:apply helm:xref="{@id}">
184 <m:csymbol>app</m:csymbol>
185 <xsl:apply-templates mode="noannot" select="*"/>
190 <!-- Gestione senza pre-processing -->
192 <xsl:template match="APPLY" mode="pure">
193 <xsl:apply-templates mode="coercion" select="."/>
196 <xsl:template match="APPLY" mode="no_coercion">
197 <m:apply helm:xref="{@id}">
198 <m:csymbol>app</m:csymbol>
199 <xsl:apply-templates mode="noannot" select="*"/>
204 <xsl:template match="VAR" mode="pure">
205 <m:ci helm:xref="{@id}">
206 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:call-template name="name_of_uri_bis">
207 <xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:with-param></xsl:call-template>
212 <xsl:template match="META" mode="pure">
213 <m:apply helm:xref="{@id}">
214 <m:csymbol>meta</m:csymbol>
216 <xsl:call-template name="insert_subscript">
217 <xsl:with-param name="node_value">
218 <xsl:text>?</xsl:text>
219 <xsl:value-of select="@no"/>
223 <xsl:for-each select="substitution">
225 <xsl:when test="*[1]">
226 <xsl:apply-templates select="*[1]" mode="noannot"/>
237 <xsl:template match="CONST" mode="pure">
238 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
239 <xsl:call-template name="insert_subscript">
240 <xsl:with-param name="node_value">
241 <xsl:call-template name="name_of_uri">
242 <xsl:with-param name="uri" select="@uri"/>
250 <xsl:template match="MUTIND" mode="pure">
251 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
252 <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:variable>
253 <xsl:variable name="index"><xsl:value-of select="@noType"/></xsl:variable>
254 <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>
259 <xsl:template match="MUTCONSTRUCT" mode="pure">
260 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
261 <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:variable>
262 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
263 <xsl:variable name="Cindex"><xsl:value-of select="@noConstr"/></xsl:variable>
264 <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>
269 <xsl:template match="MUTCASE" mode="pure">
270 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
271 <xsl:variable name="Turi"><xsl:value-of select="@uriType"/></xsl:variable>
272 <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="$Turi"/></xsl:call-template></xsl:variable>
273 <xsl:variable name="InductiveTypeDoc" select="document($InductiveTypeUrl)"/>
274 <m:apply helm:xref="{@id}">
275 <m:csymbol>mutcase</m:csymbol>
276 <xsl:apply-templates select="patternsType/*[1]" mode="noannot"/>
277 <xsl:apply-templates select="inductiveTerm/*[1]" mode="noannot"/>
278 <xsl:variable name="nop"><xsl:value-of select="$InductiveTypeDoc/InductiveDefinition/@noParams"/></xsl:variable>
280 <xsl:for-each select="pattern">
281 <xsl:variable name="pos" select="position()"/>
282 <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>
284 <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>
286 <xsl:when test="$nopar = 0">
288 <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>
293 <m:csymbol>app</m:csymbol>
295 <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>
297 <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>
308 <xsl:template match="FIX" mode="pure">
309 <m:apply helm:xref="{@id}">
310 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
311 <m:csymbol>fix</m:csymbol>
312 <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>
313 <xsl:apply-templates mode="pure" select="*"/>
318 <xsl:template match="COFIX" mode="pure">
319 <m:apply helm:xref="{@id}">
320 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
321 <m:csymbol>cofix</m:csymbol>
322 <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>
323 <xsl:apply-templates mode="pure" select="*"/>
327 <xsl:template match="instantiate" mode="pure">
330 <xsl:attribute name="helm:xref">
331 <xsl:value-of select="@id"/>
334 <m:csymbol>inst</m:csymbol>
335 <xsl:apply-templates mode="noannot" select="*[1]" />
336 <xsl:for-each select="arg">
337 <xsl:variable name="base_path">
338 <xsl:call-template name="path">
339 <xsl:with-param name="uri" select="../*[1]/@uri"/>
342 <xsl:variable name="varUri" select="concat($base_path,@relUri)"/>
343 <m:ci definitionURL="{$varUri}">
344 <xsl:call-template name="insert_subscript">
345 <xsl:with-param name="node_value">
346 <xsl:call-template name="name_of_uri">
347 <xsl:with-param name="uri" select="$varUri"/>
348 <xsl:with-param name="extension" select="'.var'"/>
353 <xsl:apply-templates mode ="noannot" select="*[1]" />
358 <!-- ELEMENTS OF CIC TERMS -->
360 <xsl:template match="FixFunction" mode="pure">
362 <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>
363 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
365 <xsl:apply-templates select="body/*[1]" mode="noannot"/>
369 <xsl:template match="CofixFunction" mode="pure">
371 <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>
372 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
374 <xsl:apply-templates select="body/*[1]" mode="noannot"/>