Link to home
Start Free TrialLog in
Avatar of qwertq
qwertq

asked on

XSL: How to output <!--[if lt IE 7.]>

How can I output this code:
                  <!--[if lt IE 7.]>
                  <script defer type="text/javascript" src="..."></script>
                  <![endif]-->

I have tried wrapping it in xsl:text, but the <!-- is preventing xsl from outputting it to page because it thinks its a comment.
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

<xsl:text disable-output-escaping="yes><!--[if lt IE 7.]></xsl:text>
ASKER CERTIFIED SOLUTION
Avatar of zc2
zc2
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of qwertq
qwertq

ASKER

           <xsl:text disable-output-escaping="yes><!--[if lt IE 7.]></xsl:text>
                  <script defer type="text/javascript" src="whatever.js"></script>
            <xsl:text disable-output-escaping="yes><![endif]--></xsl:text>

Doesn't work.
Fatal Error 38: Unescaped '<' not allowed in attributes values
Fatal Error 65: attributes construct error

yes, I already corrected  that in my follow-up. EE screwed up the &amp;lt; and made it a <
putting the solution in the code snippet pane solved that

By the way
you now have two answers, and so you have the two options you would have for this task.

What zc2 proposes is more true to the nature of XSLT... keep it wellformed.
It has the disadvantage that you need to know what comes inside the comment almost beforehand

Mine is a dirty trick (you should avoid using disable-output-escaping as much as possible)
But it leaves you the possibility to dynamically fill in the bit between the comment opening and the comment closing
Avatar of qwertq

ASKER

I had not seen the follow up response Gertone when I posted my message.

Both solutions work. I am going to split points because they both work for my problem. Not sure which one I will settle on.

Thanks both.