is it possible to put a cache the instance of XslCompiledTransform after Loading?
-
16-01-2021 - |
Question
I need to save the result of the instance of XslCompiledTransform after the call of load method how can I do that?
Solution
Just use System.Web.Caching
(it works OK outside of ASP.NET!):
http://www.hanselman.com/blog/UsingTheASPNETCacheOutsideOfASPNET.aspx
OTHER TIPS
Save to Application scope variable:
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("style.xsl");
Application["CompiledTransform"] = xslt;
use somewhere else later:
XslCompiledTransform xs = Application["CompiledTransform"] as XslCompiledTransform;
xs.Transform("input.xml", "output.xml");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow