A new XSLT utility, "HTML5 Master Stylesheet (XHTML syntax with indenting)" is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

great utility. this saved me a lot of trouble.

can you think of why the final line of the ie conditionals might show up as text in ie 7 and 8?

I can't, and didn't realise this happens to be honest. I'll see what happens in my IE 7 and 8 over the weekend, but if you figure it out please let me know.

I can't reproduce this. Could you post a screenie so that I'm sure I understand what's happening?

Maybe IE7 doesn't understand double figure version numbers for conditional comments?

That conditional comment looks strange anyway. Has someone verified that it is correct?

Good spot Michael!

It isn't valid at all.

<xsl:comment><![CDATA[[if (gte IE 10)|!(IE)]]]></xsl:comment> <html lang="en" class="no-js"> <xsl:comment><![CDATA[[endif]]]></xsl:comment>

Outputs two comments, which start with <!-- when the ending IE Conditional should start with just <!

Should it not just be:

<xsl:comment><![CDATA[[if (gte IE 10)|!(IE)]><html lang="en" class="no-js"><![endif]]]></xsl:comment>

What you've suggested there designermonkey gives me an opening and ending tag mismatch. I think this is because the html tag isn't opened.

I'm not sure (and am getting confused by all these opening/closing comments and conditionals!), but I'm not convinced that the output is invalid. Why should the ending IE conditional start with just <! ? It was intended to be a downlevel-revealed conditional.

Is anyone other than fawx getting this behaviour in IE7? I've had it tested in both IETester and native IE7 and am not seeing it.

Update: I'm re-reading the MS page - am confused!

Update 2: I'm now thinking both of the conditional comments on the line in question should start with <!. This should mean that IE5 - 9 will ignore what's inside as it will evaluate to false, and that non-IE browsers will render what's inside.

So this means we can't use <xsl:comment>...

Update 3: I still think it "should" work as it currently is in the utility. The output this gives is:

<!--[if (gte IE 10)|!(IE)]><!-->
<html lang="en" class="no-js">

That should allow all IEs to ignore the html tag (which has already been opened for them) and allow all other browsers to render the html tag.

I've edited the above post a few times...

It would be good to hear how it works for others in native IE7 in case this problem is related to some other issue. An example of it in use at an in-progress site.

IE 10 is dropping support of conditional comments, so shouldn't be IE gt 9?

<!--[if (gt IE 9)|!(IE)]><!-->
<html lang="en" class="no-js">

Take a look at the HTML5 Boilerplate project again. There has been quite a lot of discussion around the CC setup which could helpful I think (see esp. #425).

Anyway their current use of CC's leaves out IE9 and !IE altogether and ends with:

<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->

**I find trying to adapt these CC's for use in our XSL template a huge PITA and actually consider falling 'back' to simple 'Safe CSS hacks' since IE9 is doing quite well, IE10 will not support CC's anyway.

Thanks for the info chaps. I didn't know IE10 won't use IE conditionals.

I'll update and reply here so fawx can retest.

if i'm the only one having the issue, then i very well could have ballsed up the condtionals in some way. regardless, after the discussion here, it's likely i'm going to stop using cc's altogether simply because out of the dozens of sites i've done since using the cc trick, i've only used it once or twice, and that's been for ie7 and 8 which are easy enough to test for on their own.

HTML5 Master Stylesheet (XHTML syntax with indenting) updated to version 0.2 on 14th of September 2011

Conditional comments updated. I've done it slightly differently to HTML5 Boilerplate to enable targeting of IE9, just in case it's required. I've tested this in both virtualised IE7 and in IETester, and don't see any unwanted comments on the page.

<!--[if IE 6]> <html lang="en" class="no-js ie6 lte-ie9 lte-ie8 lte-ie7 lte-ie6 gte-ie6"> <![endif]-->
<!--[if IE 7]> <html lang="en" class="no-js ie7 lte-ie9 lte-ie8 lte-ie7 gte-ie7 gte-ie6"> <![endif]-->
<!--[if IE 8]> <html lang="en" class="no-js ie8 lte-ie9 lte-ie8 gte-ie8 gte-ie7 gte-ie6"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="no-js ie9 lte-ie9 gte-ie9 gte-ie8 gte-ie7 gte-ie6"> <![endif]-->
<!--[if !(lte IE 9)]><!-->
<html lang="en" class="no-js">

I also added viewport and X-UA-Compatible meta tags as these are becoming commonplace.

this is working marvelously for me. i wonder what i screwed up?

thanks, david!

Good to hear.

I say we blame it on Microsoft.

HTML5 Master Stylesheet (XHTML syntax with indenting) updated to version 0.2.1 on 7th of November 2011

No changes to the actual utility to speak of - just removing the instructions to edit the number of lines parsed by the HTML5 Doctype extension as bauhouse has upped the number to 15.

Thanks, David! I hope that number wasn't too arbitrary. I'm starting to think that I really should add a preferences page to the HTML5 Doctype extension for the value that sets the number of lines to parse and a way to exclude pages from being parsed.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details