Is there a way to cache includes in xslt?

Viewed 24

When transforming on client side, the browser gets all the includes everytime the transformation is applied. I find it makes the application run slower.

Is there a way, with XSLT, to cache the includes so it does not download each file everytime is used again?

I am using a service worker now but I was wondering if there is another way.

1 Answers

I would have expected the included files to be cached the way everything else is. However, even if it's cached, there's still a signficant cost in that you're compiling the stylesheet every time it's used. The way to avoid that is to redesign your site as a "single page application", so following a link loads new content and transforms it using the existing already-loaded stylesheet.

SaxonJS [disclaimer: my company's product] is designed very much on the basis that you will compile the stylesheet once and then use it repeatedly. You can even precompile the stylesheet on the server.

Related