]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/meta_style/meta_cic2mathml.xsl
Branch V7_3_new_exportation merged.
[helm.git] / helm / meta_style / meta_cic2mathml.xsl
index f77890363dfbe41ad0d42acb8c562dda64987637..072774b5d50bcb7c4c7dfefb93e47e76f59d8acd 100644 (file)
@@ -47,6 +47,7 @@
        <oxsl:include href="{@href}"/>
 </xsl:template>
 
+
 <xsl:template match="Operator|NotOperator">
        <xsl:variable name="uri">
                <xsl:call-template name="remove_white_spaces">
@@ -79,7 +80,7 @@
                                        <xsl:with-param name="c-tag" select="'CONST'"/>
                                </xsl:call-template>
                        </xsl:variable>
-                       
+
                        <!-- All uris in uri2 list (if not empty) have MUTIND c-tag -->
                        <xsl:variable name="uri2">
                                <xsl:call-template name="select_uris">
                                        <xsl:with-param name="name"  select="@name"/>
                                        <xsl:with-param name="not"   select="$not"/>
                                        <xsl:with-param name="uri"   select="$uri1"/>
-                                       <xsl:with-param name="cook"  select="@cook"/>
                                        <xsl:with-param name="hide"  select="@hide"/>
                                        <xsl:with-param name="arity" select="@arity"/>
                                        <xsl:with-param name="m-tag" select="@m-tag"/>
                                        <xsl:with-param name="c-tag" select="'CONST'"/>
                                        <xsl:with-param name="const" select="$const"/>
                                </xsl:call-template>
+                               <xsl:if test="@cook = 'true'">
+                                       <xsl:call-template name="out_template">
+                                               <xsl:with-param name="name"  select="@name"/>
+                                               <xsl:with-param name="not"   select="$not"/>
+                                               <xsl:with-param name="uri"   select="$uri1"/>
+                                               <xsl:with-param name="cook"  select="@cook"/>
+                                               <xsl:with-param name="hide"  select="@hide"/>
+                                               <xsl:with-param name="arity" select="@arity"/>
+                                               <xsl:with-param name="m-tag" select="@m-tag"/>
+                                               <xsl:with-param name="c-tag" select="'CONST'"/>
+                                       </xsl:call-template>
+                               </xsl:if>
                        </xsl:if>
 
                        <xsl:if test="$uri2 != ''">
                                        <xsl:with-param name="name"  select="@name"/>
                                        <xsl:with-param name="not"   select="$not"/>
                                        <xsl:with-param name="uri"   select="$uri2"/>
-                                       <xsl:with-param name="cook"  select="@cook"/>
                                        <xsl:with-param name="hide"  select="@hide"/>
                                        <xsl:with-param name="arity" select="@arity"/>
                                        <xsl:with-param name="m-tag" select="@m-tag"/>
                                        <xsl:with-param name="c-tag" select="'MUTIND'"/>
                                        <xsl:with-param name="const" select="$const"/>
                                </xsl:call-template>
+                               <xsl:if test="@cook = 'true'">
+                                       <xsl:call-template name="out_template">
+                                               <xsl:with-param name="name"  select="@name"/>
+                                               <xsl:with-param name="not"   select="$not"/>
+                                               <xsl:with-param name="uri"   select="$uri2"/>
+                                               <xsl:with-param name="cook"  select="@cook"/>
+                                               <xsl:with-param name="hide"  select="@hide"/>
+                                               <xsl:with-param name="arity" select="@arity"/>
+                                               <xsl:with-param name="m-tag" select="@m-tag"/>
+                                               <xsl:with-param name="c-tag" select="'MUTIND'"/>
+                                       </xsl:call-template>    
+                               </xsl:if>
                        </xsl:if>
                </xsl:otherwise>
        </xsl:choose>
        </xsl:variable>
 
        <xsl:choose>
