Can You Minify or Compress XSL?

I got this question in one of my courses over at the USPJ Academy, and I though the answer might be more widely useful.

JavaScript files (and CSS files) can be minified for production use) – ref. your post on the JavaScript CompressorRator. I was  wondering – by pure curiosity – if compressing xsl templates would make sense? Could not find anything on MSDN or searching via Google (except this but it sent back an error).

And my reply…

No, you can’t compress XSL with SharePoint, nor would it really make much sense. The reason we compress (or ‘minify’) script is to reduce the number of bytes over the wire and to reduce processing time in the browser. (Both of these concerns are becoming less and less important, as bandwidth and processing power continue to get faster and cheaper.) The only other mini-benefit is some small obfuscation of your code, but it’s really not because if you know what you’re doing, you can make sense of it.

XSL is interpreted on the server side, so there’s no “wire”, and you’ve got a powerful server (you do have a powerful server, right?) that can eat XSL for breakfast. So most, if not all of the benefits of minification are moot, and besides, the XSL parser wouldn’t know what to do with compressed XSL, anyway.  XSL is interpreted, not compiled. You can remove some of the white space and comments, but you probably won’t see much of a performance advantage for it.

Make sense?

M.