Hosting Subversion XSLT Styling Files From A Repository

Author: Steven Neiland
Published:

Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

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.

<VirtualHost *:80>
ServerName svn.yourdomain.com

<Location />
DAV svn
SVNParentPath "C:/svn_repository/"
SVNListParentPath on
SVNIndexXSLT "/svnstyling/svnindex.xsl"
---snip---
</Location>

</VirtualHost>

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.

Related Blog Postings

Reader Comments

  • Please keep comments on-topic.
  • Please do not post unrelated questions or large chunks of code.
  • Please do not engage in flaming/abusive behaviour.
  • Comments that contain advertisments or appear to be created for the purpose of link building, will not be published.

Archives Blog Listing