-               <xsl:when test="$const = 'false' and $not = 'true'">
+               <xsl:when test="$const = 'true' and $not = 'true'">
                        <xsl:call-template name="out_comment">
                                <xsl:with-param name="name" select="concat($uri,': &quot;not&quot; cannot  be applyed to a constant operator')"/>
                        </xsl:call-template>
                </xsl:when>
                <xsl:when test="$const = 'true'">
                        <xsl:call-template name="out_comment">
-                               <xsl:with-param name="name" select="concat($uri,':  cannot be specified a constant operator when using OpSet element')"/>
+                               <xsl:with-param name="name" select="concat($uri,': cannot be specified a constant operator when using OpSet element')"/>
                        </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
                                        <xsl:with-param name="name"  select="@name"/>
                                        <xsl:with-param name="not"   select="$not"/>
                                        <xsl:with-param name="uri"   select="$uri1"/>
-                                       <xsl:with-param name="cook"  select="@cook"/>
                                        <xsl:with-param name="hide"  select="@hide"/>
                                        <xsl:with-param name="m-tag" select="@m-tag"/>
                                        <xsl:with-param name="c-tag" select="'CONST'"/>
                                </xsl:call-template>
+                               <xsl:if test="@cook = 'true'">
+                                       <xsl:call-template name="out_template_set">
+                                               <xsl:with-param name="name"  select="@name"/>
+                                               <xsl:with-param name="not"   select="$not"/>
+                                               <xsl:with-param name="uri"   select="$uri1"/>
+                                               <xsl:with-param name="cook"  select="@cook"/>
+                                               <xsl:with-param name="hide"  select="@hide"/>
+                                               <xsl:with-param name="m-tag" select="@m-tag"/>
+                                               <xsl:with-param name="c-tag" select="'CONST'"/>
+                                       </xsl:call-template>
+                               </xsl:if>
                        </xsl:if>
 
                        <xsl:if test="$uri2 != ''">
                                        <xsl:with-param name="name"  select="@name"/>
                                        <xsl:with-param name="not"   select="$not"/>
                                        <xsl:with-param name="uri"   select="$uri2"/>
-                                       <xsl:with-param name="cook"  select="@cook"/>
                                        <xsl:with-param name="hide"  select="@hide"/>
                                        <xsl:with-param name="m-tag" select="@m-tag"/>
                                        <xsl:with-param name="c-tag" select="'MUTIND'"/>
                                </xsl:call-template>
+                               <xsl:if test="@cook = 'true'">
+                                       <xsl:call-template name="out_template_set">
+                                               <xsl:with-param name="name"  select="@name"/>
+                                               <xsl:with-param name="not"   select="$not"/>
+                                               <xsl:with-param name="uri"   select="$uri2"/>
+                                               <xsl:with-param name="cook"  select="@cook"/>
+                                               <xsl:with-param name="hide"  select="@hide"/>
+                                               <xsl:with-param name="m-tag" select="@m-tag"/>
+                                               <xsl:with-param name="c-tag" select="'MUTIND'"/>
+                                       </xsl:call-template>    
+                               </xsl:if>
                        </xsl:if>
                </xsl:otherwise>
        </xsl:choose>
        <xsl:param name="m-tag"/>
        <xsl:param name="c-tag"/>
        <xsl:param name="const" select="'false'"/>
-
-       <xsl:variable name="apply_not">
-               <xsl:if test="$not = 'true'">*[2]/</xsl:if>
-       </xsl:variable>
-
+       
        <xsl:variable name="match">
                <xsl:variable name="match_op">
                        <xsl:call-template name="out_match_op">
                                <xsl:with-param name="not"   select="$not"/>
                                <xsl:with-param name="uri"   select="$uri"/>
+                               <xsl:with-param name="cook"  select="$cook"/>
                                <xsl:with-param name="c-tag" select="$c-tag"/>
                        </xsl:call-template>
                </xsl:variable>
-
+               
                <xsl:variable name="match_child">
-                       <xsl:if test="$cook = 'false' or $not = 'true'">
+                       <xsl:if test="$const = 'false'">
                                <xsl:choose>
                                        <!-- if the operator has been concatenated with not, the root apply node must have only two child -->
-                                       <xsl:when test="$not = 'true' and $cook = 'true'"> and count(*) = 2</xsl:when>
-                                       <xsl:when test="$not = 'true' and $cook = 'false'">
+                                       <xsl:when test="$not = 'true'">
                                                <xsl:value-of select="concat(' and count(*) = 2 and count(*[2]/*) = ',$arity + $hide + 1)"/>
                                        </xsl:when>
                                        <xsl:otherwise>
-                                               <xsl:value-of select="concat('count(*) = ',$arity + $hide + 1)"/>
+                                               <xsl:value-of select="concat(' and count(*) = ',$arity + $hide + 1)"/>
                                        </xsl:otherwise>
                                </xsl:choose>
                        </xsl:if>
                </xsl:choose>
        </xsl:variable>
 
-       <xsl:variable name="op_uri_attr">
-               <xsl:variable name="tmp_op_uri_attr">
-                       <xsl:call-template name="op_uri_attr">
-                               <xsl:with-param name="not"   select="$not"/>
-                               <xsl:with-param name="c-tag" select="$c-tag"/>
-                               <xsl:with-param name="const" select="$const"/>
-                       </xsl:call-template>
-               </xsl:variable>
-               <xsl:value-of select="substring-after(substring-before($tmp_op_uri_attr,'}'),'{')"/>
-       </xsl:variable>
-
        <!--                     TEMPLATE                     -->
        <xsl:call-template name="out_comment">
                <xsl:with-param name="name" select="$name"/>
        </xsl:call-template>
 
        <oxsl:template match="{$match}" mode="pure">
-               <xsl:choose>
-                       <xsl:when test="$cook = 'true'">
-                               <oxsl:variable name="no_params">
-                                       <oxsl:call-template name="get_no_params">
-                                               <oxsl:with-param name="first_uri"  select="$CICURI"/>
-                                               <oxsl:with-param name="second_uri" select="{$op_uri_attr}"/>
-                                       </oxsl:call-template>
-                               </oxsl:variable>
-                               <oxsl:choose>
-                                       <oxsl:when test="{concat('count(',$apply_not,'*) = $no_params + ',$arity + $hide + 1)}">
-                                               <xsl:call-template name="out_body">
-                                                       <xsl:with-param name="c-tag" select="$c-tag"/>
-                                                       <xsl:with-param name="m-tag" select="$m-tag"/>
-                                                       <xsl:with-param name="cook"  select="$cook"/>
-                                                       <xsl:with-param name="hide"  select="$hide"/>
-                                                       <xsl:with-param name="arity" select="$arity"/>
-                                                       <xsl:with-param name="not"   select="$not"/>
-                                                       <xsl:with-param name="const" select="$const"/>
-                                               </xsl:call-template>
-                                        </oxsl:when>
-                                        <oxsl:otherwise>
-                                               <oxsl:apply-imports/>
-                                       </oxsl:otherwise>
-                               </oxsl:choose>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <xsl:call-template name="out_body">
-                                       <xsl:with-param name="c-tag" select="$c-tag"/>
-                                       <xsl:with-param name="m-tag" select="$m-tag"/>
-                                       <xsl:with-param name="cook"  select="$cook"/>
-                                       <xsl:with-param name="hide"  select="$hide"/>
-                                       <xsl:with-param name="arity" select="$arity"/>
-                                       <xsl:with-param name="not"   select="$not"/>
-                                       <xsl:with-param name="const" select="$const"/>
-                               </xsl:call-template>
-                       </xsl:otherwise>
-               </xsl:choose>
+               <xsl:call-template name="out_body">
+                       <xsl:with-param name="c-tag" select="$c-tag"/>
+                       <xsl:with-param name="m-tag" select="$m-tag"/>
+                       <xsl:with-param name="cook"  select="$cook"/>
+                       <xsl:with-param name="hide"  select="$hide"/>
+                       <xsl:with-param name="arity" select="$arity"/>
+                       <xsl:with-param name="not"   select="$not"/>
+                       <xsl:with-param name="const" select="$const"/>
+               </xsl:call-template>
        </oxsl:template>
 </xsl:template>
 
        <xsl:param name="m-tag"/>
        <xsl:param name="c-tag"/>
 
