tags:

views:

116

answers:

2

Ok so I've got a XSL file of handy templates in a file which a bunch of other XSL files include (using ) to keep my design nice and DRY.

I'm using .net to run the XSL files against my XML. Trouble is when I make a change to the child XSL files and rerun my tranformations (ie refresh the browser) the change is not shown, it won't be until I touch or tickle the parent file.

I think that .net is caching the XSL files, but as the child one is never directly called its not cached directly, it only gets refreshed when the parent one is re-cached. Sound plausable? Trouble is I can't find anything to back that hunch up.

Does anyone know if I'm right and more importantly does anyone know how I can prevent it happening on my development machine at least to speed up my code/refresh cycle?

Edit: I'm using XSL 1 and .net 1 too.

A: 

When you <xsl:include/> or <xsl:import/> other XSLT files the results of the iclude or import are cached until the parent stylesheet is re-loaded. There is no coupling between the parent and child stylesheets that would allow the child stylesheet to notify the parent that it was updated and needs to be re-imported.

For development purposes, the quickest way to handle this is to restart the AppDomain that you application is loaded in. For a Windows application this means restarting the application itself - for ASP.NET this means recylcing the AppPool that is hosting your website.

Andrew Hare
is it a .net thing though? No way of over-riding the caching? I'm pondering spending a lunch time creating a file watcher which could touch any templates which include my saved child files but it seem a arkward step to have to do
Pete Duncanson
Recylcing takes longer than having the parent file open, adding a space and saving the file :(
Pete Duncanson
+1  A: 

I've ended up creating a little helper program for this in .net which simple uses a filewatcher on my template folders and when a .xsl file is saved it does a quick regex throught all the other templates looking for any that include the saved file. If so then those file's modified dates get "tickled" which forces a refresh of .net's cache.

This works really well and is nice and seamless. SVN does not notice the tickled files as being modified either which is a bonus as it stops huge check ins. I'm hoping to tidy the code up and release it in the new year.

Watch this space :)

Pete Duncanson