views:

28

answers:

1

I've noticed IE conditional statements don't work in the transformed XML document. How do I get IE 6 and above to process them.

Code as follows

'<!--[if IE 6]><style type="text/css" media="all">@import "/css/ie6.css";</style>'

Thanks.

A: 

I've noticed IE conditional statements don't work in the transformed XML document

This works for me with IE8:

XML file:

<?xml-stylesheet href="deleteIECond.xsl" type="text/xsl" ?>
<t/>

deleteIECond.xsl:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;

 <xsl:template match="/">
  <xsl:comment>[if gte IE 7]>
        &lt;SCRIPT LANGUAGE="Javascript">
        alert("Congratulations! You are running Internet Explorer 7 or greater.");
        &lt;/SCRIPT>
        &lt;P>Thank you for closing the message box.&lt;/P>
        <xsl:value-of disable-output-escaping="yes" select="'&lt;![endif]'"/>
  </xsl:comment>
 </xsl:template>
</xsl:stylesheet>

You can verify that this works. If negative, the most likely reason is security/permissions.

Also, please, note, that this isn't an XSLT question.

Dimitre Novatchev
There was no need for conditional stylesheets afterall. The issue was caused by the fact that I didn't include a doctype declaration, which sent IE into quirksmode, which resulted in my rules not being honored. Thanks for your help though!
Julian