Hi, I am transforming an XML document but after the transform my DTD goes away and also the first line which tells the XML version is missing.
<?xml version="1.0"?>
The code I am using to transform the XML file is:
// Load the style sheet.
var xslt = new XslCompiledTransform();
xslt.Load("XSLTFile1.xslt");
// Create the writer.
var settings = new XmlWriterSettings
{
Indent = true,
IndentChars = "\t",
ConformanceLevel = ConformanceLevel.Auto,
Encoding = Encoding.UTF8,
};
var mydoc = XDocument.Load("Doc1.xml");
var writer = XmlWriter.Create("Doc2.xml", settings);
// Execute the transform and output the results to a file.
if (writer != null)
{
xslt.Transform(mydoc.CreateReader(), writer);
writer.Close();
}
Any ideas?