Skip to content

Instantly share code, notes, and snippets.

@alexproca
Created December 30, 2016 12:57
Show Gist options
  • Select an option

  • Save alexproca/b6ff736c6d7b1e0fa3a2a4d97a19a8e4 to your computer and use it in GitHub Desktop.

Select an option

Save alexproca/b6ff736c6d7b1e0fa3a2a4d97a19a8e4 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="/feedback">
<html>
<head> <title>DMARC Feedback</title> </head>
<body>
<h1>Reporting party: <xsl:value-of select="report_metadata/org_name"></xsl:value-of> </h1>
<h1>From:
<span id="start-date"><xsl:value-of select="report_metadata/date_range/begin"></xsl:value-of></span>
</h1>
<h1>To:
<span id="end-date"><xsl:value-of select="report_metadata/date_range/end"></xsl:value-of></span>
</h1>
<h1>Records</h1>
<table border="1">
<thead>
<tr>
<th>
Source Ip
</th>
<th>
Auth Results
</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="record">
<tr>
<td>
<xsl:value-of select="row/source_ip">
</xsl:value-of>
</td>
<td>
<xsl:value-of select="auth_results/spf/domain"/>
-
<xsl:value-of select="auth_results/spf/result"/>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
<script>
(function(){
var parseDate = function(elementId) {
var startDate = document.getElementById(elementId)
var date = new Date(parseInt(startDate.innerHTML) * 1000)
startDate.innerHTML = date.toISOString().replace(/(.+)T(.+)\.[0-9]{3}Z/g, '$1 $2')
}
parseDate('start-date')
parseDate('end-date')
})()
</script>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment