root/lang/xslt/misc/svnlog2atom.xsl @ 1598

Revision 1598, 2.3 kB (checked in by cho45, 6 years ago)

lang/xslt/misc/svnlog2atom.xsl:

Valid な Atom じゃなかったのを修正

Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<?comment
3Usage:
4in zsh (for process replacement)
5xsltproc --stringparam user yoko svnlog2atom.xsl =(svn log --xml -v http://svn.coderepos.org/share/)
6?>
7<xsl:stylesheet version="1.0"
8        xmlns="http://www.w3.org/2005/Atom"
9        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10        exclude-result-prefixes=""
11        xml:lang="ja">
12
13        <xsl:output
14                method="xml"
15                encoding="UTF-8"
16                omit-xml-declaration="no"
17                indent="yes"
18                />
19
20        <xsl:param name="user" select="'cho45'"/>
21        <xsl:param name="trac" select="'http://coderepos.org/share/'"/>
22        <xsl:param name="linkbase" select="'http://coderepos.org/share/wiki/Committers/'"/>
23
24        <xsl:strip-space elements="*" />
25
26        <xsl:template match="/">
27                <feed xmlns="http://www.w3.org/2005/Atom">
28                        <title>User feed of <xsl:value-of select="$user"/></title>
29                        <link href="{$linkbase}{$user}"/>
30                        <updated>
31                                <xsl:for-each select="log/logentry[author = $user]">
32                                        <xsl:sort select="@revision" order="descending" />
33                                        <xsl:if test="position() = 1">
34                                                <xsl:value-of select="date"/>
35                                        </xsl:if>
36                                </xsl:for-each>
37                        </updated>
38                        <author>
39                                <name><xsl:value-of select="$user"/></name>
40                        </author>
41                        <id>
42                                <xsl:value-of select="$linkbase"/>
43                                <xsl:value-of select="$user"/>
44                        </id>
45
46                        <xsl:apply-templates select="log/logentry[author = $user]">
47                                <xsl:sort select="@revision" order="descending" />
48                        </xsl:apply-templates>
49                </feed>
50        </xsl:template>
51
52        <xsl:template match="logentry">
53                <entry>
54                        <title>
55                                <xsl:text>Revision:</xsl:text>
56                                <xsl:value-of select="@revision"/>
57                        </title>
58                        <link href="{$trac}changeset/{@revision}"/>
59                        <id>
60                                <xsl:value-of select="$trac"/>
61                                <xsl:text>changeset/</xsl:text>
62                                <xsl:value-of select="@revision"/>
63                        </id>
64                        <updated><xsl:value-of select="date"/></updated>
65                        <summary>
66                                <xsl:value-of select="msg"/>
67                        </summary>
68                        <content type="xhtml">
69                                <div xmlns="http://www.w3.org/1999/xhtml">
70                                        <ul class="changes">
71                                                <xsl:for-each select="paths/path">
72                                                        <li>
73                                                                <xsl:text>[</xsl:text>
74                                                                <xsl:value-of select="@action"/>
75                                                                <xsl:text>] </xsl:text>
76                                                                <xsl:value-of select="."/>
77                                                        </li>
78                                                </xsl:for-each>
79                                        </ul>
80                                        <pre class="message">
81                                                <xsl:value-of select="msg"/>
82                                        </pre>
83                                </div>
84                        </content>
85                </entry>
86        </xsl:template>
87
88
89</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.