3 <!--******************************************************************-->
4 <!-- XSLT version 0.1 of CIC objects to MathML content: -->
5 <!-- First draft: February 14 2000, Andrea Asperti, Irene Schena -->
6 <!-- Revised: March 3 2000, Irene Schena -->
7 <!-- Revised: March 10 2000, Irene Schena -->
8 <!-- Revised: March 15 2000, Claudio Sacerdoti Coen, Irene Schena -->
9 <!--******************************************************************-->
11 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
12 xmlns:m="http://www.w3.org/1998/Math/MathML"
13 xmlns:helm="http://www.cs.unibo.it/helm">
15 <xsl:include href="params.xsl"/>
21 omit-xml-declaration="no"
23 doctype-public="http://www.w3.org/TR/REC-MathML"
25 media-type="text/mathml" /> -->
28 1)risolvere nella fase di pre-processing le uri relative, settando l'attributo
29 definitionURL dell'oggetto corrispondente (alcuni punteranno a nulla! -quelli
30 che non hanno il file di definizione corrispondente-); [le uri assolute hanno
31 la forma cic:/.../ in definitionURL e questo schema di uri verra' risolto da
32 Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
33 2)aggiungere nei file xml gli ID, affinche' nello stylesheet si setti
34 l'attributo xref di ogni oggetto per puntare (tramite ID) al suo corrispondente
35 della rappresentazione interna.
38 <!--******************************************************************-->
39 <!-- Variable containing the absolute path of the CIC file -->
40 <!--******************************************************************-->
42 <xsl:variable name="absPath">http://localhost:8081/get?url=</xsl:variable>
46 <xsl:template match="LAMBDA" mode="noannot">
47 <m:lambda helm:xref="{@id}">
50 <xsl:value-of select="target/@binder"/>
53 <xsl:apply-templates select="source/*[1]" mode="noannot"/>
56 <xsl:apply-templates select="target/*[1]" mode="noannot"/>
60 <xsl:template match="PROD" mode="noannot">
61 <m:apply helm:xref="{@id}">
63 <xsl:when test="string(target/@binder)= """>
64 <m:csymbol>arrow</m:csymbol>
65 <xsl:apply-templates select="source/*[1]" mode="noannot"/>
68 <m:csymbol>prod</m:csymbol>
71 <xsl:value-of select="target/@binder"/>
74 <xsl:apply-templates select="source/*[1]" mode="noannot"/>
79 <xsl:apply-templates select="target/*[1]" mode="noannot"/>
83 <xsl:template match="CAST" mode="noannot">
84 <m:apply helm:xref="{@id}">
85 <m:csymbol>cast</m:csymbol>
86 <xsl:apply-templates mode="noannot" select="*/*"/>
90 <xsl:template match="REL" mode="noannot">
91 <m:ci helm:xref="{@id}">
92 <xsl:value-of select="@binder"/>
96 <xsl:template match="SORT" mode="noannot">
97 <m:apply helm:xref="{@id}">
99 <xsl:value-of select="@value"/>
104 <xsl:template match="APPLY" mode="noannot">
105 <m:apply helm:xref="{@id}">
106 <m:csymbol>app</m:csymbol>
107 <xsl:apply-templates mode="noannot" select="*"/>
111 <xsl:template match="VAR" mode="noannot">
112 <m:ci helm:xref="{@id}">
113 <xsl:value-of select="substring-after(@relUri,",")"/>
117 <xsl:template match="META" mode="noannot">
118 <m:ci helm:xref="{@id}">
119 <xsl:value-of select="@no"/>
123 <xsl:template match="CONST" mode="noannot">
124 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
125 <xsl:call-template name="name_of_uri">
126 <xsl:with-param name="uri" select="@uri"/>
128 <!-- <xsl:value-of select="document(concat(string($absPath),@uri))/*/@name"/> -->
132 <xsl:template match="MUTIND" mode="noannot">
133 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
134 <xsl:variable name="index"><xsl:value-of select="@noType"/></xsl:variable>
135 <xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($index)+1]/@name"/>
139 <xsl:template match="MUTCONSTRUCT" mode="noannot">
140 <m:ci definitionURL="{@uri}" helm:xref="{@id}">
141 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
142 <xsl:variable name="Cindex"><xsl:value-of select="@noConstr"/></xsl:variable>
143 <xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($Cindex)]/@name"/>
147 <xsl:template match="MUTCASE" mode="noannot">
148 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
149 <xsl:variable name="Turi"><xsl:value-of select="@uriType"/></xsl:variable>
150 <m:apply helm:xref="{@id}">
151 <m:csymbol>mutcase</m:csymbol>
152 <xsl:apply-templates select="patternsType/*[1]" mode="noannot"/>
153 <xsl:apply-templates select="inductiveTerm/*[1]" mode="noannot"/>
154 <xsl:variable name="nop"><xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/@noParams"/></xsl:variable>
155 <xsl:for-each select="pattern">
156 <xsl:variable name="pos" select="position()"/>
157 <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>
159 <xsl:when test="$nopar = 0">
161 <xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/>
166 <m:csymbol>app</m:csymbol>
168 <xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/>
170 <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>
174 <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>
179 <xsl:template match="FIX" mode="noannot">
180 <m:apply helm:xref="{@id}">
181 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
182 <m:csymbol>fix</m:csymbol>
183 <m:ci><xsl:value-of select="FixFunction[position()=number($findex)+1]/@name"/></m:ci>
184 <xsl:apply-templates mode="noannot" select="*"/>
188 <xsl:template match="COFIX" mode="noannot">
189 <m:apply helm:xref="{@id}">
190 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
191 <m:csymbol>cofix</m:csymbol>
192 <m:ci><xsl:value-of select="CofixFunction[position()=number($findex)+1]/@name"/></m:ci>
193 <xsl:apply-templates mode="noannot" select="*"/>
197 <!-- ELEMENTS OF CIC TERMS -->
199 <xsl:template match="FixFunction" mode="noannot">
201 <m:ci><xsl:value-of select="@name"/></m:ci>
202 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
204 <xsl:apply-templates select="body/*[1]" mode="noannot"/>
207 <xsl:template match="CofixFunction" mode="noannot">
209 <m:ci><xsl:value-of select="@name"/></m:ci>
210 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
212 <xsl:apply-templates select="body/*[1]" mode="noannot"/>