Christophe Debove
Christophe Debove

Reputation: 6296

is it possible to put a cache the instance of XslCompiledTransform after Loading?

I need to save the result of the instance of XslCompiledTransform after the call of load method how can I do that?

Upvotes: 2

Views: 1054

Answers (2)

Dimitre Novatchev
Dimitre Novatchev

Reputation: 243529

Just use System.Web.Caching (it works OK outside of ASP.NET!):

http://www.hanselman.com/blog/UsingTheASPNETCacheOutsideOfASPNET.aspx

Upvotes: 1

Filburt
Filburt

Reputation: 18082

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");

Upvotes: 1

Related Questions