-       <xsl:variable name="no_params_var">
-               <xsl:if test="$cook = 'true'">$no_params + </xsl:if>
-       </xsl:variable>
-
        <xsl:variable name="match">
                <xsl:variable name="match_op">
                        <xsl:call-template name="out_match_op">
-                               <xsl:with-param name="not"   select="$not"/> 
+                               <xsl:with-param name="not"   select="$not"/>
+                               <xsl:with-param name="cook"  select="$cook"/>
                                <xsl:with-param name="uri"   select="$uri"/> 
                                <xsl:with-param name="c-tag" select="$c-tag"/>
                        </xsl:call-template>
                </xsl:variable>
                
-                <xsl:variable name="match_child">
-                       <xsl:if test="$not = 'true'"> and count(*) = 2</xsl:if>
-                </xsl:variable>
+               <xsl:variable name="match_child">
+                       <xsl:if test="$not = 'true'"> and count(*) = 2</xsl:if>
+               </xsl:variable>
 
-                <xsl:value-of select="concat('APPLY[',$match_op,$match_child,']')"/>
+               <xsl:value-of select="concat('APPLY[',$match_op,$match_child,']')"/>
        </xsl:variable>
 
        <xsl:variable name="apply_not">
                <xsl:if test="$not = 'true'">*[2]/</xsl:if>
        </xsl:variable>
 
-       <xsl:variable name="op_uri_attr">
-               <xsl:variable name="tmp_op_uri_attr">
-                       <xsl:call-template name="op_uri_attr">
-                               <xsl:with-param name="not"   select="$not"/>
-                               <xsl:with-param name="c-tag" select="$c-tag"/>
-                       </xsl:call-template>
-               </xsl:variable>
-               <xsl:value-of select="substring-after(substring-before($tmp_op_uri_attr,'}'),'{')"/>
-       </xsl:variable>
-
 
        <!--                     TEMPLATE                     -->
        <xsl:call-template name="out_comment">
        </xsl:call-template>
        
        <oxsl:template match="{$match}" mode="pure">
-               <xsl:if test="$cook = 'true'">
-                       <oxsl:variable name="no_params">
-                               <oxsl:call-template name="get_no_params">
-                                       <oxsl:with-param name="first_uri"  select="$CICURI"/>
-                                       <oxsl:with-param name="second_uri" select="{$op_uri_attr}"/>
-                               </oxsl:call-template>
-                       </oxsl:variable>
-               </xsl:if>       
                <oxsl:choose>
                        <xsl:for-each select="Case">
-                               <oxsl:when test="{concat('count(',$apply_not,'*) = ',$no_params_var,@arity + $hide + 1)}">
+                               <oxsl:when test="{concat('count(',$apply_not,'*) = ',@arity + $hide + 1)}">
                                        <xsl:call-template name="out_body">
                                                <xsl:with-param name="c-tag" select="$c-tag"/>
                                                <xsl:with-param name="m-tag" select="$m-tag"/>
 <xsl:template name="out_match_op">
        <xsl:param name="not"  select="'false'"/>
        <xsl:param name="uri"/>
+       <xsl:param name="cook" select="'false'"/>
        <xsl:param name="c-tag"/>
+
+       <xsl:variable name="instantiate">
+               <xsl:if test="$cook = 'true'">instantiate/</xsl:if>
+       </xsl:variable>
        
        <!-- application with not operator -->
        <xsl:variable name="app_not">
 
        <xsl:variable name="app_op">
                <xsl:if test="$not = 'true'">APPLY[</xsl:if>
-               <xsl:value-of select="concat($c-tag,'[',$uris,']')"/>
+               <xsl:value-of select="concat($instantiate,$c-tag,'[',$uris,']')"/>
                <xsl:if test="$not = 'true'">]</xsl:if>
        </xsl:variable>
 
 
 <xsl:template name="out_params">
        <xsl:param name="params" select="1"/>
