Improve default display name for Facebook accounts
[empathy-mirror.git] / libempathy / empathy-log-manager.xsl
bloba934f3ab35e71c8713bc2fe563a8e0d97db8bc47
1 <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
3 <xsl:output method="html" encoding="utf-8" indent="yes"/>
5 <xsl:template match="/">
6 <html>
7 <head>
8 <style type="text/css">
9 <xsl:text>
10 body {
11 background: #fff;
12 font-family: Verdana, "Bitstream Vera Sans", Sans-Serif;
13 font-size: 10pt;
15 .stamp {
16 color: #999;
18 .top-day-stamp {
19 color: #999;
20 text-align: center;
21 margin-bottom: 1em;
23 .new-day-stamp {
24 color: #999;
25 text-align: center;
26 margin-bottom: 1em;
27 margin-top: 1em;
29 .nick {
30 color: rgb(54,100, 139);
32 .nick-self {
33 color: rgb(46,139,87);
35 .nick-highlight {
36 color: rgb(205,92,92);
38 </xsl:text>
39 </style>
40 <title><xsl:value-of select="$title"/></title>
41 </head>
42 <body>
43 <xsl:apply-templates/>
44 </body>
45 </html>
46 </xsl:template>
48 <xsl:template name="get-day">
49 <xsl:param name="stamp"/>
50 <xsl:value-of select="substring ($stamp, 1, 8)"/>
51 </xsl:template>
53 <xsl:template name="format-stamp">
54 <xsl:param name="stamp"/>
55 <xsl:variable name="hour" select="substring ($stamp, 10, 2)"/>
56 <xsl:variable name="min" select="substring ($stamp, 13, 2)"/>
58 <xsl:value-of select="$hour"/>:<xsl:value-of select="$min"/>
59 </xsl:template>
61 <xsl:template name="format-day-stamp">
62 <xsl:param name="stamp"/>
63 <xsl:variable name="year" select="substring ($stamp, 1, 4)"/>
64 <xsl:variable name="month" select="substring ($stamp, 5, 2)"/>
65 <xsl:variable name="day" select="substring ($stamp, 7, 2)"/>
67 <xsl:value-of select="$year"/>-<xsl:value-of select="$month"/>-<xsl:value-of select="$day"/>
68 </xsl:template>
70 <xsl:template name="header">
71 <xsl:param name="stamp"/>
72 <div class="top-day-stamp">
73 <xsl:call-template name="format-day-stamp">
74 <xsl:with-param name="stamp" select="@time"/>
75 </xsl:call-template>
76 </div>
77 </xsl:template>
79 <xsl:template match="a">
80 <xsl:text disable-output-escaping="yes">&lt;a href="</xsl:text>
82 <xsl:value-of disable-output-escaping="yes" select="@href"/>
84 <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
86 <xsl:value-of select="@href"/>
87 <xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
88 </xsl:template>
90 <xsl:template match="log">
92 <div class="top-day-stamp">
93 <xsl:call-template name="format-day-stamp">
94 <xsl:with-param name="stamp" select="//message[1]/@time"/>
95 </xsl:call-template>
96 </div>
98 <xsl:for-each select="*">
100 <xsl:variable name="prev-time">
101 <xsl:call-template name="get-day">
102 <xsl:with-param name="stamp" select="preceding-sibling::*[1]/@time"/>
103 </xsl:call-template>
104 </xsl:variable>
106 <xsl:variable name="this-time">
107 <xsl:call-template name="get-day">
108 <xsl:with-param name="stamp" select="@time"/>
109 </xsl:call-template>
110 </xsl:variable>
112 <xsl:if test="$prev-time &lt; $this-time">
113 <div class="new-day-stamp">
114 <xsl:call-template name="format-day-stamp">
115 <xsl:with-param name="stamp" select="@time"/>
116 </xsl:call-template>
117 </div>
118 </xsl:if>
120 <xsl:variable name="stamp">
121 <xsl:call-template name="format-stamp">
122 <xsl:with-param name="stamp" select="@time"/>
123 </xsl:call-template>
124 </xsl:variable>
126 <span class="stamp">
127 <xsl:value-of select="$stamp"/>
128 </span>
130 <xsl:variable name="nick-class">
131 <xsl:choose>
132 <xsl:when test="not(string(@id))">nick-self</xsl:when>
133 <xsl:otherwise>nick</xsl:otherwise>
134 </xsl:choose>
135 </xsl:variable>
137 <span class="{$nick-class}">
138 &lt;<xsl:value-of select="@name"/>&gt;
139 </span>
141 <xsl:apply-templates/>
142 <br/>
144 </xsl:for-each>
146 </xsl:template>
148 </xsl:stylesheet>