How to IE Conditional Comment in XSLT 1.0 inside tag?

Total Post:134

C#  Xslt  Xslt-2.0 
 1317  View(s)
Rate this:

How to display title (not as HTML comment) for IE6 only, if this line of code <a title="" href="#">some text</a> is in xsl file?

The options below don't work:

<a <![CDATA[[if IE 6]>title="hi"<![endif]]]> href="#">some text</a>

<a &lt;![if IE 6]&gt;"title="hi"&lt;![endif]&gt; href="#">some text</a>
  1. Post:149

    Re: How to IE Conditional Comment in XSLT 1.0 inside tag?

    I'm not aware of any conditional IE constructs other than those given in an HTML comment. To insert comments in XSL, you use <xsl:comment>:

    <xsl:comment><![CDATA[[if IE 6]>
        Special instructions for IE 6 here

    There is a specific reason why the CDATA follows the <xsl:comment on the same line here. IE does not recognize these comments unless the characters <!--[if IE 6]> are contiguous on a single line. The remaining portions, including the endif, can apparently be spread out onto succeeding lines.

    However, since you cannot put an HTML comment in the middle of a tag, as you were trying to do. Therefore, you will have to provide alternate versions of the entire <a> tag:

    <xsl:comment><![CDATA[[if IE 6]>
        <a title="hi" href="#">some text</a>
    <xsl:comment><![CDATA[[if gt IE 6]>
        <a href="#">some text</a>

    However, please note this MS link:

    Important As of Internet Explorer 10, conditional comments are no longer supported by standards mode.

      Modified On Apr-06-2018 04:49:49 AM