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/.../]
65 <!--xsl:template match="LAMBDA" mode="pure">
66 <m:lambda helm:xref="{decl/@id}">
69 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="decl/@binder"/></xsl:with-param></xsl:call-template>
72 <xsl:apply-templates select="decl/*[1]" mode="noannot"/>
75 <xsl:apply-templates select="target/*[1]" mode="noannot"/>
79 <!--xsl:template match="LAMBDA" mode="pure">
80 <xsl:for-each select="decl">
81 <m:lambda helm:xref="{@id}">
84 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
87 <xsl:apply-templates select="*[1]" mode="noannot"/>
92 <xsl:apply-templates select="target/*[1]" mode="noannot"/-->
93 <!--xsl:for-each select="decl">
98 <xsl:template match="LAMBDA" mode="pure">
99 <xsl:apply-templates select="*[1]" mode="lambda"/>
102 <xsl:template match="decl" mode="lambda">
103 <m:lambda helm:xref="{@id}">
106 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
109 <xsl:apply-templates select="*[1]" mode="noannot"/>
112 <xsl:apply-templates select="following-sibling::*[1]" mode="lambda"/>
116 <xsl:template match="target" mode="lambda">
117 <xsl:apply-templates select="*[1]" mode="noannot"/>
120 <!--xsl:template match="LETIN" mode="pure">
121 <m:apply helm:xref="{@id}">
122 <m:csymbol>let_in</m:csymbol>
125 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="letintarget/@binder"/></xsl:with-param></xsl:call-template>
128 <xsl:apply-templates select="*[1]" mode="noannot"/>
129 <xsl:apply-templates select="letintarget/*[1]" mode="noannot"/>
133 <xsl:template match="LETIN" mode="pure">
134 <xsl:apply-templates select="*[1]" mode="letin"/>
137 <xsl:template match="def" mode="letin">
138 <m:apply helm:xref="{@id}">
139 <m:csymbol>let_in</m:csymbol>
142 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
145 <xsl:apply-templates select="*[1]" mode="noannot"/>
146 <xsl:apply-templates select="following-sibling::*[1]" mode="letin"/>
150 <xsl:template match="target" mode="letin">
151 <xsl:apply-templates select="*[1]" mode="noannot"/>
154 <!--xsl:template match="PROD" mode="pure">
155 <xsl:for-each select="decl">
156 <m:apply helm:xref="{@id}">
158 <xsl:when test="string(@binder)= """>
159 <m:csymbol>arrow</m:csymbol>
160 <xsl:apply-templates select="*[1]" mode="noannot"/>
164 <xsl:when test="../@type = 'Prop'">
165 <m:csymbol>forall</m:csymbol>
168 <m:csymbol>prod</m:csymbol>
173 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
176 <xsl:apply-templates select="*[1]" mode="noannot"/>
183 <xsl:apply-templates select="target/*[1]" mode="noannot"/>
186 <xsl:template match="PROD" mode="pure">
187 <xsl:apply-templates select="*[1]" mode="prod"/>
190 <xsl:template match="decl" mode="prod">
191 <m:apply helm:xref="{@id}">
193 <xsl:when test="string(@binder)= """>
194 <m:csymbol>arrow</m:csymbol>
195 <xsl:apply-templates select="*[1]" mode="noannot"/>
199 <xsl:when test="../@type = 'Prop'">
200 <m:csymbol>forall</m:csymbol>
203 <m:csymbol>prod</m:csymbol>
208 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
211 <xsl:apply-templates select="*[1]" mode="noannot"/>
216 <xsl:apply-templates select="following-sibling::*[1]" mode="prod"/>
221 <xsl:template match="target" mode="prod">
222 <xsl:apply-templates select="*[1]" mode="noannot"/>
225 <xsl:template match="CAST" mode="pure">
226 <m:apply helm:xref="{@id}">
227 <m:csymbol>cast</m:csymbol>
228 <xsl:apply-templates mode="noannot" select="*/*"/>
232 <xsl:template match="REL" mode="pure">
233 <m:ci helm:xref="{@id}">
234 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
238 <xsl:template match="SORT" mode="pure">
239 <m:apply helm:xref="{@id}">
241 <xsl:value-of select="@value"/>
246 <xsl:template match="APPLY" mode="pure">
247 <m:apply helm:xref="{@id}">
248 <m:csymbol>app</m:csymbol>
249 <xsl:apply-templates mode="noannot" select="*"/>
253 <!-- Gestione senza pre-processing -->
255 <xsl:template match="APPLY" mode="pure">
256 <xsl:apply-templates mode="coercion" select="."/>
259 <xsl:template match="APPLY" mode="no_coercion">
260 <m:apply helm:xref="{@id}">
261 <m:csymbol>app</m:csymbol>
262 <xsl:apply-templates mode="noannot" select="*"/>
267 <xsl:template match="VAR" mode="pure">
268 <m:ci helm:xref="{@id}">
269 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:call-template name="name_of_uri_bis">
270 <xsl:with-param name="uri" select="@uri"/>
272 </xsl:with-param></xsl:call-template>
276 <xsl:template match="META" mode="pure">
277 <m:apply helm:xref="{@id}">
278 <m:csymbol>meta</m:csymbol>
280 <xsl:call-template name="insert_subscript">
281 <xsl:with-param name="node_value">
282 <xsl:text>?</xsl:text>
283 <xsl:value-of select="@no"/>
287 <xsl:for-each select="substitution">
289 <xsl:when test="*[1]">
290 <xsl:apply-templates select="*[1]" mode="noannot"/>
300 <xsl:template match="CONST" mode="pure">
301 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
302 <xsl:call-template name="insert_subscript">
303 <xsl:with-param name="node_value">
304 <xsl:call-template name="name_of_uri">
305 <xsl:with-param name="uri" select="@uri"/>
312 <xsl:template match="MUTIND" mode="pure">
313 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
314 <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:variable>
315 <xsl:variable name="index"><xsl:value-of select="@noType"/></xsl:variable>
316 <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>
320 <xsl:template match="MUTCONSTRUCT" mode="pure">
321 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
322 <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="@uri"/></xsl:call-template></xsl:variable>
323 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
324 <xsl:variable name="Cindex"><xsl:value-of select="@noConstr"/></xsl:variable>
325 <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>
329 <xsl:template match="MUTCASE" mode="pure">
330 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
331 <xsl:variable name="Turi"><xsl:value-of select="@uriType"/></xsl:variable>
332 <xsl:variable name="InductiveTypeUrl"><xsl:call-template name="URLofURI4getter"><xsl:with-param name="uri" select="$Turi"/></xsl:call-template></xsl:variable>
333 <xsl:variable name="InductiveTypeDoc" select="document($InductiveTypeUrl)"/>
334 <m:apply helm:xref="{@id}">
335 <m:csymbol>mutcase</m:csymbol>
336 <xsl:apply-templates select="patternsType/*[1]" mode="noannot"/>
337 <xsl:apply-templates select="inductiveTerm/*[1]" mode="noannot"/>
338 <xsl:variable name="nop"><xsl:value-of select="$InductiveTypeDoc/InductiveDefinition/@noParams"/></xsl:variable>
340 <xsl:for-each select="pattern">
341 <xsl:variable name="pos" select="position()"/>
342 <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>
344 <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>
346 <xsl:when test="$nopar = 0">
348 <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>
353 <m:csymbol>app</m:csymbol>
355 <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>
357 <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>
367 <xsl:template match="FIX" mode="pure">
368 <m:apply helm:xref="{@id}">
369 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
370 <m:csymbol>fix</m:csymbol>
371 <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>
372 <xsl:apply-templates mode="pure" select="*"/>
376 <xsl:template match="COFIX" mode="pure">
377 <m:apply helm:xref="{@id}">
378 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
379 <m:csymbol>cofix</m:csymbol>
380 <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>
381 <xsl:apply-templates mode="pure" select="*"/>
385 <!-- ELEMENTS OF CIC TERMS -->
387 <xsl:template match="FixFunction" mode="pure">
389 <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>
390 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
392 <xsl:apply-templates select="body/*[1]" mode="noannot"/>
395 <xsl:template match="CofixFunction" mode="pure">
397 <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>
398 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
400 <xsl:apply-templates select="body/*[1]" mode="noannot"/>