-       <xsl:param name="cook"   select="'false'"/>
        <xsl:param name="hide"   select="0"/>
        <xsl:param name="not"    select="'false'"/>
        <xsl:param name="mode"   select="'noannot'"/>
                        <xsl:call-template name="param">
                                <xsl:with-param name="id"    select="$params"/>
                                <xsl:with-param name="not"   select="$not"/>
-                               <xsl:with-param name="cook"  select="$cook"/>
                                <xsl:with-param name="hide"  select="$hide"/>
                        </xsl:call-template>
                </xsl:variable>
                
                <xsl:call-template name="out_params">
                        <xsl:with-param name="params" select="$params + 1"/>
-                       <xsl:with-param name="cook"   select="$cook"/>
                        <xsl:with-param name="hide"   select="$hide"/>
                        <xsl:with-param name="not"    select="$not"/>
                        <xsl:with-param name="mode"   select="$mode"/>
        </xsl:if>
 </xsl:template>
 
-
 <xsl:template name="out_body">
        <xsl:param name="c-tag"/>
        <xsl:param name="cook"  select="'false'"/>
                <!--            SIMPLE TRANSFORMATIONS            -->
                <xsl:when test="count(*) = 0">
                        <xsl:variable name="xref">
-                                <xsl:if test="$const = 'false'">{@id}</xsl:if>
+                               <xsl:if test="$const = 'false'">{@id}</xsl:if>
                        </xsl:variable>
 
                        <xsl:variable name="definitionURL">
                                <xsl:call-template name="op_uri_attr">
                                        <xsl:with-param name="not"   select="$not"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="const" select="$const"/>
                                </xsl:call-template>
                         <xsl:variable name="helm:xref">
                                <xsl:call-template name="op_id_attr">
                                        <xsl:with-param name="not"   select="$not"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="const" select="$const"/>
                                </xsl:call-template>
                                </xsl:element>
                                <!--            PARAMS            -->
                                <xsl:call-template name="out_params">
-                                       <xsl:with-param name="cook"   select="$cook"/>
-                                       <xsl:with-param name="hide"   select="$hide"/>  
+                                       <xsl:with-param name="hide"   select="$hide"/>                                  
                                        <xsl:with-param name="not"    select="$not"/>
                                        <xsl:with-param name="arity"  select="$arity"/>
                                </xsl:call-template>
        </xsl:choose>
 </xsl:template>
 
+
 <xsl:template name="out_mvar">
        <xsl:param name="vname"/>
        
 <xsl:template name="out_choose_binder">
        <xsl:param name="binded_params" select="''"/>
        <xsl:param name="not"           select="'false'"/>
-       <xsl:param name="cook"          select="'false'"/>
        <xsl:param name="hide"          select="0"/>
        <xsl:param name="binder"/>
        
                                <xsl:call-template name="out_choose_binder">
                                        <xsl:with-param name="binded_params" select="substring-before($binded_params,'+')"/>
                                        <xsl:with-param name="not"           select="$not"/>
-                                       <xsl:with-param name="cook"          select="$cook"/>
                                        <xsl:with-param name="hide"          select="$hide"/>
                                        <xsl:with-param name="binder"        select="$binder"/>
                                </xsl:call-template>
                                <xsl:call-template name="out_choose_binder">
                                        <xsl:with-param name="binded_params" select="substring-after($binded_params,'+')"/>
                                        <xsl:with-param name="not"           select="$not"/>
-                                       <xsl:with-param name="cook"          select="$cook"/>
                                        <xsl:with-param name="hide"          select="$hide"/>
                                        <xsl:with-param name="binder"        select="$binder"/>
                                </xsl:call-template>
                                        <xsl:call-template name="param">
                                                <xsl:with-param name="id"    select="$binded_params"/>
                                                <xsl:with-param name="not"   select="$not"/>
-                                               <xsl:with-param name="cook"  select="$cook"/>
                                                <xsl:with-param name="hide"  select="$hide"/>
                                        </xsl:call-template>
                                </xsl:variable>
        </xsl:if>
 </xsl:template>
 
