XSL Optimization

July 5th, 2008

I've been benchmarking XSL-powered applications quite a bit lately, and I've come up with a few tips which have helped improve the performance of my apps:

  • Avoid "//" - it requires scanning the entire tree
  • Cache the parsed style sheet, if possible
  • Reduce the size of the XML document
  • Use keys, parameters, and variables as necessary to avoid repeating the same lookups
I've heard people say that including / importing stylesheets can have an adverse affect on performance, but I haven't noticed. It may cause a performance impact if the style sheets are not cached, but I'm caching mine and it doesn't make a difference.

It goes without saying that any dynamically generated content can be optimized through caching, and XSL is no exception.

Yearly Indexes: 2003 2004 2006 2007 2008 2009 2010 2011 2012 2013 2015 2019 2020 2022