+<!-- The next function is used to quote URIs to embed them in an URL -->
+<xsl:template name="quote_url">
+ <xsl:param name="s" select="''"/>
+ <xsl:param name="news" select="''"/>
+ <xsl:choose>
+ <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="char" select="substring($s,1,1)"/>
+ <xsl:choose>
+ <xsl:when test="$char = '#'">
+ <xsl:call-template name="quote_url">
+ <xsl:with-param name="s" select="substring($s,2)"/>
+ <xsl:with-param name="news" select="concat($news,'%23')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="quote_url">
+ <xsl:with-param name="s" select="substring($s,2)"/>
+ <xsl:with-param name="news" select="concat($news,$char)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="RDFURI_of_CICURI">
+ <xsl:param name="uri" select="''"/>
+ <xsl:variable name="base_RDF_URI" select="'helm:rdf:www.cs.unibo.it/helm/rdf/backward//'"/>
+ <xsl:variable name="before" select="substring-before($uri,'#xpointer(1/')"/>
+ <xsl:value-of select="$base_RDF_URI"/>
+ <xsl:choose>
+ <xsl:when test="$before=''">
+ <xsl:value-of select="$uri"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($before,',')"/>
+ <xsl:variable name="after" select="substring-after($uri,'#xpointer(1/')"/>
+ <xsl:value-of select="translate(substring-before($after,')'),'/',',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+