XslTransform appears to have been deprecated by Microsoft in favor of XslCompiledTransform. Theoretically, if I was doing just one transform during the execution of my application, shouldn't interpreting the XSLT (through XslTransform) be faster than compiling it? If so, is XslTransform written so badly that the improvements made to XslCompiledTransform more than compensate for it?
Well, you have the (slow) running time of XslTransform vs. the compile time of XslCompiledTransform plus its (fast) running time. There is no theoretical way to decide this comparison conclusively.
Theory suggests: running times depend on input and required operations and compile time depends on complexity of the XSLT. Practice confirms that with trivial input and complex XSLT one time execution XslTransform is definitely be faster.
However, for all real applications you will want XslCompiledTransform if only for the fact that XslTransform is deprecated and may very well contain flaws that will never be fixed. I actually had some stylesheets behaving strangely under XslTransform and running perfectly under XslCompiledTransform.
You should use XslCompiledTransform in any case since XslTransform is depreciated and may be removed from future versions of the framework.
You might want to see the documented differences between XslTransform
and XslCompiledTransform
here and here, and make the decision yourself.
In addition, there are some cases in which XslTransform is more incompliant. More work was done on security in XslCompiledTransform.
So, a lot of reasons one should consider using the new XslCompiledTransform
instead of the old XslTransform
, even in cases where the transformation will be run only once and could be slightly faster with the old XslTransform.