Hosting Subversion XSLT Styling Files From A Repository

Published: {ts '2012-10-09 00:00:00'}
Author: Steven Neiland
Site Url: http://www.neiland.net/article/hosting-subversion-xslt-styling-files-from-a-repository/

In a previous article on subversion I mentioned the use of the svnindex.xsl file to style the repository listing. This file was placed in the root of "yourdomain.com" which was a level above the svn repositories.

However there may arise a situation such as outlined in last weeks posting where you need to host the xslt files from within a repository. Or you may just decide you want to simply because. Not only is this really simple to do, it allows us to version control the svnindex file itself.

Step 1: Create Repository

Lets create a dedicated repository for the svnindex.xml and svnindex.css files. I named my repo "svnstyling". Import the two files into the repo.

Step 2: Call SVNIndexXSLT

Next we set the svnindexxslt directive in the location section of our vhost and restart apache.

ServerName svn.yourdomain.com DAV svn SVNParentPath "C:/svn_repository/" SVNListParentPath on SVNIndexXSLT "/svnstyling/svnindex.xsl" ---snip---

Step 3: Set the mime types

Because we are serving the xsl and css files directly from a subversion repository we need to define the mime types for each file. For the xsl file set the mimetype to "test/xml" and for the css file set the mimetype to "text/css".

$ svn propset svn:mime-type text/xml svnindex.xml $ svn propset svn:mime-type text/css svnindex.css

That's it. Now our repositories have their own dedicated vhost while keeping their nice xslt styling and as a bonus the xsl and associated files are now themselves version controlled.