Search

In order to use IE universal stylesheet one should put extra dashes inside xsl:comment which isn’t possible. (not even with CDATA, or <xsl:text disable-output-escaping="yes">)

How to hide the IE6 only stylesheet from other browsers?

  • use conditional classes for IEus (need to include it in own stylesheet, missing advantage of googlecode hosted, and always loads)
  • import hack inside mean stylesheet but it hides to IE7 too, and the good stylesheets load too in IE
  • Just accept that the good stylesheets will load in IE too, and place the IEus link inside a conditional comment, last (so has cascade power over the good stylesheet)
  • maybe use alternative stylesheet, and switch ie6 to default with a meta conditional comment. (IE doesnt support switching, but surely understands default stylesheets?). Only selected (FF opera) or default stylesheets are actually loaded, but ofcourse IE6 probably still loads both.
  • considering the 2 points above , one migth chose to link respectively the good and the IEus as default and alternative. Since IE6 doesnt support ss switching, you dont even need a conditional comment, it will load both and give cascading preference to the last one; the ie (alterantive for modern browsers)
<xsl:comment><![CDATA[[if IE 6]><link rel="stylesheet" type="text/css" href="]]><xsl:value-of select="$root"/><![CDATA[/workspace/assets/css/ie6.css" media="screen" /><![endif]]]></xsl:comment>

@designermonkey
Thats just to serve ie.css to ie. To clarify, I want to hide the other stylesheet from IE6, like this;

<!--[if ! lte IE 6]><!-->
/* Stylesheets for browsers other than Internet Explorer 6 */
<!--<![endif]-->

There is no way to get the additional <!--> and <!-- inside a xslt comment… unless… http://www.xml.com/pub/a/2000/09/13/xslt/index.html

I don’t understand why you would want the extra and <!—

Using conditional comments the same way, but changing your condition should do the trick as you require..

Oh, hang on now I understand, it would be a comment to all other browsers otherwise…

I didn’t realise how hard it was to do this, I assumed it would be possible. That’s got me thinking for my own project now…

Maybe this would help, although it is ugly hacks in your CSS

@newnomad

If I am understanding you correctly, I think this is what you are looking for:

      <xsl:comment>[if gt IE 6]<![CDATA[><!]]></xsl:comment>
        <link type="text/css" rel="stylesheet" href="{$workspace}/stylesheets/site.css" />
      <xsl:comment><![CDATA[<!]]>[endif]</xsl:comment>

It will hide the CSS from any version of IE below 7, but let any version of Safari, Opera, Firefox, etc. see the file. Took me quite a bit of experimentation to figure this one out. It will produce:

<!--[if gt IE 6]><!-->
    <link type="text/css" rel="stylesheet" href="http://www.url.com/workspace/stylesheets/home.css"/>
<!--<![endif]-->

Great! Indeed quite some experiments, mine had failed before folowing this route, but you nailed it!

I never thought about it that way! Brilliant!

I would still technically consider this a hack, but I think at this point it’s the best option of many evils.

what XSL hero could get the Conditional Comment trick from HTML5boilerplate.com to work?

The tricky part seems the very last statement (not IE OR greater than IE9): this needs comments in comments in comments :-/

I got the first part, which seems to boil down to:

<xsl:comment><![CDATA[[if lt IE 7]><body class="ie ie6 lte9 lte8 lte7"><![endif]]]></xsl:comment>
<xsl:comment><![CDATA[[if IE 7]><body class="ie ie7 lte9 lte8 lte7"><![endif]]]></xsl:comment>
<xsl:comment><![CDATA[[if IE 8]><body class="ie ie8 lte9 lte8"><![endif]]]></xsl:comment>
<xsl:comment><![CDATA[[if IE 9]><body class="ie ie9 lte9"><![endif]]]></xsl:comment>

Now the only thing added needs to be: <!--[if (gt IE 9)|!(IE)]><!--> <body> <!--<![endif]-->

@davidhund -

Try this…

<xsl:comment><![CDATA[[if lt IE 7]><body class="ie ie6 lte9 lte8 lte7"><![endif]]]></xsl:comment>
<xsl:comment><![CDATA[[if IE 7]><body class="ie ie7 lte9 lte8 lte7"><![endif]]]></xsl:comment>
<xsl:comment><![CDATA[[if IE 8]><body class="ie ie8 lte9 lte8"><![endif]]]></xsl:comment>
<xsl:comment><![CDATA[[if IE 9]><body class="ie ie9 lte9"><![endif]]]></xsl:comment>
<xsl:comment><![CDATA[[if IE]><![if (gt IE 9)|!(IE)]><![endif]]]></xsl:comment><body>
<xsl:comment><![CDATA[[if IE]><![endif]><![endif]]]></xsl:comment>

Hmmm the above threw errors for me, but this seemed to work:

<xsl:comment><![CDATA[[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]]]></xsl:comment>

<![CDATA[[if IE 7]> <![endif]]]><![CDATA[[if IE 8]> <![endif]]]>[if (gte IE 9)|!(IE)]<![CDATA[><!]]><![CDATA[<!]]>[endif]

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

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