TestReceiver XSL
What XSL Does
XSL is a way to extract and/or reformat content from XML. The CheckTLS ("TestReceiver") test can output all the data the interactive test shows in an XML format, suitable for input to other computer programs, spreadsheets, web pages, etc.
Documenting XML and XSL is out of scope for this document. See What is XSL?. This document describes the two XSL options in ("TestReceiver"). Using these options requires you to be familiar with TestReceiver, its XML Output Formats, XML itself, and XSL(T).
How To Use XSL
We offer two choices for using XSL to transform the XML output of
("TestReceiver"): Immediate Translation and Embeded Translation.Immediate Translation applies an XSL stylesheet to the XML test output and returns the result. You can either enter the URL to an XSL stylesheet or the XSL stylesheet itself in the XSL parameter of More Options).
("TestReceiver") (XSL is an option underEmbeded Translation adds a link to an XSL stylesheet into the XML, so the result includes the original source XML test output and the instructions for how to translate it. When a browser displays a document with Embeded Translation it displays the translated result. Enter the XSL URL in the XSLURL parameter of More Options).
("TestReceiver") (XSLURL is an option underIn most cases the results for Immediate Translation and Embeded Translation look the same in a browser window, but Immediate Translation is the new content, while Embeded Translation is the original content with instructions for how to turn it into new content.
We provide three examples for each type of translation to document how use XSL on TestReceiver output.
Example XSL Files
We use three XSL files in these examples.
Translate XML to plain text: https://www.checktls.com/html/XSL/TR-text.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
Confidence Factor for <xsl:value-of select="*/eMailAddress"/> is <xsl:value-of select="*/ConfidenceFactor"/>.
<xsl:for-each select="*/MX">
MX host <xsl:value-of select="@address"/> SSL Version is <xsl:value-of select="SSL/SSLVersion"/>.
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Translate XML to html: https://www.checktls.com/html/XSL/TR-html.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" media-type="text/html"/>
<xsl:template match="/">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<h2>CheckTLS TestReceiver</h2>
<table border="1">
<tr>
<th>Address</th>
<th>TLS Enabled</th>
<th>TLS Version</th>
<th>Score</th>
<th>MX</th>
<th>Cert Expires</th>
</tr>
<xsl:for-each select="*/MX">
<xsl:variable name="PosMX" select="position()"/>
<xsl:for-each select="Certs/Cert">
<xsl:variable name="PosCert" select="position()"/>
<tr>
<xsl:choose>
<xsl:when test="$PosMX = 1 and $PosCert = 1">
<td><xsl:value-of select="../../../eMailAddress"/></td>
<td>
<xsl:choose>
<xsl:when test="ConfidenceFactor|ConfidenceQFactor < 90">No</xsl:when>
<xsl:otherwise>Yes</xsl:otherwise>
</xsl:choose>
</td>
<td><xsl:value-of select="../../SSL/SSLVersion"/></td>
<td>
<a>
<xsl:attribute name="href">
https://www.checktls.com/TestReceiver?EMAIL=<xsl:value-of select="../../../eMailAddress"/>
</xsl:attribute>
<xsl:value-of select="../../../ConfidenceFactor|ConfidenceQFactor"/>
</a>
</td>
</xsl:when>
<xsl:otherwise>
<td></td>
<td></td>
<td></td>
<td></td>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$PosCert = 1">
<td><xsl:value-of select="../../@address"/></td>
</xsl:when>
<xsl:otherwise>
<td></td>
</xsl:otherwise>
</xsl:choose>
<td><xsl:value-of select="NotValidAfter"/></td>
</tr>
</xsl:for-each>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Extract just a few fields from the large XML results file to a smaller XML file: https://www.checktls.com/html/XSL/TR-xml.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<CheckTLS>
<eMailAddress><xsl:value-of select="*/eMailAddress"/></eMailAddress>
<ConfidenceFactor><xsl:value-of select="*/ConfidenceFactor"/></ConfidenceFactor>
<xsl:apply-templates select="*/MX"/>
</CheckTLS>
</xsl:template>
<xsl:template match="MX">
<MX>
<xsl:attribute name="address">
<xsl:value-of select="@address"/>
</xsl:attribute>
<SSLVersion>
<xsl:value-of select="SSL/SSLVersion"/>
</SSLVersion>
<xsl:apply-templates select="Certs/Cert"/>
</MX>
</xsl:template>
<xsl:template match="Certs/Cert">
<CertExpire>
<xsl:value-of select="NotValidAfter"/>
</CertExpire>
</xsl:template>
</xsl:stylesheet>
Immediate XSL to text
Entering the text xsl URL or the XSL itself into the XSL option produces this output:
Confidence Factor for checktls.com is 100.
MX host mail11-do.checktls.com[134.209.47.28:25] SSL Version is TLSv1_3.
MX host mail6.checktls.com[159.89.187.50:25] SSL Version is TLSv1_3.
Immediate XSL to html
Entering the html xsl URL or the XSL itself into the XSL option produces this output:
CheckTLS TestReceiver
Address | TLS Enabled | TLS Version | Score | MX | Cert Expires |
---|---|---|---|---|---|
checktls.com | Yes | TLSv1_3 | 100 | mail11-do.checktls.com[134.209.47.28:25] | Dec 6 17:42:48 2021 GMT |
May 3 07:00:00 2031 GMT | |||||
Dec 31 23:59:59 2037 GMT | |||||
May 30 07:00:00 2031 GMT | |||||
Jun 29 17:06:20 2034 GMT | |||||
mail6.checktls.com[159.89.187.50:25] | Dec 6 17:42:48 2021 GMT | ||||
May 3 07:00:00 2031 GMT | |||||
Dec 31 23:59:59 2037 GMT | |||||
May 30 07:00:00 2031 GMT | |||||
Jun 29 17:06:20 2034 GMT |
Immediate XSL to XML
Entering the xml xsl URL or the XSL itself into the XSL option produces this output:
<CheckTLS>
<eMailAddress>checktls.com</eMailAddress>
<ConfidenceFactor>100</ConfidenceFactor>
<MX exchange="mail11-do.checktls.com[134.209.47.28:25]">
<SSLVersion>TLSv1_3</SSLVersion>
<Cert>Dec 6 17:42:48 2021 GMT</Cert>
<Cert>May 3 07:00:00 2031 GMT</Cert>
<Cert>Dec 31 23:59:59 2037 GMT</Cert>
<Cert>May 30 07:00:00 2031 GMT</Cert>
<Cert>Jun 29 17:06:20 2034 GMT</Cert>
</MX>
<MX exchange="mail6.checktls.com[159.89.187.50:25]">
<SSLVersion>TLSv1_3</SSLVersion>
<Cert>Dec 6 17:42:48 2021 GMT</Cert>
<Cert>May 3 07:00:00 2031 GMT</Cert>
<Cert>Dec 31 23:59:59 2037 GMT</Cert>
<Cert>May 30 07:00:00 2031 GMT</Cert>
<Cert>Jun 29 17:06:20 2034 GMT</Cert>
</MX>
</CheckTLS>
Embeded XSL to text
Setting XSLURL to the text XSL URL produces this webpage (click to see page, use "View Source" to see the Embedded XML).
Embeded XSL to html
Setting XSLURL to the html XSL URL produces this webpage (click to see page, use "View Source" to see the Embedded XML).
Embeded XSL to XML
Setting XSLURL to the xml XSL URL produces this webpage (click to see page, use "View Source" to see the Embedded XML).
NOTE: on most browsers this page does not display correctly but the source is correct.