+++ /dev/null
-<?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">
-
-<!--***********************************************************************-->
-<!-- auxiliary functions -->
-<!-- HELM Group: Asperti, Padovani, Sacerdoti, Schena -->
-<!--***********************************************************************-->
-
-<!--***********************************************************************-->
-<!-- get the name from a URI -->
-<!--***********************************************************************-->
-
-<!-- CSC: PROBLEMA: URI CHE NON CONTENGONO / ED INIZIANO CON cic: -->
-<xsl:template name="name_of_uri">
- <xsl:param name="uri" select=""""/>
- <xsl:variable name="suffix" select="substring-after($uri, "/")"/>
- <xsl:choose>
- <xsl:when test="$suffix = """>
- <!-- CSC: PROBLEMA: .con PUO' APPARIRE ALL'INTERNO DELLE URI ===>
- SCRIVERE UNA FUNZIONE RICORSIVA CHE RISOLVA -->
- <xsl:value-of select="substring-before($uri,".con")"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="name_of_uri">
- <xsl:with-param name="uri" select="$suffix"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<!--***********************************************************************-->
-<!-- erase common prefix from two uris -->
-<!--***********************************************************************-->
-
-<xsl:template name="common_prefix">
- <xsl:param name="first_uri" select=""""/>
- <xsl:param name="second_uri" select=""""/>
- <xsl:choose>
- <xsl:when test="(substring-before($first_uri,"/") =
- substring-before($second_uri,"/") and
- substring-after($second_uri,"/") != "")">
- <xsl:call-template name="common_prefix">
- <xsl:with-param
- name="first_uri" select="substring-after($first_uri,"/")"/>
- <xsl:with-param
- name="second_uri" select="substring-after($second_uri,"/")"/> </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="slash_counting">
- <xsl:with-param name="uri" select="$second_uri"/>
- <xsl:with-param name="counter" select="0"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="slash_counting">
- <xsl:param name="uri" select=""""/>
- <xsl:param name="counter" select="0"/>
- <xsl:choose>
- <xsl:when test="(substring-after($uri,"/") != "")">
- <xsl:call-template name="slash_counting">
- <xsl:with-param
- name="uri" select="substring-after($uri,"/")"/>
- <xsl:with-param
- name="counter" select="$counter +1"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$counter"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="blank_counting">
- <xsl:param name="string" select=""""/>
- <xsl:param name="counter" select="0"/>
- <xsl:choose>
- <xsl:when test="(substring-after($string," ") != "")">
- <xsl:call-template name="blank_counting">
- <xsl:with-param
- name="string" select="substring-after($string," ")"/>
- <xsl:with-param
- name="counter" select="$counter +1"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$counter + 1"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="double_point_counting">
- <xsl:param name="string" select=""""/>
- <xsl:param name="counter" select="0"/>
- <xsl:choose>
- <xsl:when test="(substring-after($string,":") != "")">
- <xsl:call-template name="double_point_counting">
- <xsl:with-param
- name="string" select="substring-after($string,":")"/>
- <xsl:with-param
- name="counter" select="$counter +1"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$counter"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="min">
- <xsl:param name="string" select=""""/>
- <xsl:param name="counter" select="0"/>
- <xsl:choose>
- <xsl:when test="contains($string,concat($counter,":"))
- or (0 > $counter)">
- <xsl:value-of select="$counter"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="min">
- <xsl:with-param
- name="string" select="$string"/>
- <xsl:with-param
- name="counter" select="$counter -1"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="get_no_params">
- <xsl:param name="first_uri" select=""""/>
- <xsl:param name="second_uri" select=""""/>
- <xsl:variable name="offset">
- <xsl:call-template name="common_prefix">
- <xsl:with-param name="first_uri" select="$first_uri"/>
- <xsl:with-param name="second_uri" select="$second_uri"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$offset > 0">
- <xsl:variable name="params">
- <xsl:value-of
- select="document(concat(string($absPath),$second_uri))/*/@params"/>
- </xsl:variable>
- <xsl:variable name="minimum">
- <xsl:call-template name="min">
- <xsl:with-param name="string" select="$params"/>
- <xsl:with-param name="counter" select="$offset - 1"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="0 > $minimum">
- 0
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="relevant_params">
- <!-- the blank after : in the next line is essential -->
- <xsl:value-of
- select="substring-after($params,concat($minimum,": "))"/>
- </xsl:variable>
- <xsl:variable name="tokens">
- <xsl:call-template name="blank_counting">
- <xsl:with-param name="string" select="$relevant_params"/>
- <xsl:with-param name="counter" select="0"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="separators">
- <xsl:call-template name="double_point_counting">
- <xsl:with-param name="string" select="$relevant_params"/>
- <xsl:with-param name="counter" select="0"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:value-of select="$tokens - $separators"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- 0
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-
-<!--***********************************************************************-->
-<!-- Insert a subscript if there is a number at the end of a ci element -->
-<!--***********************************************************************-->
-
-<xsl:template name="insert_subscript">
-<xsl:param name="node_value" select=""""/>
-<xsl:param name="current_pos" select="1"/>
-<xsl:param name="start_pos" select="0"/>
- <xsl:choose>
- <xsl:when test="$current_pos <= string-length(string($node_value))">
- <xsl:variable name="current_char"><xsl:value-of select="substring(string($node_value),$current_pos,1)"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="(string($current_char) != "0") and (string($current_char) != "1") and (string($current_char) != "2") and (string($current_char) != "3") and (string($current_char) != "4") and (string($current_char) != "5") and (string($current_char) != "6") and (string($current_char) != "7") and (string($current_char) != "8") and (string($current_char) != "9")">
- <xsl:choose>
- <xsl:when test="$start_pos != 0">
- <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value" select="$node_value"/><xsl:with-param name="current_pos" select="$current_pos + 1"/><xsl:with-param name="start_pos" select="0"/></xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value" select="$node_value"/><xsl:with-param name="current_pos" select="$current_pos + 1"/><xsl:with-param name="start_pos" select="$start_pos"/></xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$start_pos = 0">
- <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value" select="$node_value"/><xsl:with-param name="current_pos" select="$current_pos + 1"/><xsl:with-param name="start_pos" select="$current_pos"/></xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value" select="$node_value"/><xsl:with-param name="current_pos" select="$current_pos + 1"/><xsl:with-param name="start_pos" select="$start_pos"/></xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$start_pos != 0">
- <m:msub>
- <m:mi><xsl:value-of select="substring(string($node_value),1,$start_pos -1)"/></m:mi>
- <m:mn><xsl:value-of select="substring(string($node_value),$start_pos)"/></m:mn>
- </m:msub>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$node_value"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-
-</xsl:stylesheet>
-
-
-
-
-
-