| 1 | <?xml version="1.0" encoding="UTF-8"?> |
|---|
| 2 | <?comment |
|---|
| 3 | Usage: |
|---|
| 4 | in zsh (for process replacement) |
|---|
| 5 | xsltproc --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="uribase" select="'http://coderepos.org/'"/> |
|---|
| 22 | <xsl:param name="trac" select="concat($uribase, 'share/')"/> |
|---|
| 23 | <xsl:param name="linkbase" select="concat($trac, 'wiki/Committers/')"/> |
|---|
| 24 | |
|---|
| 25 | <xsl:strip-space elements="*"/> |
|---|
| 26 | |
|---|
| 27 | <xsl:template match="/"> |
|---|
| 28 | <feed xmlns="http://www.w3.org/2005/Atom"> |
|---|
| 29 | <title>User feed of <xsl:value-of select="$user"/></title> |
|---|
| 30 | <link href="{$linkbase}{$user}" type="application/atom+xml"/> |
|---|
| 31 | <updated> |
|---|
| 32 | <xsl:for-each select="log/logentry[author = $user]"> |
|---|
| 33 | <xsl:sort select="@revision" order="descending" data-type="number"/> |
|---|
| 34 | <xsl:if test="position() = 1"> |
|---|
| 35 | <xsl:value-of select="date"/> |
|---|
| 36 | </xsl:if> |
|---|
| 37 | </xsl:for-each> |
|---|
| 38 | </updated> |
|---|
| 39 | <author> |
|---|
| 40 | <name><xsl:value-of select="$user"/></name> |
|---|
| 41 | <uri> |
|---|
| 42 | <xsl:value-of select="$linkbase"/> |
|---|
| 43 | <xsl:value-of select="$user"/> |
|---|
| 44 | </uri> |
|---|
| 45 | </author> |
|---|
| 46 | <id> |
|---|
| 47 | <xsl:value-of select="$linkbase"/> |
|---|
| 48 | <xsl:value-of select="$user"/> |
|---|
| 49 | </id> |
|---|
| 50 | <generator uri="http://svn.coderepos.org/share/lang/xslt/misc/svnlog2atom.xsl">Subversion with XSLT (svnlog2atom.xsl)</generator> |
|---|
| 51 | |
|---|
| 52 | <xsl:apply-templates select="log/logentry[author = $user]"> |
|---|
| 53 | <xsl:sort select="@revision" order="descending" data-type="number"/> |
|---|
| 54 | </xsl:apply-templates> |
|---|
| 55 | </feed> |
|---|
| 56 | </xsl:template> |
|---|
| 57 | |
|---|
| 58 | <xsl:template match="logentry"> |
|---|
| 59 | <xsl:if test="position() < 20"> |
|---|
| 60 | <entry> |
|---|
| 61 | <title> |
|---|
| 62 | <xsl:text>Revision:</xsl:text> |
|---|
| 63 | <xsl:value-of select="@revision"/> |
|---|
| 64 | </title> |
|---|
| 65 | <link href="{$trac}changeset/{@revision}" type="text/html"/> |
|---|
| 66 | <id> |
|---|
| 67 | <xsl:value-of select="$trac"/> |
|---|
| 68 | <xsl:text>changeset/</xsl:text> |
|---|
| 69 | <xsl:value-of select="@revision"/> |
|---|
| 70 | </id> |
|---|
| 71 | <updated><xsl:value-of select="date"/></updated> |
|---|
| 72 | <summary> |
|---|
| 73 | <xsl:value-of select="msg"/> |
|---|
| 74 | </summary> |
|---|
| 75 | <content type="xhtml" xml:base="{$uribase}"> |
|---|
| 76 | <div xmlns="http://www.w3.org/1999/xhtml"> |
|---|
| 77 | <ul class="changes"> |
|---|
| 78 | <xsl:for-each select="paths/path"> |
|---|
| 79 | <li> |
|---|
| 80 | <xsl:text>[</xsl:text> |
|---|
| 81 | <xsl:value-of select="@action"/> |
|---|
| 82 | <xsl:text>] </xsl:text> |
|---|
| 83 | <xsl:value-of select="."/> |
|---|
| 84 | </li> |
|---|
| 85 | </xsl:for-each> |
|---|
| 86 | </ul> |
|---|
| 87 | <pre class="message"> |
|---|
| 88 | <xsl:value-of select="msg"/> |
|---|
| 89 | </pre> |
|---|
| 90 | </div> |
|---|
| 91 | </content> |
|---|
| 92 | </entry> |
|---|
| 93 | </xsl:if> |
|---|
| 94 | </xsl:template> |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | </xsl:stylesheet> |
|---|