Conditional Comments in XSLT

I’ve been meaning to blog this for a while having come across the problem on a project last year. When including conditional comments in a page rendered using XSL templates the comment has to be structured in a way that doesn’t break the stylesheet. While this sounds simple it took a few attempts to get a working solution.

<xsl:comment>[if lte IE 6]<![CDATA[>]]>
   &lt;link rel="stylesheet" type="text/css" href="styles.css" /&gt;
<![CDATA[<![endif]]]></xsl:comment>

The comment must be structured inside an <xsl:comment> block which, when rendered to the browser, becomes a standard html comment and the greater than and less than brackets on the stylesheet link itself must be entered using their respective character entity codes “&gt;” and “&lt;“.

No comments

2007 – My Year

So all too quickly another year draws to a close, for me a busy year, a year of change.

The year started with a new job, then in February I was my friends best man and in March we moved into our new house. We spent a couple of months travelling in Thailand, the UK and Italy through June and July and have spent the remaining months working on our new home. I have a new niece (in NZ) and a new nephew (in the UK) and am soon be a father myself.

Work wise, I have been busy improving my CSS and JavaScript mojo and have spent a lot of time wrangling MOSS.

So here’s looking forward to 2008 and all the new challenges and discoveries it will no doubt throw my way. Hopefully I’ll be able to devote a little more time to maintaining this blog!

No comments