1 <?xml version=
"1.0" encoding=
"utf-8"?>
4 template for converting darcs' `changes` output from XML to XHTML. This
5 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
15 <patch author="" date="" localdate="" inverted="" hash="">
20 <xsl:stylesheet version=
"1.0"
21 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
22 xmlns:
str=
"http://exslt.org/strings">
24 <xsl:include href=
"common.xslt"/>
26 <xsl:template match=
"path">
28 patches applied to
<span class=
"path"><a href=
"{$cgi-program}">projects
</a></span> /
<span class=
"path"><xsl:apply-templates/></span>
33 <xsl:template match=
"changelog">
37 <a class=
"sort" href=
"{$command}?c=patches&s=name">name
</a>
38 <a class=
"revsort" href=
"{$command}?c=patches&s=revname"> (rev)
</a>
41 <a class=
"sort" href=
"{$command}?c=patches&s=date">date
</a>
42 <a class=
"revsort" href=
"{$command}?c=patches&s=revdate"> (rev)
</a>
45 <a class=
"sort" href=
"{$command}?c=patches&s=author">author
</a>
46 <a class=
"revsort" href=
"{$command}?c=patches&s=revauthor"> (rev)
</a>
53 <xsl:when test=
"$sort-by = 'name'">
55 <xsl:sort select=
"name"/>
56 </xsl:apply-templates>
58 <xsl:when test=
"$sort-by = 'revname'">
60 <xsl:sort select=
"name" order=
"descending"/>
61 </xsl:apply-templates>
63 <xsl:when test=
"$sort-by = 'date'">
65 <xsl:sort select=
"@date"/>
66 </xsl:apply-templates>
68 <xsl:when test=
"$sort-by = 'revdate'">
70 <xsl:sort select=
"@date" order=
"descending"/>
71 </xsl:apply-templates>
73 <xsl:when test=
"$sort-by = 'author'">
75 <xsl:sort select=
"@author"/>
76 </xsl:apply-templates>
78 <xsl:when test=
"$sort-by = 'revauthor'">
80 <xsl:sort select=
"@author" order=
"descending"/>
81 </xsl:apply-templates>
84 <!-- use the repository's natural order -->
85 <xsl:apply-templates/>
91 <xsl:template match=
"patch">
92 <xsl:variable name=
"author" select=
"@author"/>
93 <xsl:variable name=
"hash" select=
"@hash"/>
94 <xsl:variable name=
"name" select=
"name"/>
95 <xsl:variable name=
"repo" select=
"/darcs/@repository"/>
97 <xsl:variable name=
"created-as" select=
"/darcs/changelog/created_as"/>
98 <xsl:variable name=
"creator-hash" select=
"$created-as/patch/@hash"/>
99 <xsl:variable name=
"original-name" select=
"$created-as/@original_name"/>
101 <xsl:variable name=
"annotate-href">
102 <xsl:value-of select=
"$command"/>?c=annotate
&p=
<xsl:value-of select=
"$hash"/>
104 <xsl:if test=
"$creator-hash">&ch=
<xsl:value-of select=
"$creator-hash"/></xsl:if>
105 <xsl:if test=
"$original-name">&o=
<xsl:value-of select=
"$original-name"/></xsl:if>
109 <td><a href=
"{$annotate-href}"><xsl:value-of select=
"name"/></a></td>
110 <td><xsl:value-of select=
"@local_date"/></td>
112 <a href=
"mailto:{$author}"><xsl:value-of select=
"$author"/></a>
115 <a href=
"{$cgi-program}/{$repo}/?c=annotate&p={$hash}">detail
</a>
118 <xsl:apply-templates/>
121 <!-- ignore <created_as>, <name> and <comment> children of <patch> -->
122 <xsl:template match=
"created_as"/>
123 <xsl:template match=
"name"/>
124 <xsl:template match=
"comment"/>