Note that there are some explanatory texts on larger screens.

plurals
  1. POI have an xml file that is styled with xslt to produce html email template. How can i get that xml as html email body in c#?
    primarykey
    data
    text
    <p>I have an xml file that is styled with xslt to produce html email template. I get values from users dynamically and replace xml elements text with the values received. How can i get that xml file and send as html email body in c#?</p> <p>My Xml Looks Like This </p> <pre><code> &lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;?xml-stylesheet type="text/xsl" href="EmailTemplateStyleForHTML.xslt"?&gt; &lt;EmailTemplate&gt; &lt;subject&gt;Information from xyz&lt;/subject&gt; &lt;displayName&gt;abcd&lt;/displayName&gt; &lt;Message1&gt; Thanks you for registering to xyz. &lt;/Message1&gt; &lt;Copyright&gt;Copyright xyz&lt;/Copyright&gt; &lt;/EmailTemplate&gt; </code></pre> <p>I am using LINQ to set the values to the xml. Note: I know how to get and set the values from xml but what i want is to grab the whole xml file in to the email body.</p> <p>If you think there is a better approach for this i would love to hear that. I would really appreciate your help. </p> <p>Edited after Reply: The xsl transformation part :</p> <pre><code> TextReader tr1 = new StringReader(@"EMailTemplateHtml.xml"); var tr11 = new XmlTextReader(tr1); var xPathDocument = new XPathDocument(tr11); //read XSLT TextReader tr2 = new StringReader(@"EmailTemplateStyleForHTML.xslt"); var tr22 = new XmlTextReader(tr2); var xslt = new XslTransform(); xslt.Load(tr22); var sb = new StringBuilder(); TextWriter tw = new StringWriter(sb); xslt.Transform(xPathDocument, null, tw); emailBody = sb.ToString(); </code></pre> <p>I am doing the transformation as you said(@Roy Ashbrook) am i missing anything here?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload