title: [C#]Add XSL reference in XMLDocument
body: <p>I am creating an XML document from my C# code. I need to add the XSL reference in my XML document. My code is:</p>
  
  <pre><code>XmlDocument xDoc = new XmlDocument();
  if (!File.Exists(fileName))
  {
      XmlDeclaration dec = xDoc.CreateXmlDeclaration("1.0", "UTF-8", null);
      xDoc.AppendChild(dec);
      **[Need to add code to add the XSL reference e.g. - &lt;?xml-stylesheet type="text/xsl" href="style.xsl"?&gt; ] **
      XmlElement root = xDoc.CreateElement("Errors");
      xDoc.AppendChild(root);
  }
  else
  {
      xDoc.Load(fileName);
  }
  XmlElement errorLogStart = xDoc.CreateElement("ErrorLog");
  XmlElement errorText = xDoc.CreateElement("Message");
  errorText.InnerText = message;
  errorLogStart.AppendChild(errorText);
  xDoc.DocumentElement.InsertBefore(errorLogStart, xDoc.DocumentElement.FirstChild);
  
  FileStream fileXml = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write);
  xDoc.Save(fileXml);
  </code></pre>
  
  <p>I need to add the following line - <code>&lt;?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?&gt;</code> in my XML document. How can I do it? Couldn't find much through google.</p>