Je transforme un document XML mais après la transformation, ma DTD disparaît et la première ligne qui indique la version XML est manquante.Conserver la DTD après la transformation XML
<?xml version="1.0"?>
Le code que je utilise pour transformer le fichier XML est:
// 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();
}
Toutes les idées?