Umbraco Contour XSLT transformed mail with link

Umbraco Contour seem to have a bug when sending mail out with a file upload. You would expect to get a clickable link in the email, but instead Contour inserts the file location without domain – as plain text, making it rather useless. Of course you can see the uploaded file from “Entries” in Contour, but a better and expected UX would be to be able to click the link in the mail.

As for now, this can only be done by using the type “Send xslt transformed email” from “Workflows” in Contour. Using the below XSLT file will give you a clickable link with the filename, in your received email.

When creating a “Workflow”, simply choose the type “Send xslt transformed email” and choose the XSLT file below.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="urn:my-scripts"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="xsl msxsl user umbraco.library">
 
  <xsl:output method="html" media-type="text/html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
  doctype-system="DTD/xhtml1-strict.dtd"
  cdata-section-elements="script style"
  indent="yes"
  encoding="utf-8"/>
 
  <xsl:param name="records" />
 
  <xsl:template match="/">
    <table style="border-collapse:collapse;border:1px solid black;">
          <xsl:for-each select="$records//fields/child::*">
			<xsl:sort select="@sortorder" data-type="number"/>
           <tr style="border:1px solid black;">
                  <td valign="top" style="border:1px solid black;padding:5px;font-family:Verdana,Helvetica,Arial,sans-serif;font-size:11px;">
                      <strong>
                       <xsl:value-of select="./caption"/>
                      </strong>
                </td>
                <td valign="top" style="border:1px solid black;padding:5px;font-family:Verdana,Helvetica,Arial,sans-serif;font-size:11px;">
                      <xsl:choose>
                         <xsl:when test="contains(.//value, '/umbraco/plugins/umbracoContour/files/')">
                             <a href="http://{umbraco.library:RequestServerVariables('SERVER_NAME')}{.//value}">
								<xsl:value-of select="substring-after(substring-after(.//value, '/files/'), '/')"/>						 
                           </a>
                         </xsl:when>
                          <xsl:otherwise>
                              <xsl:for-each select="./values/value">
                                  <xsl:if test="position() &gt; 1">
                                   <br />
                                  </xsl:if>
                                <xsl:value-of select="umbraco.library:ReplaceLineBreaks(.)"/>
                           </xsl:for-each>
                          </xsl:otherwise>
                     </xsl:choose>
                  </td>
            </tr>
        </xsl:for-each>
      </table>
  </xsl:template>
</xsl:stylesheet>

https://gist.github.com/PaulSorensen/7983503