Follow upstream changes -- Bytestring updates
[git-darcs-import.git] / tools / cgi / xslt / browse.xslt
blobb722a1361a3dddb4d84d0ac42f04795f1bce5be8
1 <?xml version="1.0" encoding="utf-8"?>
3 <!--
4 template for converting a darcs current/ directory listing from XML to
5 XHTML. This template expects the following external variables:
7 cgi-program - path to the CGI executable, to place in links
8 sort-by - field to sort by
9 stylesheet - path to the CSS stylesheet
11 the input XML must have the following structure, aside from what common.xslt
12 expects:
14 <files>
15 <directory name="" modified=""/>
16 <file name="" modified=""/>
17 </files>
18 -->
19 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
20 <xsl:include href="common.xslt"/>
22 <xsl:template match="path">
23 <h1 class="target">
24 files in <span class="path"><a href="{$cgi-program}">projects</a></span> / <span class="path"><xsl:apply-templates/></span>
25 </h1>
26 </xsl:template>
28 <xsl:template match="files">
29 <table>
30 <tr class="browse">
31 <th>
32 <a class="sort" href="{$command}?c=browse&amp;s=name">name</a>
33 <a class="revsort" href="{$command}?c=browse&amp;s=revname"> (rev)</a>
34 </th>
35 <th>
36 <a class="sort" href="{$command}?c=browse&amp;s=ts">modified</a>
37 <a class="revsort" href="{$command}?c=browse&amp;s=revts"> (rev)</a>
38 </th>
39 <th></th>
40 <th></th>
41 </tr>
43 <xsl:choose>
44 <xsl:when test="$sort-by = 'ts'">
45 <xsl:apply-templates>
46 <xsl:sort select="name(self::node())"/>
47 <xsl:sort select="@ts"/>
48 </xsl:apply-templates>
49 </xsl:when>
50 <xsl:when test="$sort-by = 'revts'">
51 <xsl:apply-templates>
52 <xsl:sort select="name(self::node())"/>
53 <xsl:sort select="@ts" order="descending"/>
54 </xsl:apply-templates>
55 </xsl:when>
56 <xsl:when test="$sort-by = 'name'">
57 <xsl:apply-templates>
58 <xsl:sort select="name(self::node())"/>
59 <xsl:sort select="@name"/>
60 </xsl:apply-templates>
61 </xsl:when>
62 <xsl:when test="$sort-by = 'revname'">
63 <xsl:apply-templates>
64 <xsl:sort select="name(self::node())"/>
65 <xsl:sort select="@name" order="descending"/>
66 </xsl:apply-templates>
67 </xsl:when>
68 <xsl:otherwise>
69 <xsl:apply-templates>
70 <xsl:sort select="name(self::node())"/>
71 <xsl:sort select="@name"/>
72 </xsl:apply-templates>
73 </xsl:otherwise>
74 </xsl:choose>
75 </table>
76 </xsl:template>
78 <xsl:template match="directory">
79 <xsl:variable name="name" select="@name"/>
80 <xsl:variable name="type" select="@type"/>
82 <tr class="directory">
83 <td>
84 <a href="{$command}{$name}?c=browse"><xsl:value-of select="@name"/></a>
85 </td>
86 <td><xsl:value-of select="@modified"/></td>
87 <td>
88 <a href="{$command}{$name}?c=annotate">annotate</a>
89 </td>
90 <td>
91 <a href="{$command}{$name}?c=patches">patches</a>
92 </td>
93 </tr>
95 <xsl:apply-templates/>
96 </xsl:template>
98 <xsl:template match="file">
99 <xsl:variable name="name" select="@name"/>
101 <tr class="file">
102 <td><xsl:value-of select="@name"/></td>
103 <td><xsl:value-of select="@modified"/></td>
104 <td><a href="{$command}{$name}?c=annotate">annotate</a></td>
105 <td><a href="{$command}{$name}?c=patches">patches</a></td>
106 </tr>
108 <xsl:apply-templates/>
109 </xsl:template>
110 </xsl:stylesheet>