title: XslCompiledTransform from XmlDocument to XmlDocument
body: <p>I have the following VB.NET code that I am using to transform some XML into new XML, that I then continue processing.
  This is a one off process, not something that is done multiple times, so no efficiencies to be gained from caching, as far as I can see.</p>
  
  <p>The code works, but I am seeing performance issues. 
  I appreciate that the performance issues may be related to the XSLT.</p>
  
  <p>I have also found instances of developers having performance issues with XslCompiledTransform, especially on a 64-bit environment, which may be a bug (<a href="http://connect.microsoft.com/VisualStudio/feedback/details/508748" rel="nofollow">http://connect.microsoft.com/VisualStudio/feedback/details/508748</a>)</p>
  
  <p>Neither possible XSLT performance issues nor problems with XslCompiledTransform are under my control, but it is feasible that there are problems with my code. I just want to make sure that my method of doing the transform is the most efficient method for what I need.</p>
  
  <pre><code>Public Function TransformUsingXPathNavigator(ByVal InputXML As XmlDocument, ByVal XSLTLocation As String) As XmlDocument
  
      Dim theNavigator As XPathNavigator
      theNavigator = InputXML.CreateNavigator()
  
      Dim theTransform As XslCompiledTransform = New XslCompiledTransform()
      theTransform.Load(XSLTLocation)
  
      Dim outputXML As New XmlDocument()
  
      Using writer As XmlWriter = outputXML.CreateNavigator().AppendChild()
          theTransform.Transform(theNavigator, writer)
      End Using
  
      Return outputXML
  
  End Function
  </code></pre>
  
  <p>Is anyone able to point out any problems with my code?</p>
  
  <p>Edit: This is a one-off transform, so no loops.</p>