title: XSLT transformation in memory using C#
body: <p>Good afternoon all, </p>
  
  <p>I dont know why this is proving so difficult but I must be having one of those days!</p>
  
  <p>I am trying to perform and XslCompiledTransform on an in memory XmlDocument (I have retrieved the XML from a webservice and saved to a database) object. I have the following code so far:</p>
  
  <pre><code>        string xslFile = "C:\\MOJLogViewer\\GetClaimTransformed.xslt";
  
          XslCompiledTransform processor = new XslCompiledTransform();
          processor.Load(xslFile);
  
          MemoryStream ms = new MemoryStream();
          processor.Transform(xdoc.CreateNavigator(), null, ms);
  
          ms.Seek(0, SeekOrigin.Begin);
  
          StreamReader reader = new StreamReader(ms);
  
          XmlDocument transformedDoc = new XmlDocument();
          transformedDoc.Load(reader.ReadToEnd());
  
  
          string output = reader.ReadToEnd();
          ms.Close();
  </code></pre>
  
  <p>When I try to run this code I get the "illegal characters in path" exception. The path does not contain any of the illegal characters so I am absolutely stumped!</p>
  
  <p>I hope you can help.</p>
  
  <p>Thanks</p>