]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/params.xsl
Brand new implementation based on functors taking a strategy in input.
[helm.git] / helm / style / params.xsl
index 3d16f62e2af2836ce8e52d3cfe106dfee2591f4d..355baef56191355c755db2e628dd4b24122e371c 100644 (file)
 <!-- CSC: PROBLEMA: URI CHE NON CONTENGONO / ED INIZIANO CON cic: -->
 <xsl:template name="name_of_uri">
  <xsl:param name="uri" select="&quot;&quot;"/>
+ <xsl:param name="extension" select="'.con'"/>
  <xsl:variable name="suffix" select="substring-after($uri, &quot;/&quot;)"/>
  <xsl:choose>
   <xsl:when test="$suffix = &quot;&quot;">
    <!-- CSC: PROBLEMA: .con PUO' APPARIRE ALL'INTERNO DELLE URI ===>
      SCRIVERE UNA FUNZIONE RICORSIVA CHE RISOLVA -->
-   <xsl:value-of select="substring-before($uri,&quot;.con&quot;)"/>
+   <xsl:value-of select="substring-before($uri,$extension)"/>
   </xsl:when>
   <xsl:otherwise>
    <xsl:call-template name="name_of_uri">
     <xsl:with-param name="uri" select="$suffix"/>
+    <xsl:with-param name="extension" select="$extension"/> 
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
  </xsl:choose>   
 </xsl:template>
 
+<!-- path gives the path of a uri, up to the final name -->
+<xsl:template name="path">
+ <xsl:param name="uri" select="&quot;&quot;"/>
+ <xsl:param name="current_path" select="&quot;&quot;"/>
+ <xsl:choose>
+  <xsl:when test="(substring-after($uri,&quot;/&quot;) != &quot;&quot;)">
+   <xsl:call-template name="path">
+    <xsl:with-param 
+        name="uri" select="substring-after($uri,&quot;/&quot;)"/>
+    <xsl:with-param
+        name="current_path" select="concat($current_path,substring-before($uri,&quot;/&quot;),'/')"/> 
+   </xsl:call-template>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:value-of select="$current_path"/>
+  </xsl:otherwise>
+ </xsl:choose>   
+</xsl:template>
+
 <xsl:template name="blank_counting">
  <xsl:param name="string" select="&quot;&quot;"/>
  <xsl:param name="counter" select="0"/>