Create html content using xml and xslt

Posted by Blessyjees under VB.NET category on | Points: 40 | Views : 2005
This code create html content from xml using xslt. Xml contains the data that display in the html file and xslt file contains the design of the html file.

 Dim sb As New StringBuilder

Dim xReader As New XmlTextReader(xmlPath) // path of the xml file
Dim xslt As New XslCompiledTransform()
xslt.Load(xsltPath) // path of the xslt file
Dim htmlWriter As TextWriter = New StringWriter(sb)
xslt.Transform(xReader,Nothing, htmlWriter)

Now we got the html content in htmlWriter.ToString().

We are using this html content to send a mail. In out xslt contains the email template and xml contains the information what we send in the mail.

Comments or Responses

Login to post response