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&amp;host=</xsl:text> -->
13 <!-- <xsl:text>https://dnschecker.org/ip-whois-lookup.php?query=</xsl:text> -->
14 <xsl:text>https://ipalyzer.com/</xsl:text>
15 <!-- alternative examples:
16 <xsl:text>http://www.ip-adress.com/reverse_ip/</xsl:text>
19 <xsl:template match="feedback">
20 <html xmlns="http://www.w3.org/1999/xhtml">
21 <xsl:variable name="title">
23 <xsl:value-of select="report_metadata/org_name"/>
27 <xsl:value-of select="$title"/>
29 <style type="text/css" id="internal-style">
31 font-family: Arial, Helvetica, sans-serif;
33 background-color: #ffcc66;
38 background-color: #ffeeaa;
39 border: 3pt solid #776633;
41 table.report_metadata th {
47 border: 1pt solid #776633;
50 background-color: #11bb00;
53 background-color: #cc0000;
56 background-color: #ffff66;
59 background-color: #bbaaaa;
63 background-color: #ff8866;
66 background-color: #cc0000;
69 background-color: #ff8866;
80 <xsl:value-of select="$title"/>
84 <xsl:apply-templates select="report_metadata"/>
85 <xsl:apply-templates select="policy_published"/>
105 <xsl:variable name="signatures">
106 <xsl:for-each select="record/auth_results">
107 <xsl:sort select="count(dkim)"
108 data-type="number" order="descending"/>
109 <xsl:if test="position()=1">
110 <xsl:value-of select="count(dkim)"/>
114 <xsl:if test="$signatures > 0">
118 <xsl:if test="$signatures > 1">
122 <xsl:if test="$signatures > 2">
132 <xsl:apply-templates select="record"/>
135 <b><u>Legend</u><br/>
137 <span class="quarantine">quarantine</span>,
138 <span class="reject">reject</span>.<br/>
140 <span class="pass">pass</span>,
141 <span class="fail">fail</span>,
142 <span class="softfail">softfail</span>,
143 <span class="error">temperror or permerror</span>.<br/>
145 <span class="pass">pass</span>,
146 <span class="fail">fail</span>,
147 <span class="dkimpolicy">policy</span>.
152 <xsl:template match="policy_published">
155 <span class="field">Domain: </span>
158 <xsl:value-of select="domain"/>
163 <span class="field">DKIM: </span>
166 <xsl:apply-templates select="adkim"/>
171 <span class="field">SPF: </span>
174 <xsl:apply-templates select="aspf"/>
179 <span class="field">policy published: </span>
182 <xsl:value-of select="p"/>
183 <xsl:text> </xsl:text>
184 <xsl:value-of select="sp"/>
185 <xsl:text> </xsl:text>
186 <xsl:value-of select="pct"/>
190 <xsl:template match="adkim|aspf">
191 <xsl:variable name="alignment">
192 <xsl:value-of select="."/>
195 <xsl:when test="$alignment='r'">
196 <xsl:text>relaxed</xsl:text>
198 <xsl:when test="$alignment='s'">
199 <xsl:text>strict</xsl:text>
202 <xsl:text>{$alignment}</xsl:text>
206 <xsl:template match="report_metadata">
208 <th align="right">Id:</th>
210 <xsl:value-of select="report_id"/>
214 <th align="right">begin:</th>
216 <xsl:call-template name="date-range">
217 <xsl:with-param name="utime" select="date_range/begin"/>
222 <th align="right">end:</th>
224 <xsl:call-template name="date-range">
225 <xsl:with-param name="utime" select="date_range/end"/>
229 <xsl:for-each select="error">
230 <xsl:if test="position()=1">
232 <span class="field">Error: </span>
235 <xsl:value-of select="."/>
237 <xsl:if test="not(position()=last())">
242 <xsl:template name="date-range">
243 <xsl:param name="utime" select="0"/>
245 <xsl:when test="function-available('date:add')">
247 select="date:add('1970-01-01T00:00:00', date:duration($utime))"/>
250 <xsl:value-of select="$utime"/>
254 <xsl:template match="record">
256 <xsl:apply-templates select="row"/>
257 <xsl:apply-templates select="identifiers|identities"/>
258 <xsl:apply-templates select="auth_results"/>
263 <xsl:template match="row">
266 <xsl:attribute name="href">
267 <xsl:value-of select="$source_ip_href"/>
268 <xsl:value-of select="source_ip"/>
270 <xsl:value-of select="source_ip"/>
274 <xsl:value-of select="count"/>
277 <xsl:attribute name="class">
278 <xsl:variable name="disposition">
279 <xsl:value-of select="policy_evaluated/disposition"/>
282 <xsl:when test="$disposition='reject'">
283 <xsl:text>reject</xsl:text>
285 <xsl:when test="$disposition='quarantine'">
286 <xsl:text>quarantine</xsl:text>
289 <xsl:text>normal</xsl:text>
293 <xsl:value-of select="policy_evaluated/disposition"/> <br />
294 dkim: <xsl:value-of select="policy_evaluated/dkim"/> <br />
295 spf : <xsl:value-of select="policy_evaluated/spf"/> <br />
297 <xsl:for-each select="policy_evaluated/reason">
298 <xsl:value-of select="type"/>
299 <xsl:text> </xsl:text>
300 <xsl:value-of select="comment"/>
305 <xsl:template match="identifiers|identities">
307 <xsl:value-of select="header_from"/>
308 <xsl:if test="count(envelope_to) > 0">
310 <xsl:value-of select="envelope_to"/>
314 <xsl:template match="auth_results">
315 <xsl:apply-templates select="spf"/><!-- one -->
316 <xsl:apply-templates select="dkim"/><!-- zero or more -->
318 <xsl:template name="class_attribute">
319 <xsl:attribute name="class">
320 <xsl:variable name="result">
321 <xsl:value-of select="result"/>
324 <xsl:when test="$result='pass'">
325 <xsl:text>pass</xsl:text>
327 <xsl:when test="$result='fail' or $result='hardfail'">
328 <xsl:text>fail</xsl:text>
330 <xsl:when test="$result='temperror' or $result='permerror'">
331 <xsl:text>error</xsl:text>
333 <xsl:when test="$result='policy'">
334 <xsl:text>dkimpolicy</xsl:text>
336 <xsl:when test="$result='softfail'">
337 <xsl:text>softfail</xsl:text>
340 <xsl:text>normal</xsl:text>
345 <xsl:template match="spf">
347 <xsl:call-template name="class_attribute" />
348 <xsl:value-of select="result"/>
350 <xsl:value-of select="domain"/>
352 <xsl:value-of select="scope"/>
354 <xsl:value-of select="human_result"/>
357 <xsl:template match="dkim">
359 <xsl:call-template name="class_attribute" />
360 <xsl:value-of select="result"/>
362 <xsl:value-of select="domain"/>
364 <xsl:value-of select="selector"/>
366 <xsl:value-of select="human_result"/>