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"/>
45 omit-xml-declaration="no"
47 doctype-public="http://www.w3.org/TR/REC-MathML"
49 media-type="text/mathml" /> -->
52 1)risolvere nella fase di pre-processing le uri relative delle var, settando
54 definitionURL dell'oggetto corrispondente (alcuni punteranno a nulla! -quelli
55 che non hanno il file di definizione corrispondente-); [le uri assolute hanno
56 la forma cic:/.../ in definitionURL e questo schema di uri verra' risolto da
57 Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
63 <xsl:template match="LAMBDA" mode="pure">
64 <m:lambda helm:xref="{@id}">
67 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="target/@binder"/></xsl:with-param></xsl:call-template>
70 <xsl:apply-templates select="source/*[1]" mode="noannot"/>
73 <xsl:apply-templates select="target/*[1]" mode="noannot"/>
77 <xsl:template match="LETIN" mode="pure">
78 <m:apply helm:xref="{@id}">
79 <m:csymbol>let_in</m:csymbol>
82 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="letintarget/@binder"/></xsl:with-param></xsl:call-template>
85 <xsl:apply-templates select="*[1]" mode="noannot"/>
86 <xsl:apply-templates select="letintarget/*[1]" mode="noannot"/>
90 <xsl:template match="PROD" mode="pure">
91 <m:apply helm:xref="{@id}">
93 <xsl:when test="string(target/@binder)= """>
94 <m:csymbol>arrow</m:csymbol>
95 <xsl:apply-templates select="source/*[1]" mode="noannot"/>
99 <xsl:when test="@type = 'Prop'">
100 <m:csymbol>forall</m:csymbol>
103 <m:csymbol>prod</m:csymbol>
108 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="target/@binder"/></xsl:with-param></xsl:call-template>
111 <xsl:apply-templates select="source/*[1]" mode="noannot"/>
116 <xsl:apply-templates select="target/*[1]" mode="noannot"/>
120 <xsl:template match="CAST" mode="pure">
121 <m:apply helm:xref="{@id}">
122 <m:csymbol>cast</m:csymbol>
123 <xsl:apply-templates mode="noannot" select="*/*"/>
127 <xsl:template match="REL" mode="pure">
128 <m:ci helm:xref="{@id}">
129 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
133 <xsl:template match="SORT" mode="pure">
134 <m:apply helm:xref="{@id}">
136 <xsl:value-of select="@value"/>
141 <xsl:template match="APPLY" mode="pure">
142 <m:apply helm:xref="{@id}">
143 <m:csymbol>app</m:csymbol>
144 <xsl:apply-templates mode="noannot" select="*"/>
148 <xsl:template match="VAR" mode="pure">
149 <m:ci helm:xref="{@id}">
150 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="substring-after(@relUri,",")"/></xsl:with-param></xsl:call-template>
154 <xsl:template match="META" mode="pure">
155 <m:ci helm:xref="{@id}">
156 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@no"/></xsl:with-param></xsl:call-template>
160 <xsl:template match="CONST" mode="pure">
161 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
162 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:call-template name="name_of_uri">
163 <xsl:with-param name="uri" select="@uri"/>
164 </xsl:call-template></xsl:with-param></xsl:call-template>
165 <!-- <xsl:value-of select="document(concat(string($absPath),@uri))/*/@name"/> -->
169 <xsl:template match="MUTIND" mode="pure">
170 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
171 <xsl:variable name="index"><xsl:value-of select="@noType"/></xsl:variable>
172 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($index)+1]/@name"/></xsl:with-param></xsl:call-template>
176 <xsl:template match="MUTCONSTRUCT" mode="pure">
177 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
178 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
179 <xsl:variable name="Cindex"><xsl:value-of select="@noConstr"/></xsl:variable>
180 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($Cindex)]/@name"/></xsl:with-param></xsl:call-template>
184 <xsl:template match="MUTCASE" mode="pure">
185 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
186 <xsl:variable name="Turi"><xsl:value-of select="@uriType"/></xsl:variable>
187 <m:apply helm:xref="{@id}">
188 <m:csymbol>mutcase</m:csymbol>
189 <xsl:apply-templates select="patternsType/*[1]" mode="noannot"/>
190 <xsl:apply-templates select="inductiveTerm/*[1]" mode="noannot"/>
191 <xsl:variable name="nop"><xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/@noParams"/></xsl:variable>
192 <xsl:for-each select="pattern">
193 <xsl:variable name="pos" select="position()"/>
194 <xsl:variable name="nopar"><xsl:apply-templates select="document(concat(string($absPath),$Turi))/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>
196 <xsl:when test="$nopar = 0">
198 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/></xsl:with-param></xsl:call-template>
203 <m:csymbol>app</m:csymbol>
205 <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/></xsl:with-param></xsl:call-template>
207 <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>
211 <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>
216 <xsl:template match="FIX" mode="pure">
217 <m:apply helm:xref="{@id}">
218 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
219 <m:csymbol>fix</m:csymbol>
220 <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>
221 <xsl:apply-templates mode="pure" select="*"/>
225 <xsl:template match="COFIX" mode="pure">
226 <m:apply helm:xref="{@id}">
227 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
228 <m:csymbol>cofix</m:csymbol>
229 <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>
230 <xsl:apply-templates mode="pure" select="*"/>
234 <!-- ELEMENTS OF CIC TERMS -->
236 <xsl:template match="FixFunction" mode="pure">
238 <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>
239 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
241 <xsl:apply-templates select="body/*[1]" mode="noannot"/>
244 <xsl:template match="CofixFunction" mode="pure">
246 <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>
247 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
249 <xsl:apply-templates select="body/*[1]" mode="noannot"/>