IE conditional commenting in XSLT

It was meant to be an easy task. I had a menu template built in html and all I had do was move the formatting and structure into an XSLT document and then use this is display my XML data. You are all now shouting “Simples” or “Easy peasy”, as I did, but then I came across a stumbling block.

The problem was that the html that was produced for me contained Internet Explorer specific formatting like,

1
2
3
4
5
6
<ul class="level1">
<li><a href="/" title="Homepage">Home </a></li>
 
<li><a class="fly" href="/resorts.aspx" title="Resorts">Resorts<!--[if gte IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>

At this point I was still thinking ‘no problem’ as I just need to escape it or CDATA the text. No luck and the more things I tried the closer I got to having no solution.

At this point I thought that I would turn to my old friend Google and after a bit of searching I finally found the correct search string and came across XSLT – How to get IE consitional statements working in an XSTL on stackoverflow. Well I was of course overjoyed and put into the place the solution and a little while later all was done.

Bish bash bosh. Baked

Bookmark and Share
This entry was posted in XSLT and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">