[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Web XML output question

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2002-12-30 14:48:34 CET

Damir Dezeljin <programing@mbss.org> writes:

> Now I want to set up a fancy web view of the repository HEAD just
> line the XML view on http://svn.collab.net/repos/svn-xml/ . I
> searched this site and find an xslt script and a css stype sheet
> (I'm not shure I need this), but I can't figure out how to put this
> to work in my apache2 config (I'm reading the Apache docs, but I
> don't find any usefull thing ;) ). Can someone give me a hint (hehe
> ... maybe a copy/paste of svn.collab.net apache config ;)

Hmmm, is this feature documented anywhere at all?

On svn.collab.net, we have two Locations set up:

# Normal access via browser or deltaV client
<Location /repos/svn>
        DAV svn
        SVNPath /path/to/svn/repository
        SetOutputFilter DEFLATE
        AuthType Basic
        AuthName "Subversion repository"
        AuthUserFile /path/to/svn-user-file
        <LimitExcept GET PROPFIND OPTIONS REPORT>
          require valid-user
        </LimitExcept>
</Location>

# This exists for XML browsing only
<Location /repos/svn-xml>
        DAV svn
        SVNIndexXSLT "/svnindex.xsl"
        SVNPath /path/to/svn/repository
        AuthType Basic
        AuthName "Subversion repository"
        AuthUserFile /path/tosvn-user-file
        <LimitExcept GET>
          Order deny,allow
          Deny from all
        </LimitExcept>
</Location>

Our xsl sheet looks like:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:output method="html"/>

  <xsl:template match="*"/>

  <xsl:template match="svn">
    <html>
      <head>
        <title>
          <xsl:if test="string-length(index/@name) != 0">
            <xsl:value-of select="index/@name"/>
            <xsl:text>: </xsl:text>
          </xsl:if>
          <xsl:value-of select="index/@path"/>
        </title>
        <link rel="stylesheet" type="text/css" href="/svnindex.css"/>
      </head>
      <body>
        <div class="svn">
          <xsl:apply-templates/>
        </div>
        <div class="footer">
          <xsl:text>Powered by </xsl:text>
          <xsl:element name="a">
            <xsl:attribute name="href">
              <xsl:value-of select="@href"/>
            </xsl:attribute>
            <xsl:text>Subversion</xsl:text>
          </xsl:element>
          <xsl:text> </xsl:text>
          <xsl:value-of select="@version"/>
        </div>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="index">
    <div class="rev">
      <xsl:if test="string-length(@name) != 0">
        <xsl:value-of select="@name"/>
        <xsl:if test="string-length(@rev) != 0">
          <xsl:text> &#8212; </xsl:text>
        </xsl:if>
      </xsl:if>
      <xsl:if test="string-length(@rev) != 0">
        <xsl:text>Revision </xsl:text>
        <xsl:value-of select="@rev"/>
      </xsl:if>
    </div>
    <div class="path">
      <xsl:value-of select="@path"/>
    </div>
    <xsl:apply-templates select="updir"/>
    <xsl:apply-templates select="dir"/>
    <xsl:apply-templates select="file"/>
  </xsl:template>

  <xsl:template match="updir">
    <div class="updir">
      <xsl:text>[</xsl:text>
      <xsl:element name="a">
        <xsl:attribute name="href">..</xsl:attribute>
        <xsl:text>Parent Directory</xsl:text>
      </xsl:element>
      <xsl:text>]</xsl:text>
    </div>
    <!-- xsl:apply-templates/ -->
  </xsl:template>

  <xsl:template match="dir">
    <div class="dir">
      <xsl:element name="a">
        <xsl:attribute name="href">
          <xsl:value-of select="@href"/>
        </xsl:attribute>
        <xsl:value-of select="@name"/>
        <xsl:text>/</xsl:text>
      </xsl:element>
    </div>
    <!-- <xsl:apply-templates/ -->
  </xsl:template>

  <xsl:template match="file">
    <div class="file">
     <xsl:element name="a">
        <xsl:attribute name="href">
          <xsl:value-of select="@href"/>
        </xsl:attribute>
        <xsl:value-of select="@name"/>
      </xsl:element>
    </div>
    <!-- xsl:apply-templates/ -->
  </xsl:template>

</xsl:stylesheet>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Dec 30 14:51:18 2002

This is an archived mail posted to the Subversion Dev mailing list.