+
 <!-- *********************************************************************** -->
 <!--                     META LANGUAGE FOR MathML                            --> 
 <!-- *********************************************************************** -->
                                <xsl:call-template name="set_attribute">
                                        <xsl:with-param name="attr"  select="@xref"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="hide"  select="$hide"/>
                                        <xsl:with-param name="arity" select="$arity"/>
                                        <xsl:with-param name="not"   select="$not"/>
 
        <m:apply helm:xref="{$helm:xref}">
                <xsl:call-template name="copy_attributes">
+                       <xsl:with-param name="cook"   select="$cook"/>
                        <xsl:with-param name="c-tag"  select="$c-tag"/>
                        <xsl:with-param name="hide"   select="$hide"/>
                        <xsl:with-param name="arity"  select="$arity"/>
        </m:apply>
 </xsl:template>
 
-
 <xsl:template match="mop">
        <xsl:param name="c-tag"/>
        <xsl:param name="cook"  select="'false'"/>
                        <xsl:when test="@definitionURL">
                                <xsl:call-template name="set_attribute">
                                        <xsl:with-param name="attr"  select="@definitionURL"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="hide"  select="$hide"/>
                                        <xsl:with-param name="arity" select="$arity"/>
                        <xsl:otherwise>
                                <xsl:call-template name="op_uri_attr">
                                        <xsl:with-param name="not"   select="$not"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="const" select="$const"/>
                                </xsl:call-template>
                        <xsl:when test="@xref">
                                <xsl:call-template name="set_attribute">
                                        <xsl:with-param name="attr"  select="@xref"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="hide"  select="$hide"/>
                                        <xsl:with-param name="arity" select="$arity"/>
                        <xsl:otherwise>
                                <xsl:call-template name="op_id_attr">
                                        <xsl:with-param name="not"   select="$not"/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="const" select="$const"/>
                                </xsl:call-template>
                </xsl:attribute>
                
                <xsl:call-template name="copy_attributes">
+                       <xsl:with-param name="cook"   select="$cook"/>
                        <xsl:with-param name="c-tag"  select="$c-tag"/>
                        <xsl:with-param name="hide"   select="$hide"/>
                        <xsl:with-param name="arity"  select="$arity"/>
        </xsl:element>
 </xsl:template>
 
+
 <xsl:template match="param">
-       <xsl:param name="cook" select="'false'"/>
        <xsl:param name="hide" select="0"/>
        <xsl:param name="not"  select="'false'"/>
 
                <xsl:call-template name="param">
                        <xsl:with-param name="id"    select="@id"/>
                        <xsl:with-param name="not"   select="$not"/>
-                       <xsl:with-param name="cook"  select="$cook"/>
                        <xsl:with-param name="hide"  select="$hide"/>
                </xsl:call-template>
        </xsl:variable>
        </xsl:choose>
 </xsl:template>
 
+
 <xsl:template match="m:*">
        <xsl:param name="c-tag"/>
        <xsl:param name="cook"  select="'false'"/>
        
        <xsl:copy>
                <xsl:call-template name="copy_attributes">
+                       <xsl:with-param name="cook"  select="$cook"/>
                        <xsl:with-param name="c-tag" select="$c-tag"/>
                        <xsl:with-param name="hide"  select="$hide"/>
                        <xsl:with-param name="arity" select="$arity"/>
        </xsl:copy>
 </xsl:template>
 
+
 <xsl:template match="mbvar">
        <xsl:param name="c-tag"/>
        <xsl:param name="cook"  select="'false'"/>
                <xsl:call-template name="test_on_lambda">
                        <xsl:with-param name="binded_params" select="$binded_params"/>
                        <xsl:with-param name="not"           select="$not"/>
-                       <xsl:with-param name="cook"          select="$cook"/>
                        <xsl:with-param name="hide"          select="$hide"/>
                </xsl:call-template>
        </xsl:variable>
 
