(.net) Changes to included child XSL file is not picked up until parent XSL file is touched?

StackOverflow https://stackoverflow.com/questions/1814056

  •  06-07-2019
  •  | 
  •  

Question

Update: To get around this problem I created a simply filewatcher which would "touch" the modified dates of any parent files which referenced the include file. Details are on our blog, http://offroadcode.com/blog/2010/4/28/xsltouch,-taking-the-pain-out-of-editing-included-xslt-templates/ /Update

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.

Was it helpful?

Solution

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 :)

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top