I have two xml files that I want to transform using XslCompiledTransform. Trouble is i have to do that in one transformation. I'm using .Transform method for the first file, while the other file is being referred to within xsl script. What I need as a result is html output that contains some data from both xml files. My code is:
XsltSettings settings = new XsltSettings(true, true);
XslCompiledTransform myXslTransform = new XslCompiledTransform();
myXslTransform.Load(openFileDialog1.FileName, settings, new XmlUrlResolver());
string HTMLoutput;
StringWriter writer = new StringWriter();
myXslTransform.Transform("file1.xml", null, writer);
HTMLoutput = writer.ToString();
writer.Close();
I catch following exception: "An error occurred while loading document'file2.xml" and InnerException: "For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method."
So how do I do what InnerExcetion tells me to do when XmlReader is being used by .Transform method? Or is there any other way to achieve this kind of transformation?