You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by je...@apache.org on 2002/11/22 12:36:39 UTC
cvs commit: xml-forrest/src/resources/skins/common/xslt/html book2menu.xsl pathutils.xsl
jefft 2002/11/22 03:36:38
Modified: src/resources/skins/common/xslt/html book2menu.xsl
pathutils.xsl
Log:
A proper fix for the common-prefix problem
Revision Changes Path
1.5 +15 -3 xml-forrest/src/resources/skins/common/xslt/html/book2menu.xsl
Index: book2menu.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/skins/common/xslt/html/book2menu.xsl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- book2menu.xsl 22 Nov 2002 11:16:09 -0000 1.4
+++ book2menu.xsl 22 Nov 2002 11:36:38 -0000 1.5
@@ -48,14 +48,14 @@
<!-- Use apply-imports when overriding -->
<xsl:variable name="href-noext">
- <xsl:call-template name="filename-noext">
+ <xsl:call-template name="path-noext">
<xsl:with-param name="path" select="@href"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<!-- Compare with extensions stripped -->
- <xsl:when test="$href-noext = $filename-noext">
+ <xsl:when test="$href-noext = $path-noext">
<xsl:call-template name="selected"/>
</xsl:when>
<xsl:otherwise>
@@ -75,6 +75,18 @@
<xsl:variable name="filename-noext">
<xsl:call-template name="filename-noext">
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="path-noext">
+ <xsl:call-template name="path-noext">
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="dirname">
+ <xsl:call-template name="dirname">
<xsl:with-param name="path" select="$path"/>
</xsl:call-template>
</xsl:variable>
1.2 +18 -1 xml-forrest/src/resources/skins/common/xslt/html/pathutils.xsl
Index: pathutils.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/skins/common/xslt/html/pathutils.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pathutils.xsl 16 Nov 2002 20:58:12 -0000 1.1
+++ pathutils.xsl 22 Nov 2002 11:36:38 -0000 1.2
@@ -97,6 +97,20 @@
<xsl:value-of select="substring($filename, 1, string-length($filename) - string-length($ext))"/>
</xsl:template>
+<!-- Returns a path with the filename stripped of its last extension.
+Examples:
+'foo/bar/index.dtdx.html' -> 'foo/bar/index.dtdx'
+-->
+<xsl:template name="path-noext">
+ <xsl:param name="path"/>
+ <xsl:variable name="ext">
+ <xsl:call-template name="ext">
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring($path, 1, string-length($path) - string-length($ext))"/>
+</xsl:template>
+
<!--
Uncomment this to test.
Usage: saxon pathutils.xsl pathutils.xsl path=foo/bar
@@ -115,6 +129,9 @@
<xsl:with-param name="path" select="$path"/>
</xsl:call-template>
filename-noext= <xsl:call-template name="filename-noext">
+ <xsl:with-param name="path" select="$path"/>
+ </xsl:call-template>
+ path-noext= <xsl:call-template name="path-noext">
<xsl:with-param name="path" select="$path"/>
</xsl:call-template>
</xsl:message>