title: XslCompiledTransform vs. XslTransform and how about an OOM for good measure?
body: <p>So for a while I've been using XslCompiledTransform because that's what Microsoft tells me I need to use as XslTransform is deprecated.  Recently I had to use it with a transform that has nearly 100,000 lines (generated xsl - of course).  When I used my application I was shocked to see an OOM pop up.  No matter what I did - OOM is all I get... For giggles I went back to XslTransform... Same exact code changing XslCompiledTransform to XslTransform and it works fine...</p>
  
  <p>Can anyone tell me how to work around the OOM - is there some 'swtich' on XslCompiledTransform?  I don't know how you will be able to replicate the exact problem, but if anyone has any answers they're much appreciated.</p>
  
  <p>Thanks - code below:</p>
  
  <p>Works:</p>
  
  <pre><code>XslTransform myXslTransform = new XslTransform();
  myXslTransform.Load(xslWith100ThousandLines);
  MemoryStream m = new MemoryStream();
  myXslTransform.Transform(myXPathDocument, null, m);
  m.Flush();
  m.Close();
  </code></pre>
  
  <p>Fails with OOM</p>
  
  <pre><code>XslCompiledTransform cxslt = new XslCompiledTransform();
  cxslt.Load(xslWith100ThousandLines);
  MemoryStream m = new MemoryStream();
  cxslt.Transform(myXPathDocument, null, m);
  m.Flush();
  m.Close();
  </code></pre>