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

[PATCH] tools/xslt/svnindex.xsl and tools/xslt/svnindex.css

From: Ævar Arnfjörð Bjarmason <avar_at_simnet.is>
Date: 2004-02-11 18:26:37 CET

I've sent this one in before, however it seems some people mi-understood its
purpise, i was pointed to this article:
http://a.mongers.org/clueful/1999-phk-bikeshed becouse people just thought i
re-formatted the XML output to my liking.

Thats not what this is, The reason i modified this file is that its hard to
apply a style to it that doesnt look like the original one, this re-formats the
  XML output, but not just for the sake of re-formatting, its all done to make
it easier to apply CSS styles to the document. Particularly it now generates
more correct <ul>+<li> that are properly nested, having the nice side-affect of
it looking even better if there exists no stylesheet at all.

I do hope somone applies this unlike the old one because it will make it a lot
easier to make a "cute" index page (belive me, i tried) and since thats the
main function of this document that makes this a pretty important patch;)

Also, im sending in a patch to the provided css document, this makes it look
just like the original one but was changed because of subsiquent changes in the
XSL doc.

Again, this is not just a XSL reformat, rest assured that if i just didnt like
the coding style i would be sending in something generated by a for-loop
containing 'indent' ;)

--- /home/share/software/src/subversion/tools/xslt/svnindex.xsl 2004-01-24 17:10:06.000000000 +0000
+++ /home/jeedo/www/projects/svn_style/svnindex.xsl 2004-02-10 01:16:25.000000000 +0000
@@ -15,13 +15,13 @@
           </xsl:if>
           <xsl:value-of select="index/@path"/>
         </title>
- <link rel="stylesheet" type="text/css" href="/svnindex.css"/>
+ <link rel="stylesheet" type="text/css" href="/projects/svn_style/svnindex.css"/>
       </head>
       <body>
         <div class="svn">
           <xsl:apply-templates/>
         </div>
- <div class="footer">
+ <address class="footer">
           <xsl:text>Powered by </xsl:text>
           <xsl:element name="a">
             <xsl:attribute name="href">
@@ -31,13 +31,13 @@
           </xsl:element>
           <xsl:text> </xsl:text>
           <xsl:value-of select="@version"/>
- </div>
+ </address>
       </body>
     </html>
   </xsl:template>
 
   <xsl:template match="index">
- <div class="rev">
+ <h1 class="rev">
       <xsl:if test="string-length(@name) != 0">
         <xsl:value-of select="@name"/>
         <xsl:if test="string-length(@rev) != 0">
@@ -48,50 +48,49 @@
         <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"/>
+ </h1>
+ <ul id="list">
+ <li class="path">
+ <div class="pathname"><xsl:value-of select="@path"/></div>
+ <ul>
+ <xsl:apply-templates select="updir"/>
+ <xsl:apply-templates select="dir"/>
+ <xsl:apply-templates select="file"/>
+ </ul>
+ </li>
+ </ul>
   </xsl:template>
 
   <xsl:template match="updir">
- <div class="updir">
- <xsl:text>[</xsl:text>
+ <li class="updir">
       <xsl:element name="a">
         <xsl:attribute name="href">..</xsl:attribute>
- <xsl:text>Parent Directory</xsl:text>
+ <xsl:text>..</xsl:text>
       </xsl:element>
- <xsl:text>]</xsl:text>
- </div>
- <!-- xsl:apply-templates/ -->
+ </li>
   </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/ -->
+ <li 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>
+ </li>
   </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/ -->
+ <li class="file">
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:value-of select="@href"/>
+ </xsl:attribute>
+ <xsl:value-of select="@name"/>
+ </xsl:element>
+ </li>
   </xsl:template>
 
 </xsl:stylesheet>

--- /home/share/software/src/subversion/tools/xslt/svnindex.css 2004-01-24 17:10:06.000000000 +0000
+++ /home/jeedo/www/projects/svn_style/svnindex.css 2004-02-10 01:16:25.000000000 +0000
@@ -1,21 +1,30 @@
-body{
+body {
   margin: 0;
   padding: 0;
 }
 
-a {
+a:link, a:hover, a:visited, a:hover:visited {
   color: navy;
 }
 
+ul {
+ margin: 0;
+ padding: 0;
+ list-style-type: none;
+}
+
 .footer {
- margin-top: 8em;
- padding: 0.5em 1em 0.5em;
+ width: 100%;
+ margin-top: 8em;
+ bottom: 0;
+ padding: 0.5em 1em 0.5em;
   border: 1px solid;
   border-width: 1px 0;
   clear: both;
   border-color: rgb(30%,30%,50%) navy rgb(75%,80%,85%) navy;
   background: rgb(88%,90%,92%);
   font-size: 80%;
+ font-style: italic;
 }
 
 .svn {
@@ -24,17 +33,26 @@
 
 .rev {
   margin-right: 3px;
+ margin-bottom: 3px;
   padding-left: 3px;
   text-align: left;
   font-size: 120%;
+ font-weight: normal;
+}
+
+#list {
+ margin-top: 0;
+ padding: 0;
 }
 
 .dir a {
+ display: block;
   text-decoration: none;
   color: black;
 }
 
 .file a {
+ display: block;
   text-decoration: none;
   color: black;
 }
@@ -42,43 +60,74 @@
 .path {
   margin: 3px;
   padding: 3px;
- background: #FFCC66;
   font-size: 120%;
 }
 
+.pathname {
+ padding-left: 3px;
+ margin: 3px;
+ background: #fc6;
+ font-size: 120%;
+}
+
+.updir:before {
+ content: "[ ";
+}
+
+.updir:after {
+ content: " ]";
+}
+
 .updir {
   margin: 3px;
   padding: 3px;
   margin-left: 3em;
- background: #FFEEAA;
+ background: #fea;
 }
 
 .file {
   margin: 3px;
   padding: 3px;
- margin-left: 3em;
+ margin-left:3em;
+
   background: rgb(95%,95%,95%);
 }
+
+.file ul {
+ list-style-type: none;
+ margin: 0;
+ padding: 0;
+ border: none;
+}
 
 .file:hover {
   margin: 3px;
   padding: 3px;
   margin-left: 3em;
+
   background: rgb(100%,100%,90%);
-/* border: 1px black solid; */
 }
 
 .dir {
   margin: 3px;
   padding: 3px;
   margin-left: 3em;
+
   background: rgb(90%,90%,90%);
 }
+
+.dir ul {
+ list-style-type: none;
+ margin: 0;
+ padding: 0;
+ border: none;
+}
+
 
 .dir:hover {
   margin: 3px;
   padding: 3px;
- margin-left: 3em;
+ margin-left:3em;
+
   background: rgb(100%,100%,80%);
-/* border: 1px black solid; */
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Feb 11 18:26:52 2004

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.