I am generating an html from xslt then sending that html to email In my email css mentioned in the html not getting applied when i view email. My xslt is
<?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" encoding="utf-8" omit-xml-declaration="yes" indent="yes" />
<xsl:param name="FullName" />
<xsl:param name="Url" />
<xsl:param name="SiteRoot" />
<xsl:template match="/">
<xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text>
<html class="AR">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta http-equiv="content-language" content="en" />
<xsl:element name="link">
<xsl:attribute name="href">
<xsl:value-of select="$SiteRoot"/>
<xsl:text>Common/Stylesheets/EmailTemplates_en_gb.css</xsl:text>
</xsl:attribute>
<xsl:attribute name="rel">
<xsl:text>stylesheet</xsl:text>
</xsl:attribute>
</xsl:element>
</head>
<body>
<div class="Email">
<div class="TopSection">
<a href="javascript:void(0)" class="Logo"></a>
<img>
<xsl:attribute name="src">
<xsl:value-of select="$SiteRoot"/>
<xsl:text>Common/Images/top-banner.gif</xsl:text>
</xsl:attribute>
</img>
</div>
<div class="Text">
<p>
<strong>
Hi <xsl:value-of select="$FullName" />,
</strong>
</p>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
If I get string of the html and try to view that html in some sample html page i view properly applied css. My css has some background image, some fonts setting e.t.c. Also in email though i can able to see my top-banner image On .net part my code looks like following
var results = new StringWriter();
var stringReader = new StringReader((new DataSet().GetXml()));
var reader = XmlReader.Create(stringReader);
var xpathDoc = new XPathDocument(reader);
var transform = new XslCompiledTransform();
transform.Load(Server.MapPath(Settings.AdminCoordinatorAddEditTemplatePath));
var argsList = new XsltArgumentList();
argsList.AddParam("FullName", "", coordinator.FullName);
argsList.AddParam("Url", "", strUrl);
argsList.AddParam("SiteRoot", "", Settings.DomainUrl);
transform.Transform(xpathDoc, argsList, results);
return results.ToString();