IE Conditional Tag with XSLT

Another hack in the life of UI developer, dont know for how long we have to take this burden.

Well, you are here because you are using XSLT and have noticed that IE conditional tag or comment is not showing up in output of XSLT transformation. What could be the reason?

Reason is that XSLT transformation does not output comments given in XSL sheets to HTML stream. So how to use IE conditional tags when you really need them.

The answer is tag + CDATA (Unparsed Character Data) tag. Following is the example showing correct way of doing it:

before (not working):

after (working perfectly):
something speical for Internet Explorer

In the example above we are using tag to output to HTML stream and using CDATA type to outupt rest of the code inside the comment tags. So one little hack and desired output presented.

 Scroll to top