+++ /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>
-
-</xsl:stylesheet>
-
-
-
-
-
-