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;
44 border: 1pt solid #776633;
47 background-color: #11bb00;
50 background-color: #cc0000;
53 background-color: #ffff66;
56 background-color: #bbaaaa;
60 background-color: #ff8866;
63 background-color: #cc0000;
66 background-color: #ff8866;
77 <xsl:value-of select="$title"/>
80 <xsl:apply-templates select="report_metadata"/>
82 <xsl:apply-templates select="policy_published"/>
93 reason and disposition
103 <xsl:variable name="signatures">
104 <xsl:for-each select="record/auth_results">
105 <xsl:sort select="count(dkim)"
106 data-type="number" order="descending"/>
107 <xsl:if test="position()=1">
108 <xsl:value-of select="count(dkim)"/>
112 <xsl:if test="$signatures > 0">
116 <xsl:if test="$signatures > 1">
120 <xsl:if test="$signatures > 2">
130 <xsl:apply-templates select="record"/>
133 <b><u>Legend</u><br/>
135 <span class="quarantine">quarantine</span>,
136 <span class="reject">reject</span>.<br/>
138 <span class="pass">pass</span>,
139 <span class="fail">fail</span>,
140 <span class="softfail">softfail</span>,
141 <span class="error">temperror or permerror</span>.<br/>
143 <span class="pass">pass</span>,
144 <span class="fail">fail</span>,
145 <span class="dkimpolicy">policy</span>.
150 <xsl:template match="policy_published">
151 <span class="field">Domain: </span>
152 <xsl:value-of select="domain"/>
153 <xsl:text>; </xsl:text>
154 <span class="field">DKIM: </span>
155 <xsl:apply-templates select="adkim"/>
156 <xsl:text>; </xsl:text>
157 <span class="field">SPF: </span>
158 <xsl:apply-templates select="aspf"/>
159 <xsl:text>; </xsl:text>
160 <span class="field">policy published: </span>
161 <xsl:value-of select="p"/>
162 <xsl:text> </xsl:text>
163 <xsl:value-of select="sp"/>
164 <xsl:text> </xsl:text>
165 <xsl:value-of select="pct"/>
167 <xsl:template match="adkim|aspf">
168 <xsl:variable name="alignment">
169 <xsl:value-of select="."/>
172 <xsl:when test="$alignment='r'">
173 <xsl:text>relaxed</xsl:text>
175 <xsl:when test="$alignment='s'">
176 <xsl:text>strict</xsl:text>
179 <xsl:text>{$alignment}</xsl:text>
183 <xsl:template match="report_metadata">
184 <span class="field">Id: </span>
185 <xsl:value-of select="report_id"/>
186 <xsl:text>; </xsl:text>
187 <span class="field">begin: </span>
188 <xsl:call-template name="date-range">
189 <xsl:with-param name="utime" select="date_range/begin"/>
191 <xsl:text>; </xsl:text>
192 <span class="field">end: </span>
193 <xsl:call-template name="date-range">
194 <xsl:with-param name="utime" select="date_range/end"/>
196 <xsl:for-each select="error">
197 <xsl:if test="position()=1">
199 <span class="field">Error: </span>
202 <xsl:value-of select="."/>
204 <xsl:if test="not(position()=last())">
209 <xsl:template name="date-range">
210 <xsl:param name="utime" select="0"/>
212 <xsl:when test="function-available('date:add')">
214 select="date:add('1970-01-01T00:00:00', date:duration($utime))"/>
217 <xsl:value-of select="$utime"/>
221 <xsl:template match="record">
223 <xsl:apply-templates select="row"/>
224 <xsl:apply-templates select="identifiers|identities"/>
225 <xsl:apply-templates select="auth_results"/>
230 <xsl:template match="row">
233 <xsl:attribute name="href">
234 <xsl:value-of select="$source_ip_href"/>
235 <xsl:value-of select="source_ip"/>
237 <xsl:value-of select="source_ip"/>
241 <xsl:value-of select="count"/>
244 <xsl:attribute name="class">
245 <xsl:variable name="disposition">
246 <xsl:value-of select="policy_evaluated/disposition"/>
249 <xsl:when test="$disposition='reject'">
250 <xsl:text>reject</xsl:text>
252 <xsl:when test="$disposition='quarantine'">
253 <xsl:text>quarantine</xsl:text>
256 <xsl:text>normal</xsl:text>
260 <xsl:for-each select="policy_evaluated/reason">
261 <xsl:value-of select="type"/>
262 <xsl:text> </xsl:text>
263 <xsl:value-of select="comment"/>
268 <xsl:template match="identifiers|identities">
270 <xsl:value-of select="header_from"/>
271 <xsl:if test="count(envelope_to) > 0">
273 <xsl:value-of select="envelope_to"/>
277 <xsl:template match="auth_results">
278 <xsl:apply-templates select="spf"/><!-- one -->
279 <xsl:apply-templates select="dkim"/><!-- zero or more -->
281 <xsl:template name="class_attribute">
282 <xsl:attribute name="class">
283 <xsl:variable name="result">
284 <xsl:value-of select="result"/>
287 <xsl:when test="$result='pass'">
288 <xsl:text>pass</xsl:text>
290 <xsl:when test="$result='fail' or $result='hardfail'">
291 <xsl:text>fail</xsl:text>
293 <xsl:when test="$result='temperror' or $result='permerror'">
294 <xsl:text>error</xsl:text>
296 <xsl:when test="$result='policy'">
297 <xsl:text>dkimpolicy</xsl:text>
299 <xsl:when test="$result='softfail'">
300 <xsl:text>softfail</xsl:text>
303 <xsl:text>normal</xsl:text>
308 <xsl:template match="spf">
310 <xsl:call-template name="class_attribute" />
311 <xsl:value-of select="domain"/>
313 <xsl:value-of select="scope"/>
315 <xsl:value-of select="human_result"/>
318 <xsl:template match="dkim">
320 <xsl:call-template name="class_attribute" />
321 <xsl:value-of select="domain"/>
323 <xsl:value-of select="selector"/>
325 <xsl:value-of select="human_result"/>