How do you apply the stylesheet line? I do not know the XslPath property or method? How about this...
Code:
public static void AddXslIncludeInstruction(string filename, string stylesheet)
{
XmlDocument doc = null;
try
{
doc = new XmlDocument();
doc.Load(filename);
if(stylesheet != null)
{
doc.InsertBefore(doc.CreateProcessingInstruction(
"xml-stylesheet", "type=\"text/xsl\" href=\"" + stylesheet + "\""),
doc.DocumentElement);
}
doc.Save(filename);
}
catch(Exception e)
{
System.Console.WriteLine(e.Message);
throw;
}
}
(the above code is not tested, but I think it works)
Hope it helps, Jacob.