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">
14 <xsl:include href="params.xsl"/>
20 omit-xml-declaration="no"
22 doctype-public="http://www.w3.org/TR/REC-MathML"
24 media-type="text/mathml" /> -->
27 1)risolvere nella fase di pre-processing le uri relative, settando l'attributo
28 definitionURL dell'oggetto corrispondente (alcuni punteranno a nulla! -quelli
29 che non hanno il file di definizione corrispondente-); [le uri assolute hanno
30 la forma cic:/.../ in definitionURL e questo schema di uri verra' risolto da
31 Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
32 2)aggiungere nei file xml gli ID, affinche' nello stylesheet si setti
33 l'attributo xref di ogni oggetto per puntare (tramite ID) al suo corrispondente
34 della rappresentazione interna.
37 <!--******************************************************************-->
38 <!-- Variable containing the absolute path of the CIC file -->
39 <!--******************************************************************-->
41 <xsl:variable name="absPath">http://localhost:8081/get?url=</xsl:variable>
45 <xsl:template match="LAMBDA" mode="noannot">
46 <xsl:param name="backpointer" select="''"/>
50 [[<xsl:value-of select="$backpointer"/>]]
51 <xsl:value-of select="target/@binder"/>
54 <xsl:apply-templates select="source/*[1]" mode="noannot">
55 <xsl:with-param name="backpointer" select="concat($backpointer,'/*[1]/*[1]')"/>
56 </xsl:apply-templates>
59 <xsl:apply-templates select="target/*[1]" mode="noannot">
60 <xsl:with-param name="backpointer" select="concat($backpointer,'/*[2]/*[1]')"/>
61 </xsl:apply-templates>
65 <xsl:template match="PROD" mode="noannot">
66 <xsl:param name="backpointer" select="''"/>
69 <xsl:when test="string(target/@binder)= """>
70 <m:csymbol>arrow</m:csymbol>
71 <xsl:apply-templates select="source/*[1]" mode="noannot">
72 <xsl:with-param name="backpointer" select="concat($backpointer,'/*[1]/*[1]')"/>
73 </xsl:apply-templates>
76 <m:csymbol>prod</m:csymbol>
79 [[<xsl:value-of select="$backpointer"/>]]
80 <xsl:value-of select="target/@binder"/>
83 <xsl:apply-templates select="source/*[1]" mode="noannot">
84 <xsl:with-param name="backpointer" select="concat($backpointer,'/*[1]/*[1]')"/>
85 </xsl:apply-templates>
90 <xsl:apply-templates select="target/*[1]" mode="noannot">
91 <xsl:with-param name="backpointer" select="concat($backpointer,'/*[2]/*[1]')"/>
92 </xsl:apply-templates>
96 <xsl:template match="CAST" mode="noannot">
97 <xsl:param name="backpointer" select="''"/>
99 <m:csymbol>cast</m:csymbol>
100 <xsl:apply-templates mode="noannot" select="*[1]/*[1]">
101 <xsl:with-param name="backpointer" select="concat($backpointer,'/*[1]/*[1]')"/>
102 </xsl:apply-templates>
103 <xsl:apply-templates mode="noannot" select="*[2]/*[1]">
104 <xsl:with-param name="backpointer" select="concat($backpointer,'/*[2]/*[1]')"/>
105 </xsl:apply-templates>
109 <xsl:template match="REL" mode="noannot">
110 <xsl:param name="backpointer" select="''"/>
112 [[<xsl:value-of select="$backpointer"/>]]
113 <xsl:value-of select="@binder"/>
117 <xsl:template match="SORT" mode="noannot">
118 <xsl:param name="backpointer" select="''"/>
121 <xsl:value-of select="@value"/>
126 <xsl:template match="APPLY" mode="noannot">
127 <xsl:param name="backpointer" select="''"/>
129 <m:csymbol>app</m:csymbol>
130 <xsl:for-each select="*">
131 <xsl:apply-templates mode="noannot" select=".">
132 <xsl:with-param name="backpointer" select="concat($backpointer,'/*[',position(),']')"/>
133 </xsl:apply-templates>
138 <xsl:template match="VAR" mode="noannot">
139 <xsl:param name="backpointer" select="''"/>
141 [[<xsl:value-of select="$backpointer"/>]]
142 <xsl:value-of select="substring-after(@relUri,",")"/>
146 <xsl:template match="META" mode="noannot">
147 <xsl:param name="backpointer" select="''"/>
149 [[<xsl:value-of select="$backpointer"/>]]
150 <xsl:value-of select="@no"/>
154 <xsl:template match="CONST" mode="noannot">
155 <xsl:param name="backpointer" select="''"/>
156 <m:ci definitionURL="{@uri}">
157 [[<xsl:value-of select="$backpointer"/>]]
158 <xsl:call-template name="name_of_uri">
159 <xsl:with-param name="uri" select="@uri"/>
161 <!-- <xsl:value-of select="document(concat(string($absPath),@uri))/*/@name"/> -->
165 <xsl:template match="MUTIND" mode="noannot">
166 <xsl:param name="backpointer" select="''"/>
167 <m:ci definitionURL="{@uri}">
168 <xsl:variable name="index"><xsl:value-of select="@noType"/></xsl:variable>
169 [[<xsl:value-of select="$backpointer"/>]]
170 <xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($index)+1]/@name"/>
174 <xsl:template match="MUTCONSTRUCT" mode="noannot">
175 <xsl:param name="backpointer" select="''"/>
176 <m:ci definitionURL="{@uri}">
177 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
178 <xsl:variable name="Cindex"><xsl:value-of select="@noConstr"/></xsl:variable>
179 [[<xsl:value-of select="$backpointer"/>]]
180 <xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($Cindex)]/@name"/>
184 <xsl:template match="MUTCASE" mode="noannot">
185 <xsl:param name="backpointer" select="''"/>
186 <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
187 <xsl:variable name="Turi"><xsl:value-of select="@uriType"/></xsl:variable>
189 <m:csymbol>mutcase</m:csymbol>
190 <xsl:apply-templates select="patternsType/*[1]" mode="noannot">
191 <xsl:with-param name="backpointer" select="concat($backpointer,'/*[1]/*[1]')"/>
192 </xsl:apply-templates>
193 <xsl:apply-templates select="inductiveTerm/*[1]" mode="noannot">
194 <xsl:with-param name="backpointer" select="concat($backpointer,'/*[2]/*[1]')"/>
195 </xsl:apply-templates>
196 <xsl:variable name="nop"><xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/@noParams"/></xsl:variable>
197 <xsl:for-each select="pattern">
198 <xsl:variable name="pos" select="position()"/>
199 <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>
201 <xsl:when test="$nopar = 0">
203 <xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/>
208 <m:csymbol>app</m:csymbol>
210 <xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/>
212 <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>
216 <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>
221 <xsl:template match="FIX" mode="noannot">
222 <xsl:param name="backpointer" select="''"/>
224 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
225 <m:csymbol>fix</m:csymbol>
226 <m:ci><xsl:value-of select="FixFunction[position()=number($findex)+1]/@name"/></m:ci>
227 <xsl:apply-templates mode="noannot" select="*"/>
231 <xsl:template match="COFIX" mode="noannot">
233 <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
234 <m:csymbol>cofix</m:csymbol>
235 <m:ci><xsl:value-of select="CofixFunction[position()=number($findex)+1]/@name"/></m:ci>
236 <xsl:apply-templates mode="noannot" select="*"/>
240 <!-- ELEMENTS OF CIC TERMS -->
242 <xsl:template match="FixFunction" mode="noannot">
244 <m:ci><xsl:value-of select="@name"/></m:ci>
245 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
247 <xsl:apply-templates select="body/*[1]" mode="noannot"/>
250 <xsl:template match="CofixFunction" mode="noannot">
252 <m:ci><xsl:value-of select="@name"/></m:ci>
253 <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
255 <xsl:apply-templates select="body/*[1]" mode="noannot"/>