Search code examples
internet-explorerxsltconditional-comments

Conditional comment in XSL not working


I have added a conditional comment in XSL like

 <xsl:comment>          
    <![CDATA[
       [if IE]>
         <script type="text/javascript">
             registerDisplay = firstChild.currentStyle.display;
         </script>
       <![endif]            
     ]]>
 </xsl:comment>

I'm not seeing this my html source in IE. Any help is appreciated.


Solution

  • If you're unlucky with the xsl:comment, I think alternatively you could use

    <xsl:text disable-output-escaping="yes"><![CDATA[<!--[if IE]>
         <script type="text/javascript">
             registerDisplay = firstChild.currentStyle.display;
         </script>
       <![endif]-->]]>
    </xsl:text>