[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Floris van Haaster

4/10/2006 3:12:00 PM

Hi all,

What I have:

I have a website and in the code I generate a xml document.
I also have a couple of xsl files and then I use the following lines to
generate the website from the xml and xsl:

xslTran.Load(serv.MapPath("default.xsl"))
xslTran.Transform(xmldoc, Nothing, Response.Output(), New XmlUrlResolver)
But now what i want to do is cache the default.xsl so the application
doesn't have to read the file @ avery request.

Does anybody know how to do this?

Thanks in advance!

Floris



1 Answer

Egil Hogholt

4/14/2006 6:48:00 PM

0

You can store the parsed xsl in the ASP.NET cache and make the cached
XslTransform object depend on the file so it is automatically removed from
the cache if the file is updated.

Something like this should work:

XslTransform xslTran = (XslTransform) Cache[fileName];
if (null == xslTran)
{
xslTran = new XslTransform();
xslTran.Load(fileName);
Caching.CacheDependency fileDependency = new
Caching.CacheDependency(fileName);
Cache.Insert(fileName, xslTran, fileDependency);
}

Cheers,
Egil
http://www....

"Floris van Haaster" <info@N0SPAMtunerz.nl> wrote in message
news:cdbce$443a75c4$3ec2f16a$1745@news.chello.nl...
> Hi all,
>
> What I have:
>
> I have a website and in the code I generate a xml document.
> I also have a couple of xsl files and then I use the following lines to
> generate the website from the xml and xsl:
>
> xslTran.Load(serv.MapPath("default.xsl"))
> xslTran.Transform(xmldoc, Nothing, Response.Output(), New XmlUrlResolver)
> But now what i want to do is cache the default.xsl so the application
> doesn't have to read the file @ avery request.
>
> Does anybody know how to do this?
>
> Thanks in advance!
>
> Floris
>
>
>