]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/meta_style/meta_cic2mathml.xsl
This commit was manufactured by cvs2svn to create branch 'init'.
[helm.git] / helm / meta_style / meta_cic2mathml.xsl
diff --git a/helm/meta_style/meta_cic2mathml.xsl b/helm/meta_style/meta_cic2mathml.xsl
deleted file mode 100644 (file)
index f778903..0000000
+++ /dev/null
@@ -1,1298 +0,0 @@
-<?xml version="1.0"?>
-
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                              xmlns:m="http://www.w3.org/1998/Math/MathML"
-                              xmlns:helm="http://www.cs.unibo.it/helm"
-                              xmlns:oxsl="http://www.w3.org/1999/XSL/TransformAlias">
-
-<xsl:output method="xml"/>
-
-<xsl:namespace-alias stylesheet-prefix="oxsl" result-prefix="xsl"/>
-
-<xsl:template match="OpList">
-       <xsl:comment> Copyright (C) 2000, HELM Team                                     </xsl:comment>
-       <xsl:comment>                                                                   </xsl:comment>
-       <xsl:comment> This file is part of HELM, an Hypertextual, Electronic            </xsl:comment>
-       <xsl:comment> Library of Mathematics, developed at the Computer Science         </xsl:comment>
-       <xsl:comment> Department, University of Bologna, Italy.                         </xsl:comment>
-       <xsl:comment>                                                                   </xsl:comment>
-       <xsl:comment> HELM is free software; you can redistribute it and/or             </xsl:comment>
-       <xsl:comment> modify it under the terms of the GNU General Public License       </xsl:comment>
-       <xsl:comment> as published by the Free Software Foundation; either version 2    </xsl:comment>
-       <xsl:comment> of the License, or (at your option) any later version.            </xsl:comment>
-       <xsl:comment>                                                                   </xsl:comment>
-       <xsl:comment> HELM is distributed in the hope that it will be useful,           </xsl:comment>
-       <xsl:comment> but WITHOUT ANY WARRANTY; without even the implied warranty of    </xsl:comment>
-       <xsl:comment> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     </xsl:comment>
-       <xsl:comment> GNU General Public License for more details.                      </xsl:comment>
-       <xsl:comment>                                                                   </xsl:comment>
-       <xsl:comment> You should have received a copy of the GNU General Public License </xsl:comment>
-       <xsl:comment> along with HELM; if not, write to the Free Software               </xsl:comment>
-       <xsl:comment> Foundation, Inc., 59 Temple Place - Suite 330, Boston,            </xsl:comment>
-       <xsl:comment> MA  02111-1307, USA.                                              </xsl:comment>
-       <xsl:comment>                                                                   </xsl:comment>
-       <xsl:comment> For details, see the HELM World-Wide-Web page,                    </xsl:comment>
-       <xsl:comment> http://cs.unibo.it/helm/.                                         </xsl:comment>
-       
-       <oxsl:stylesheet version="1.0">
-               <xsl:apply-templates/>
-       </oxsl:stylesheet>
-</xsl:template>
-
-<xsl:template match="import">
-       <oxsl:import href="{@href}"/>
-</xsl:template>
-
-<xsl:template match="include">
-       <oxsl:include href="{@href}"/>
-</xsl:template>
-
-<xsl:template match="Operator|NotOperator">
-       <xsl:variable name="uri">
-               <xsl:call-template name="remove_white_spaces">
-                       <xsl:with-param name="uri" select="@uri"/>
-               </xsl:call-template>
-       </xsl:variable>
-
-       <xsl:variable name="not">
-               <xsl:choose>
-                       <xsl:when test="name() = 'Operator'">false</xsl:when>
-                       <xsl:otherwise>true</xsl:otherwise>
-               </xsl:choose>
-       </xsl:variable>
-
-       <xsl:variable name="const">
-               <xsl:value-of select="@arity = 0 and @hide = 0 and @cook = 'false'"/>
-       </xsl:variable>
-
-       <xsl:choose>
-               <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:otherwise>
-                       <!-- All uris in uri1 list (if not empty) have CONST c-tag -->
-                       <xsl:variable name="uri1">
-                               <xsl:call-template name="select_uris">
-                                       <xsl:with-param name="uris"  select="$uri"/>
-                                       <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="uris"  select="$uri"/>
-                                       <xsl:with-param name="c-tag" select="'MUTIND'"/>
-                               </xsl:call-template>
-                       </xsl:variable>
-
-                       <xsl:if test="$uri1 != ''">
-                               <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:with-param name="const" select="$const"/>
-                               </xsl:call-template>
-                       </xsl:if>
-
-                       <xsl:if test="$uri2 != ''">
-                               <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:with-param name="const" select="$const"/>
-                               </xsl:call-template>
-                       </xsl:if>
-               </xsl:otherwise>
-       </xsl:choose>
-</xsl:template>
-
-<xsl:template match="OpSet|NotOpSet">
-       <xsl:variable name="uri">
-               <xsl:call-template name="remove_white_spaces">
-                       <xsl:with-param name="uri" select="@uri"/>
-               </xsl:call-template>
-       </xsl:variable>
-
-       <xsl:variable name="not">
-               <xsl:choose>
-                       <xsl:when test="name() = 'OpSet'">false</xsl:when>
-                       <xsl:otherwise>true</xsl:otherwise>
-               </xsl:choose>
-       </xsl:variable>
-
-       <xsl:variable name="const">
-               <xsl:value-of select="*[name() = 'Case']/@arity = 0 and @hide = 0 and @cook = 'false'"/>
-       </xsl:variable>
-
-       <xsl:choose>
-               <xsl:when test="$const = 'false' 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:call-template>
-               </xsl:when>
-               <xsl:otherwise>
-                       <xsl:variable name="uri1">
-                               <xsl:call-template name="select_uris">
-                                       <xsl:with-param name="uris"  select="$uri"/>
-                                       <xsl:with-param name="c-tag" select="'CONST'"/>
-                               </xsl:call-template>
-                       </xsl:variable>
-
-                       <xsl:variable name="uri2">
-                               <xsl:call-template name="select_uris">
-                                       <xsl:with-param name="uris"  select="$uri"/>
-                                       <xsl:with-param name="c-tag" select="'MUTIND'"/>
-                               </xsl:call-template>
-                       </xsl:variable>
-
-                       <xsl:if test="$uri1 != ''">
-                               <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 test="$uri2 != ''">
-                               <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:otherwise>
-       </xsl:choose>
-</xsl:template>
-
-<!-- *********************************************************************** -->
-<!--                             MAIN FUNCTIONS                              -->
-<!-- *********************************************************************** -->
-
-
-<xsl:template name="out_template">
-       <xsl:param name="name"/>
-       <xsl:param name="not"   select="'false'"/>
-       <xsl:param name="uri"/>
-       <xsl:param name="cook"  select="'false'"/>
-       <xsl:param name="hide"  select="0"/>
-       <xsl:param name="arity" select="0"/>
-       <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="c-tag" select="$c-tag"/>
-                       </xsl:call-template>
-               </xsl:variable>
-
-               <xsl:variable name="match_child">
-                       <xsl:if test="$cook = 'false' or $not = 'true'">
-                               <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: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:otherwise>
-                               </xsl:choose>
-                       </xsl:if>
-               </xsl:variable>
-
-               <xsl:choose>
-                       <xsl:when test="$const = 'false'">
-                               <xsl:value-of select="concat('APPLY[',$match_op,$match_child,']')"/>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <xsl:value-of select="$match_op"/>
-                       </xsl:otherwise>
-               </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>
-       </oxsl:template>
-</xsl:template>
-
-<xsl:template name="out_template_set">
-       <xsl:param name="name"/>
-       <xsl:param name="not"  select="'false'"/>
-       <xsl:param name="cook" select="'false'"/>
-       <xsl:param name="uri"/>
-       <xsl:param name="hide" select="0"/>
-       <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="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: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:with-param name="name" select="$name"/>
-       </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)}">
-                                       <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:call-template>
-                               </oxsl:when>
-                       </xsl:for-each>
-                               <oxsl:otherwise>
-                                       <oxsl:apply-imports/>
-                               </oxsl:otherwise>
-               </oxsl:choose>
-       </oxsl:template>
-</xsl:template>
-
-<xsl:template name="out_comment">
-       <xsl:param name="name"/>
-       <xsl:if test="$name">
-               <xsl:comment>
-                       <xsl:value-of select="concat(' ',$name,' ')"/>
-               </xsl:comment>
-       </xsl:if>                                                               
-</xsl:template>
-
-<!-- Returns a regular expression with matching operators -->
-<xsl:template name="out_match_op">
-       <xsl:param name="not"  select="'false'"/>
-       <xsl:param name="uri"/>
-       <xsl:param name="c-tag"/>
-       
-       <!-- application with not operator -->
-       <xsl:variable name="app_not">
-               <xsl:if test="$not = 'true'">CONST[@uri='cic:/Coq/Init/Logic/not.con'] and </xsl:if>
-       </xsl:variable>
-
-       <xsl:variable name="uris">
-               <xsl:call-template name="test_on_uris">
-                       <xsl:with-param name="uris" select="$uri"/>
-               </xsl:call-template>
-       </xsl:variable>
-
-       <xsl:variable name="app_op">
-               <xsl:if test="$not = 'true'">APPLY[</xsl:if>
-               <xsl:value-of select="concat($c-tag,'[',$uris,']')"/>
-               <xsl:if test="$not = 'true'">]</xsl:if>
-       </xsl:variable>
-
-       <xsl:value-of select="concat($app_not,$app_op)"/>
-</xsl:template>
-
-<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:param name="arity"  select="0"/>
-
-       <xsl:if test="$params &lt;= $arity">
-               <xsl:variable name="param">
-                       <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>
-
-               <oxsl:apply-templates select="{$param}" mode="{$mode}"/>
-               
-               <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:with-param name="arity"  select="$arity"/>
-               </xsl:call-template>
-       </xsl:if>
-</xsl:template>
-
-
-<xsl:template name="out_body">
-       <xsl:param name="c-tag"/>
-       <xsl:param name="cook"  select="'false'"/>
-       <xsl:param name="m-tag"/>
-       <xsl:param name="hide"  select="0"/>
-       <xsl:param name="arity" select="0"/>
-       <xsl:param name="not"   select="'false'"/>
-       <xsl:param name="const" select="'false'"/>
-
-       <xsl:choose>
-               <!--            SIMPLE TRANSFORMATIONS            -->
-               <xsl:when test="count(*) = 0">
-                       <xsl:variable name="xref">
-                                <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="c-tag" select="$c-tag"/>
-                                       <xsl:with-param name="const" select="$const"/>
-                               </xsl:call-template>
-                       </xsl:variable>
-
-                        <xsl:variable name="helm:xref">
-                               <xsl:call-template name="op_id_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>
-               
-                       <!--            APPLY            -->
-                       <m:apply helm:xref="{$xref}">
-                               <!--            OPERATOR            -->
-                               <xsl:element name="{concat('m:',$m-tag)}">
-                                       <xsl:attribute name="definitionURL">
-                                               <xsl:value-of select="$definitionURL"/>
-                                       </xsl:attribute>
-                                       <xsl:attribute name="helm:xref">
-                                               <xsl:value-of select="$helm:xref"/>
-                                       </xsl:attribute>
-                               </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="not"    select="$not"/>
-                                       <xsl:with-param name="arity"  select="$arity"/>
-                               </xsl:call-template>
-                       </m:apply>
-               </xsl:when>
-               <!--            COMPLEX TRANSFORMATIONS            -->
-               <xsl:otherwise>
-                       <xsl:apply-templates>
-                               <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"/>
-                               <xsl:with-param name="const" select="$const"/>
-                       </xsl:apply-templates>
-               </xsl:otherwise>
-       </xsl:choose>
-</xsl:template>
-
-<xsl:template name="out_mvar">
-       <xsl:param name="vname"/>
-       
-       <m:ci>
-               <xsl:choose>
-                       <xsl:when test="(ancestor-or-self::*[preceding-sibling::*[(name() = 'mbvar') and (@name = $vname)]]/preceding-sibling::*[(name() = 'mbvar') and (@name = $vname)])[position() = last()]">
-                               <oxsl:value-of select="{concat('$bvar_',$vname)}"/>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <xsl:value-of select="$vname"/>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </m:ci>
-</xsl:template>
-
-
-<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:if test="$binded_params != ''">
-               <xsl:choose>
-                       <xsl:when test="contains($binded_params,'+')">
-                               <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:when>
-                       <xsl:otherwise>
-                               <xsl:variable name="param">
-                                       <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>
-
-                               <oxsl:when test="{concat('name(',$param,') = ',&quot;'LAMBDA'&quot;)}">
-                                       <oxsl:value-of select="{concat($param,$binder)}"/>
-                               </oxsl:when>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:if>
-</xsl:template>
-
-<!-- *********************************************************************** -->
-<!--                     META LANGUAGE FOR MathML                            --> 
-<!-- *********************************************************************** -->
-       
-<xsl:template match="mapp">
-       <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:param name="const" select="'false'"/>
-       
-       <xsl:variable name="helm:xref">
-               <xsl:choose>
-                       <xsl:when test="@xref">
-                               <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="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:when>
-                       <xsl:otherwise>
-                               <xsl:if test="$const = 'false'">{@id}</xsl:if>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:variable>
-
-       <m:apply helm:xref="{$helm:xref}">
-               <xsl:call-template name="copy_attributes">
-                       <xsl:with-param name="c-tag"  select="$c-tag"/>
-                       <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:with-param name="ignore" select="'xref'"/>
-               </xsl:call-template>
-       
-               <xsl:apply-templates>
-                       <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"/>
-                       <xsl:with-param name="const" select="$const"/>
-               </xsl:apply-templates>
-       </m:apply>
-</xsl:template>
-
-
-<xsl:template match="mop">
-       <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:param name="const" select="'false'"/>
-
-       <!-- set definitonURL attribute -->
-       <xsl:variable name="definitionURL">
-               <xsl:choose>
-                       <xsl:when test="@definitionURL">
-                               <xsl:call-template name="set_attribute">
-                                       <xsl:with-param name="attr"  select="@definitionURL"/>
-                                       <xsl:with-param name="c-tag" select="$c-tag"/>
-                                       <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:when>
-                       <xsl:otherwise>
-                               <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:otherwise>
-               </xsl:choose>
-       </xsl:variable>
-
-       <!-- set helm:xref attribute -->
-       <xsl:variable name="helm:xref">
-               <xsl:choose>
-                       <xsl:when test="@xref">
-                               <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="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:when>
-                       <xsl:otherwise>
-                               <xsl:call-template name="op_id_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:otherwise>
-               </xsl:choose>
-       </xsl:variable>
-
-       <xsl:element name="{concat('m:',@tag)}">
-               <xsl:attribute name="definitionURL">
-                       <xsl:value-of select="$definitionURL"/>
-               </xsl:attribute>
-               <xsl:attribute name="helm:xref">
-                       <xsl:value-of select="$helm:xref"/>
-               </xsl:attribute>
-               
-               <xsl:call-template name="copy_attributes">
-                       <xsl:with-param name="c-tag"  select="$c-tag"/>
-                       <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:with-param name="ignore" select="'xref + definitionURL + tag'"/>
-               </xsl:call-template>
-               
-               <xsl:apply-templates>
-                       <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"/>
-                       <xsl:with-param name="const" select="$const"/>
-               </xsl:apply-templates>
-       </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:variable name="param">
-               <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:when test="@bvar">
-                       <oxsl:choose>
-                               <oxsl:when test="{concat('name(',$param,') = ',&quot;'LAMBDA'&quot;)}">
-                                       <oxsl:apply-templates select="{concat($param,'/target')}" mode="{@mode}"/>
-                               </oxsl:when>
-                               <oxsl:otherwise>
-                                       <m:apply>
-                                               <m:csymbol>app</m:csymbol>
-                                               <oxsl:apply-templates select="{$param}" mode="{@mode}"/>
-                                               <m:ci>
-                                                       <xsl:value-of select="@bvar"/>
-                                               </m:ci>
-                                       </m:apply>
-                               </oxsl:otherwise>
-                       </oxsl:choose>
-               </xsl:when>
-               <xsl:otherwise>
-                       <oxsl:apply-templates select="{$param}" mode="{@mode}"/>
-               </xsl:otherwise>
-       </xsl:choose>
-</xsl:template>
-
-<xsl:template match="m:*">
-       <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:param name="const" select="'false'"/>
-       
-       <xsl:copy>
-               <xsl:call-template name="copy_attributes">
-                       <xsl:with-param name="c-tag" select="$c-tag"/>
-                       <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:apply-templates>
-                       <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"/>
-                       <xsl:with-param name="const" select="$const"/>
-               </xsl:apply-templates>
-       </xsl:copy>
-</xsl:template>
-
-<xsl:template match="mbvar">
-       <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:param name="const" select="'false'"/>
-
-       <xsl:variable name="binded_params">
-               <xsl:call-template name="get_binded_params">
-                       <xsl:with-param name="var"  select="@name"/>
-                       <xsl:with-param name="node" select="following-sibling::*"/>
-               </xsl:call-template>
-       </xsl:variable>
-
-       <xsl:variable name="test">
-               <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:choose>
-               <xsl:when test="$binded_params != ''">
-                       <oxsl:variable name="{concat('bvar_',@name)}">
-                               <oxsl:choose>
-                                       <!-- one or more lambdas exist -->
-                                       <oxsl:when test="{$test}">
-                                               <xsl:choose>
-                                                       <!-- binded params > 1 (more than 1 lambda) -->
-                                                       <xsl:when test="contains($binded_params,'+')">
-                                                               <oxsl:variable name="binder">
-                                                                       <oxsl:choose>
-                                                                               <xsl:call-template name="out_choose_binder">
-                                                                                       <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:call-template name="insert_subscript">
-                                                                       <oxsl:with-param name="node_value" select="$binder"/>
-                                                               </oxsl:call-template>
-                                                       </xsl:when>
-                                                       <!-- binded parms = 1 (1 lambda) -->
-                                                       <xsl:otherwise>
-                                                               <xsl:variable name="param">
-                                                                       <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>
-                                                       
-                                                               <oxsl:call-template name="insert_subscript">
-                                                                       <oxsl:with-param name="node_value" select="{concat($param,$binder)}"/>
-                                                               </oxsl:call-template>
-                                                       </xsl:otherwise>
-                                               </xsl:choose>
-                                       </oxsl:when>
-                                       <!-- no one lambda -->
-                                       <oxsl:otherwise>
-                                               <xsl:value-of select="@name"/>
-                                       </oxsl:otherwise>
-                               </oxsl:choose>
-                       </oxsl:variable>
-
-                       <m:bvar>
-                               <m:ci>
-                                       <oxsl:value-of select="{concat('$bvar_',@name)}"/>
-                               </m:ci>
-                               <xsl:apply-templates>
-                                       <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"/>
-                                       <xsl:with-param name="const" select="$const"/>
-                               </xsl:apply-templates>
-                       </m:bvar>
-               </xsl:when>
-               <xsl:otherwise>
-                       <m:bvar>
-                               <m:ci>
-                                       <xsl:value-of select="@name"/>
-                               </m:ci>
-                               <xsl:apply-templates>
-                                       <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"/>
-                                       <xsl:with-param name="const" select="$const"/>
-                               </xsl:apply-templates>
-                       </m:bvar>
-               </xsl:otherwise>
-       </xsl:choose>
-</xsl:template>
-
-<xsl:template match="mvar">
-       <xsl:call-template name="out_mvar">
-               <xsl:with-param name="vname" select="@name"/>
-       </xsl:call-template>
-</xsl:template>
-
-
-
-<!-- *********************************************************************** -->
-<!--                          AUXILIARY FUNCTIONS                            -->
-<!-- *********************************************************************** -->
-
-
-<!-- Returns a value if all uris in the list have the same c-tag  -->
-<xsl:template name="get_c_tag">
-       <xsl:param name="uri" select="''"/>
-       
-       <xsl:if test="$uri != ''">
-               <xsl:choose>
-                       <xsl:when test="contains($uri,'|')">
-                               <xsl:variable name="c-tag1">
-                                       <xsl:call-template name="get_c_tag">
-                                               <xsl:with-param name="uri" select="substring-before($uri,'|')"/>
-                                       </xsl:call-template>
-                               </xsl:variable>
-                       
-                               <xsl:variable name="c-tag2">
-                                       <xsl:call-template name="get_c_tag">
-                                               <xsl:with-param name="uri" select="substring-after($uri,'|')"/>
-                                       </xsl:call-template>
-                               </xsl:variable>
-
-                               <xsl:if test="$c-tag1 = $c-tag2">
-                                       <xsl:value-of select="$c-tag1"/>
-                               </xsl:if>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <xsl:choose>
-                                       <xsl:when test="substring($uri,string-length($uri)-3) = '.con'">CONST</xsl:when>
-                                       <xsl:when test="substring($uri,string-length($uri)-3) = '.ind'">MUTIND</xsl:when>
-                               </xsl:choose>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:if>
-</xsl:template>
-
-<!-- Creates a list selecting uris according to c-tag specified -->
-<xsl:template name="select_uris">
-       <xsl:param name="uris" select="''"/>
-       <xsl:param name="c-tag"/>
-
-       <xsl:if test="$uris != ''">
-               <xsl:choose>
-                       <xsl:when test="contains($uris,'|')">
-                               <xsl:variable name="list1">
-                                       <xsl:call-template name="select_uris">
-                                               <xsl:with-param name="uris"  select="substring-before($uris,'|')"/>
-                                               <xsl:with-param name="c-tag" select="$c-tag"/>
-                                       </xsl:call-template>
-                               </xsl:variable>
-
-                               <xsl:variable name="list2">
-                                       <xsl:call-template name="select_uris">
-                                               <xsl:with-param name="uris"  select="substring-after($uris,'|')"/>
-                                               <xsl:with-param name="c-tag" select="$c-tag"/>
-                                       </xsl:call-template>
-                               </xsl:variable>
-
-                               <xsl:choose>
-                                       <xsl:when test="$list1 != '' and $list2 != ''">
-                                               <xsl:value-of select="concat($list1,'|',$list2)"/>
-                                       </xsl:when>
-                                       <xsl:when test="$list1 != '' and $list2 = ''">
-                                               <xsl:value-of select="$list1"/>
-                                       </xsl:when>
-                                       <xsl:when test="$list1 = '' and $list2 != ''">
-                                               <xsl:value-of select="$list2"/>
-                                       </xsl:when>
-                               </xsl:choose>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <xsl:variable name="c-tag1">
-                                       <xsl:call-template name="get_c_tag">
-                                               <xsl:with-param name="uri" select="$uris"/>
-                                       </xsl:call-template>
-                               </xsl:variable>
-
-                               <xsl:if test="$c-tag1 = $c-tag">
-                                       <xsl:value-of select="$uris"/>
-                               </xsl:if>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:if>
-</xsl:template>
-
-<!-- Returns a xpath expression matching on uri attributes -->
-<xsl:template name="test_on_uris">
-       <xsl:param name="uris" select="''"/>
-
-       <xsl:if test="$uris != ''">
-               <xsl:choose>
-                       <xsl:when test="contains($uris,'|')">
-                               <xsl:variable name="expr1">
-                                       <xsl:call-template name="test_on_uris"> 
-                                               <xsl:with-param name="uris" select="substring-before($uris,'|')"/>
-                                       </xsl:call-template>
-                               </xsl:variable>
-
-                               <xsl:variable name="expr2">
-                                       <xsl:call-template name="test_on_uris"> 
-                                               <xsl:with-param name="uris" select="substring-after($uris,'|')"/>
-                                       </xsl:call-template>
-                               </xsl:variable>
-
-                               <xsl:value-of select="concat($expr1,' or ',$expr2)"/>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <xsl:value-of select="concat('@uri=',&quot;'&quot;,$uris,&quot;'&quot;)"/>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:if>
-</xsl:template>
-
-<!-- Returns a xpath expression testing on LAMBDA node existence -->
-<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:choose>
-                       <xsl:when test="contains($binded_params,'+')">
-                               <xsl:variable name="expr1">
-                                       <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:variable name="expr2">
-                                       <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:value-of select="concat($expr1,' or ',$expr2)"/>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <xsl:variable name="param">
-                                       <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:value-of select="concat('name(',$param,') = ',&quot;'LAMBDA'&quot;)"/>                             
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:if>
-</xsl:template>
-
-<!-- Removes white spaces from uris list -->
-<xsl:template name="remove_white_spaces">
-       <xsl:param name="uri" select="''"/>
-
-       <xsl:if test="$uri != ''">
-               <xsl:choose>
-                       <xsl:when test="contains($uri,'|')">
-                               <xsl:variable name="uri1">
-                                       <xsl:call-template name="remove_white_spaces">
-                                               <xsl:with-param name="uri" select="substring-before($uri,'|')"/>
-                                       </xsl:call-template>
-                               </xsl:variable>
-
-                               <xsl:variable name="uri2">
-                                       <xsl:call-template name="remove_white_spaces">
-                                               <xsl:with-param name="uri" select="substring-after($uri,'|')"/>
-                                       </xsl:call-template>
-                               </xsl:variable>
-
-                               <xsl:value-of select="concat($uri1,'|',$uri2)"/>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <xsl:value-of select="normalize-space($uri)"/>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:if>
-</xsl:template>
-
-<!-- 
-       Returns a list of params id attributes concatenated with '+'.
-       The params'id attribute are selected according to the value of bindig variable 'var'  
- -->
-<xsl:template name="get_binded_params">
-       <xsl:param name="var"/>
-       <xsl:param name="node"/>
-
-       <xsl:if test="count($node) != 0">
-               <xsl:choose>
-                       <!-- another variable declaration with same name -->
-                       <xsl:when test="($node[1][name() = 'mbvar']) and ($node[1][@name = $var])"></xsl:when>
-                       <!-- a binded param -->
-                       <xsl:when test="($node[1][name() = 'param']) and ($node[1][@bvar = $var])">
-                               <!-- search on siblings -->
-                               <xsl:variable name="siblings_params">
-                                       <xsl:call-template name="get_binded_params">
-                                               <xsl:with-param name="var"  select="$var"/>
-                                               <xsl:with-param name="node" select="$node[position() > 1]"/>
-                                       </xsl:call-template>
-                               </xsl:variable>
-                               <xsl:choose>
-                                       <xsl:when test="$siblings_params != ''">
-                                               <xsl:value-of select="concat($node[1]/@id,'+',$siblings_params)"/>
-                                       </xsl:when>
-                                       <xsl:otherwise> 
-                                               <xsl:value-of select="$node[1]/@id"/>
-                                       </xsl:otherwise>
-                               </xsl:choose>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <!-- search on siblings -->
-                               <xsl:variable name="siblings_params">
-                                       <xsl:call-template name="get_binded_params">
-                                               <xsl:with-param name="var"  select="$var"/>
-                                               <xsl:with-param name="node" select="$node[position() > 1]"/>
-                                       </xsl:call-template>
-                               </xsl:variable>
-                               <!-- search on children -->
-                               <xsl:variable name="children_params">
-                                       <xsl:call-template name="get_binded_params">
-                                               <xsl:with-param name="var"  select="$var"/>
-                                               <xsl:with-param name="node" select="$node[1]/child::*"/>
-                                       </xsl:call-template>
-                               </xsl:variable>
-
-                               <xsl:choose>
-                                       <xsl:when test="$children_params != '' and $siblings_params != ''">
-                                               <xsl:value-of select="concat($children_params,'+',$siblings_params)"/>
-                                       </xsl:when>
-                                       <xsl:when test="$children_params != '' and $siblings_params = ''">
-                                               <xsl:value-of select="$children_params"/>
-                                       </xsl:when>
-                                       <xsl:when test="$children_params = '' and $siblings_params != ''">
-                                               <xsl:value-of select="$siblings_params"/>
-                                       </xsl:when>     
-                               </xsl:choose>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:if>
-</xsl:template>
-
-<!-- Returns a xpath string with the location of the parameter with the id specified -->
-<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: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="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="c-tag"     select="$c-tag"/>
-               <xsl:with-param name="const"     select="$const"/>
-       </xsl:call-template>
-</xsl: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="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="c-tag"     select="$c-tag"/>
-               <xsl:with-param name="const"     select="$const"/>
-       </xsl:call-template>
-</xsl:template>
-       
-
-<!-- Returns a xpath string with the location of the operator uri or id attribute -->
-<xsl:template name="op_attr">
-       <xsl:param name="attr_type"/>
-       <xsl:param name="not"  select="'false'"/>
-       <xsl:param name="c-tag"/>
-       <xsl:param name="const" select="'false'"/>
-
-       <xsl:variable name="apply">
-               <xsl:if test="$not = 'true'">APPLY/</xsl:if>
-       </xsl:variable>
-       
-       <xsl:choose>
-               <xsl:when test="$const = 'true'">
-                       <xsl:value-of select="concat('{',$attr_type,'}')"/>     
-               </xsl:when>
-               <xsl:otherwise>
-                       <xsl:value-of select="concat('{',$apply,$c-tag,'/',$attr_type,'}')"/>                   
-               </xsl:otherwise>
-       </xsl:choose>
-</xsl:template>
-
-<xsl:template name="copy_attributes">
-       <xsl:param name="c-tag"/>
-       <xsl:param name="hide"   select="0"/>
-       <xsl:param name="arity"  select="0"/>
-       <xsl:param name="not"    select="'false'"/>
-       <xsl:param name="const"  select="'false'"/>
-       <xsl:param name="ignore" select="''"/>
-       
-       <xsl:variable name="test">
-               <xsl:call-template name="test_on_attributes">
-                       <xsl:with-param name="names" select="$ignore"/>
-               </xsl:call-template>
-       </xsl:variable>
-       
-       <xsl:for-each select="@*">
-               <xsl:if test="contains($test,concat('+',name(),'+')) = false()">
-                       <xsl:variable name="name">
-                               <xsl:choose>
-                                       <xsl:when test="name() = 'xref'">helm:xref</xsl:when>
-                                       <xsl:otherwise>
-                                               <xsl:value-of select="name()"/>
-                                       </xsl:otherwise>
-                               </xsl:choose>
-                       </xsl:variable>
-                       
-                       <xsl:attribute name="{$name}">
-                               <xsl:call-template name="set_attribute">
-                                       <xsl:with-param name="attr"  select="."/>
-                                       <xsl:with-param name="c-tag" select="$c-tag"/>
-                                       <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:attribute>
-               </xsl:if>
-       </xsl:for-each>
-</xsl:template>
-
-<xsl:template name="test_on_attributes">
-       <xsl:param name="names" select="''"/>
-
-       <xsl:choose>
-               <xsl:when test="contains($names,'+')">
-                       <xsl:variable name="name">
-                               <xsl:call-template name="test_on_attributes">
-                                       <xsl:with-param name="names" select="normalize-space(substring-after($names,'+'))"/>
-                               </xsl:call-template>
-                       </xsl:variable>
-
-                       <xsl:value-of select="concat('+',normalize-space(substring-before($names,'+')),$name)"/>        
-               </xsl:when>
-               <xsl:otherwise>
-                       <xsl:value-of select="concat('+',normalize-space($names),'+')"/>
-               </xsl:otherwise>
-       </xsl:choose>
-</xsl:template>
-
-<xsl:template name="set_attribute">
-       <xsl:param name="attr"/>
-       <xsl:param name="c-tag"/>
-       <xsl:param name="hide"  select="0"/>
-       <xsl:param name="arity" select="0"/>
-       <xsl:param name="not"   select="'false'"/>
-       <xsl:param name="const" select="'false'"/>
-       
-       <xsl:choose>
-               <xsl:when test="$attr = '$APP-ID'">
-                       <xsl:if test="$const = 'false'">{@id}</xsl:if>
-               </xsl:when>
-               <xsl:when test="$attr = '$OP-ID' or $attr = '$OP-URI'">
-                       <xsl:variable name="attr_type">
-                               <xsl:choose>
-                                       <xsl:when test="$attr = '$OP-ID'">@id</xsl:when>
-                                       <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="c-tag"     select="$c-tag"/>
-                               <xsl:with-param name="const"     select="$const"/>
-                       </xsl:call-template>
-               </xsl:when>
-               <xsl:otherwise>
-                       <xsl:value-of select="$attr"/>
-               </xsl:otherwise>
-       </xsl:choose>
-</xsl:template>
-
-</xsl:stylesheet>