1 <xsl:stylesheet version="1.0"
2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:date="http://exslt.org/dates-and-times"
4 xmlns="http://www.w3.org/1999/xhtml">
6 omit-xml-declaration = "yes"
7 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
8 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
9 <xsl:param name="source_ip_href">
10 <!-- customize this -->
11 <!-- <xsl:text>http://www.tana.it/lookup.php?host=</xsl:text> -->
12 <xsl:text>http://network-tools.com/default.asp?prog=lookup&host=</xsl:text>
13 <!-- alternative examples:
14 <xsl:text>http://www.ip-adress.com/reverse_ip/</xsl:text>
17 <xsl:template match="feedback">
18 <html xmlns="http://www.w3.org/1999/xhtml">
19 <xsl:variable name="title">
21 <xsl:value-of select="report_metadata/org_name"/>
25 <xsl:value-of select="$title"/>
27 <style type="text/css" id="internal-style">
29 font-family: Arial, Helvetica, sans-serif;
31 background-color: #ffcc66;
36 background-color: #ffeeaa;
37 border: 3pt solid #776633;
42 border: 1pt solid #776633;
45 background-color: #11bb00;
48 background-color: #cc0000;
51 background-color: #ffff66;
54 background-color: #bbaaaa;
58 background-color: #ff8866;
61 background-color: #cc0000;
64 background-color: #ff8866;
75 <xsl:value-of select="$title"/>
78 <xsl:apply-templates select="report_metadata"/>
80 <xsl:apply-templates select="policy_published"/>
91 reason and disposition
101 <xsl:variable name="signatures">
102 <xsl:for-each select="record/auth_results">
103 <xsl:sort select="count(dkim)"
104 data-type="number" order="descending"/>
105 <xsl:if test="position()=1">
106 <xsl:value-of select="count(dkim)"/>
110 <xsl:if test="$signatures > 0">
114 <xsl:if test="$signatures > 1">
118 <xsl:if test="$signatures > 2">
128 <xsl:apply-templates select="record"/>
131 <b><u>Legend</u><br/>
133 <span class="quarantine">quarantine</span>,
134 <span class="reject">reject</span>.<br/>
136 <span class="pass">pass</span>,
137 <span class="fail">fail</span>,
138 <span class="softfail">softfail</span>,
139 <span class="error">temperror or permerror</span>.<br/>
141 <span class="pass">pass</span>,
142 <span class="fail">fail</span>,
143 <span class="dkimpolicy">policy</span>.
148 <xsl:template match="policy_published">
149 <span class="field">Domain: </span>
150 <xsl:value-of select="domain"/>
151 <xsl:text>; </xsl:text>
152 <span class="field">DKIM: </span>
153 <xsl:apply-templates select="adkim"/>
154 <xsl:text>; </xsl:text>
155 <span class="field">SPF: </span>
156 <xsl:apply-templates select="aspf"/>
157 <xsl:text>; </xsl:text>
158 <span class="field">policy published: </span>
159 <xsl:value-of select="p"/>
160 <xsl:text> </xsl:text>
161 <xsl:value-of select="sp"/>
162 <xsl:text> </xsl:text>
163 <xsl:value-of select="pct"/>
165 <xsl:template match="adkim|aspf">
166 <xsl:variable name="alignment">
167 <xsl:value-of select="."/>
170 <xsl:when test="$alignment='r'">
171 <xsl:text>relaxed</xsl:text>
173 <xsl:when test="$alignment='s'">
174 <xsl:text>strict</xsl:text>
177 <xsl:text>{$alignment}</xsl:text>
181 <xsl:template match="report_metadata">
182 <span class="field">Id: </span>
183 <xsl:value-of select="report_id"/>
184 <xsl:text>; </xsl:text>
185 <span class="field">begin: </span>
186 <xsl:call-template name="date-range">
187 <xsl:with-param name="utime" select="date_range/begin"/>
189 <xsl:text>; </xsl:text>
190 <span class="field">end: </span>
191 <xsl:call-template name="date-range">
192 <xsl:with-param name="utime" select="date_range/end"/>
194 <xsl:for-each select="error">
195 <xsl:if test="position()=1">
197 <span class="field">Error: </span>
200 <xsl:value-of select="."/>
202 <xsl:if test="not(position()=last())">
207 <xsl:template name="date-range">
208 <xsl:param name="utime" select="0"/>
210 <xsl:when test="function-available('date:add')">
212 select="date:add('1970-01-01T00:00:00', date:duration($utime))"/>
215 <xsl:value-of select="$utime"/>
219 <xsl:template match="record">
221 <xsl:apply-templates select="row"/>
222 <xsl:apply-templates select="identifiers|identities"/>
223 <xsl:apply-templates select="auth_results"/>
228 <xsl:template match="row">
231 <xsl:attribute name="href">
232 <xsl:value-of select="$source_ip_href"/>
233 <xsl:value-of select="source_ip"/>
235 <xsl:value-of select="source_ip"/>
239 <xsl:value-of select="count"/>
242 <xsl:attribute name="class">
243 <xsl:variable name="disposition">
244 <xsl:value-of select="policy_evaluated/disposition"/>
247 <xsl:when test="$disposition='reject'">
248 <xsl:text>reject</xsl:text>
250 <xsl:when test="$disposition='quarantine'">
251 <xsl:text>quarantine</xsl:text>
254 <xsl:text>normal</xsl:text>
258 <xsl:for-each select="policy_evaluated/reason">
259 <xsl:value-of select="type"/>
260 <xsl:text> </xsl:text>
261 <xsl:value-of select="comment"/>
266 <xsl:template match="identifiers|identities">
268 <xsl:value-of select="header_from"/>
269 <xsl:if test="count(envelope_to) > 0">
271 <xsl:value-of select="envelope_to"/>
275 <xsl:template match="auth_results">
276 <xsl:apply-templates select="spf"/><!-- one -->
277 <xsl:apply-templates select="dkim"/><!-- zero or more -->
279 <xsl:template name="class_attribute">
280 <xsl:attribute name="class">
281 <xsl:variable name="result">
282 <xsl:value-of select="result"/>
285 <xsl:when test="$result='pass'">
286 <xsl:text>pass</xsl:text>
288 <xsl:when test="$result='fail' or $result='hardfail'">
289 <xsl:text>fail</xsl:text>
291 <xsl:when test="$result='temperror' or $result='permerror'">
292 <xsl:text>error</xsl:text>
294 <xsl:when test="$result='policy'">
295 <xsl:text>dkimpolicy</xsl:text>
297 <xsl:when test="$result='softfail'">
298 <xsl:text>softfail</xsl:text>
301 <xsl:text>normal</xsl:text>
306 <xsl:template match="spf">
308 <xsl:call-template name="class_attribute" />
309 <xsl:value-of select="domain"/>
311 <xsl:value-of select="scope"/>
313 <xsl:value-of select="human_result"/>
316 <xsl:template match="dkim">
318 <xsl:call-template name="class_attribute" />
319 <xsl:value-of select="domain"/>
321 <xsl:value-of select="selector"/>
323 <xsl:value-of select="human_result"/>