Subject: file
To: None <netbsd-docs@NetBSD.org>
From: Rui Paulo <rpaulo@NetBSD.org>
List: netbsd-docs
Date: 07/03/2005 15:13:18
Hi,
What about extending our current XSL to match <cvsweb> tags?
Syntax:
<cvsweb dir="src">build.sh</cvsweb>
<cvsweb dir="src" rev="1.1">build.sh</cvsweb>
I've implemented it in the following way (I'm not sure if it's the best one):
Index: netbsd.xsl
===================================================================
RCS file: /cvsroot/htdocs/share/xsl/netbsd.xsl,v
retrieving revision 1.7
diff -u -r1.7 netbsd.xsl
--- netbsd.xsl 12 Apr 2005 13:57:15 -0000 1.7
+++ netbsd.xsl 3 Jul 2005 14:10:46 -0000
@@ -50,5 +50,27 @@
</a>
</xsl:template>
+ <!-- link to CVSWeb -->
+ <xsl:template match="cvsweb">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:text>http://cvsweb.NetBSD.org/bsdweb.cgi/</xsl:text>
+ <xsl:value-of select="@dir"/>
+ <xsl:value-of select="."/>
+ <xsl:choose>
+ <xsl:when test="string-length(@rev) != 0">
+ <xsl:text>?rev=</xsl:text>
+ <xsl:value-of select="@rev"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>?rev=HEAD</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>&content-type=text/x-cvsweb-markup</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of select="."/>
+ </a>
+ </xsl:template>
+
</xsl:stylesheet>
-- Rui Paulo