I am using XSLT in conjunction with C# to transform my xml document into HTML. I need the DOCTYPE to be in the HTML document. But somehow I can't seem to get it to appear. Please help...
My xsl includes the following.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="xml" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes"/>
My C# code looks like this :
try
{
XPathDocument myXPathDoc = new XPathDocument(myPath);
XslTransform myXslTrans = new XslTransform();
myXslTrans.Load(ConfigurationManager.AppSettings["XsltFilePath"] == null ?
"MyTransform.xsl" :
ConfigurationManager.AppSettings["XsltFilePath"]);
String htmlFile = Path.Combine(myFolder, myName, "index.html");
XmlTextWriter myWriter = new XmlTextWriter(htmlFile, null);
myXslTrans.Transform(myXPathDoc, null, myWriter);
myWriter.Close();
}
catch (Exception e)
{
System.Console.WriteLine(e.Message + "\n" + e.StackTrace);
}
Any ideas what I am doing wrong? I am using .NET 4.0. Thanks in advance.