Inserting Internet Explorer specific scripts from XSLT

If you are working with generating an html page through xslt, you might be interested in loading some scripts just when the page is browsed from Internet Explorer (IE).

You can use the following XSLT section to include a IE specific script. In this case it will be for IE versions less than 9.


<xsl:text disable-output-escaping="yes">&lt;!--[if lt IE 9]&gt;&lt;script language="javascript" type="text/javascript" src="js/excanvas.min.js"&gt;&lt;/script&gt;&lt;![endif]--&gt;</xsl:text>

Your output will look like this:


<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="js/excanvas.min.js"></script><![endif]-->