-       <xsl:variable name="binder">/target/@binder</xsl:variable>
+       <xsl:variable name="binder">/decl/@binder</xsl:variable>
 
        <xsl:choose>
                <xsl:when test="$binded_params != ''">
                                                                                        <xsl:with-param name="binded_params" select="$binded_params"/>
                                                                                        <xsl:with-param name="not"           select="$not"/>
                                                                                        <xsl:with-param name="hide"          select="$hide"/>
-                                                                                       <xsl:with-param name="cook"          select="$cook"/>
                                                                                        <xsl:with-param name="binder"        select="$binder"/>
                                                                                </xsl:call-template>
                                                                        </oxsl:choose>
-                                                               </oxsl:variable>
+                                                               </oxsl:variable>
                                                                <oxsl:call-template name="insert_subscript">
                                                                        <oxsl:with-param name="node_value" select="$binder"/>
                                                                </oxsl:call-template>
                                                                        <xsl:call-template name="param">
                                                                                <xsl:with-param name="id"    select="$binded_params"/>
                                                                                <xsl:with-param name="not"   select="$not"/>
-                                                                               <xsl:with-param name="cook"  select="$cook"/>
                                                                                <xsl:with-param name="hide"  select="$hide"/>
                                                                        </xsl:call-template>
-                                                               </xsl:variable>
-                                                       
+                                                               </xsl:variable>                                                         
+
                                                                <oxsl:call-template name="insert_subscript">
                                                                        <oxsl:with-param name="node_value" select="{concat($param,$binder)}"/>
                                                                </oxsl:call-template>
        </xsl:choose>
 </xsl:template>
 
+
+
 <xsl:template match="mvar">
        <xsl:call-template name="out_mvar">
                <xsl:with-param name="vname" select="@name"/>
 </xsl:template>
 
 
-
 <!-- *********************************************************************** -->
 <!--                          AUXILIARY FUNCTIONS                            -->
 <!-- *********************************************************************** -->
 <xsl:template name="test_on_lambda">
        <xsl:param name="binded_params" select="''"/>
        <xsl:param name="not"           select="'false'"/>
-       <xsl:param name="cook"          select="'false'"/>
        <xsl:param name="hide"          select="0"/>
        
        <xsl:if test="$binded_params != ''">
                                        <xsl:call-template name="test_on_lambda">
                                                <xsl:with-param name="binded_params" select="substring-before($binded_params,'+')"/>
                                                <xsl:with-param name="not"           select="$not"/>
-                                               <xsl:with-param name="cook"          select="$cook"/>
                                                <xsl:with-param name="hide"          select="$hide"/>
                                        </xsl:call-template>
                                </xsl:variable>
                                        <xsl:call-template name="test_on_lambda">
                                                <xsl:with-param name="binded_params" select="substring-after($binded_params,'+')"/>
                                                <xsl:with-param name="not"           select="$not"/>
-                                               <xsl:with-param name="cook"          select="$cook"/>
                                                <xsl:with-param name="hide"          select="$hide"/>
                                        </xsl:call-template>
                                </xsl:variable>
                                        <xsl:call-template name="param">
                                                <xsl:with-param name="id"    select="$binded_params"/>
                                                <xsl:with-param name="not"   select="$not"/>
-                                               <xsl:with-param name="cook"  select="$cook"/>
                                                <xsl:with-param name="hide"  select="$hide"/>
                                        </xsl:call-template>
                                </xsl:variable>
 <xsl:template name="param">
        <xsl:param name="id"/>
        <xsl:param name="not"   select="'false'"/>
-       <xsl:param name="cook"  select="'false'"/>
        <xsl:param name="hide"  select="0"/>
 
        <xsl:variable name="apply_not">
                <xsl:if test="$not = 'true'">*[2]/</xsl:if>
        </xsl:variable>
 
-       <xsl:variable name="no_params_var">
-               <xsl:if test="$cook = 'true'">$no_params+</xsl:if>
-       </xsl:variable>
-
-       <xsl:value-of select="concat($apply_not,'*[',$no_params_var,$id + $hide + 1,']')"/>
+       <xsl:value-of select="concat($apply_not,'*[',$id + $hide + 1,']')"/>
 </xsl:template>
 
 <!-- Returns a xpath string with the location of the operator uri attribute -->
 <xsl:template name="op_uri_attr">
        <xsl:param name="not"   select="'false'"/>
