Dave Perrett

Styling Subversion Listings With Xslt

linux, programming, version control, web

The default Apache mod_dav_svn listings are a little bland, but luckily you can use the SVNIndexXSLT Apache directive to spice things up a bit. I’ve been using a slightly modified version of the fantastic ReposStyle XSLT styles.

Assuming you’ve already set up subversion , download the latest ReposStyle from here and drop it in the document root, and configure Apache something like this :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<VirtualHost *:80>
    ServerName your_domain.com
    ServerAlias www.your_domain.com

    DocumentRoot /var/www/your_domain.com

    <Location /svn/>
        DAV svn
        SVNParentPath /var/lib/subversion/repositories/
        SVNListParentPath on
        SVNIndexXSLT "/repos-web/view/repos.xsl"
    </Location>

</VirtualHost>

… which looks something like this :

If you make a ReposStyle SVN repository of your own, and set up SVN so it serves from the root folder (eg. http://www.daveperrett.com/svn/ ), you can actually serve ReposStyle from within the subversion repository itself :

1
2
3
4
5
6
7
8
9
10
11
<VirtualHost *:80>
    ServerName svn.your_domain.com

    <Location />
        DAV svn
        SVNParentPath /var/lib/subversion/repositories/
        SVNListParentPath on
        SVNIndexXSLT "/repos-web/view/repos.xsl"
    </Location>

</VirtualHost>

Configuring in this way will serve the style directly from subversion, although you may need to set the svn:mime-type properties for the XSL file.