+       <xsl:param name="cook"  select="'false'"/>
        <xsl:param name="c-tag"/>
        <xsl:param name="const" select="'false'"/>
 
        <xsl:call-template name="op_attr">
                <xsl:with-param name="attr_type" select="'@uri'"/>
                <xsl:with-param name="not"       select="$not"/>
+               <xsl:with-param name="cook"      select="$cook"/>
                <xsl:with-param name="c-tag"     select="$c-tag"/>
                <xsl:with-param name="const"     select="$const"/>
        </xsl:call-template>
 <!-- Returns a xpath string with the location of the operator id attribute -->
 <xsl:template name="op_id_attr">
        <xsl:param name="not"  select="'false'"/>
+       <xsl:param name="cook" select="'false'"/>
        <xsl:param name="c-tag"/>
        <xsl:param name="const" select="'false'"/>
        
        <xsl:call-template name="op_attr">
                <xsl:with-param name="attr_type" select="'@id'"/>
                <xsl:with-param name="not"       select="$not"/>
+               <xsl:with-param name="cook"      select="$cook"/>
                <xsl:with-param name="c-tag"     select="$c-tag"/>
                <xsl:with-param name="const"     select="$const"/>
        </xsl:call-template>
 <xsl:template name="op_attr">
        <xsl:param name="attr_type"/>
        <xsl:param name="not"  select="'false'"/>
+       <xsl:param name="cook" select="'false'"/>
        <xsl:param name="c-tag"/>
        <xsl:param name="const" select="'false'"/>
+       
+       <xsl:variable name="instantiate">
+               <xsl:if test="$cook = 'true'">instantiate/</xsl:if>
+       </xsl:variable>
 
        <xsl:variable name="apply">
                <xsl:if test="$not = 'true'">APPLY/</xsl:if>
                        <xsl:value-of select="concat('{',$attr_type,'}')"/>     
                </xsl:when>
                <xsl:otherwise>
-                       <xsl:value-of select="concat('{',$apply,$c-tag,'/',$attr_type,'}')"/>                   
+                       <xsl:value-of select="concat('{',$apply,$instantiate,$c-tag,'/',$attr_type,'}')"/>                      
                </xsl:otherwise>
        </xsl:choose>
 </xsl:template>
 
 <xsl:template name="copy_attributes">
+       <xsl:param name="cook"   select="'false'"/>
        <xsl:param name="c-tag"/>
        <xsl:param name="hide"   select="0"/>
        <xsl:param name="arity"  select="0"/>
                        <xsl:attribute name="{$name}">
                                <xsl:call-template name="set_attribute">
                                        <xsl:with-param name="attr"  select="."/>
+                                       <xsl:with-param name="cook"  select="$cook"/>
                                        <xsl:with-param name="c-tag" select="$c-tag"/>
                                        <xsl:with-param name="hide"  select="$hide"/>
                                        <xsl:with-param name="arity" select="$arity"/>
 <xsl:template name="set_attribute">
        <xsl:param name="attr"/>
        <xsl:param name="c-tag"/>
+       <xsl:param name="cook"  select="'false'"/>
        <xsl:param name="hide"  select="0"/>
        <xsl:param name="arity" select="0"/>
        <xsl:param name="not"   select="'false'"/>
                                        <xsl:otherwise>@uri</xsl:otherwise>
                                </xsl:choose>
                        </xsl:variable>
-
+                       
                        <xsl:call-template name="op_attr">
                                <xsl:with-param name="attr_type" select="$attr_type"/>
                                <xsl:with-param name="not"       select="$not"/>
+                               <xsl:with-param name="cook"      select="$cook"/>
                                <xsl:with-param name="c-tag"     select="$c-tag"/>
                                <xsl:with-param name="const"     select="$const"/>
                        </xsl:call-template>