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.
qwertqAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
zc2Connect With a Mentor Commented:
Would as shown below be acceptable?
<xsl:comment><![CDATA[[if lt IE 7.]>
<script defer type="text/javascript" src="..."></script>
<![endif]]]></xsl:comment>

Open in new window

0
 
Geert BormansInformation ArchitectCommented:
<xsl:text disable-output-escaping="yes><!--[if lt IE 7.]></xsl:text>
0
 
Geert BormansConnect With a Mentor Information ArchitectCommented:
I should have pasted in the code snippet pane
<xsl:text disable-output-escaping="yes">&lt;!--[if lt IE 7.]></xsl:text>

Open in new window

0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
qwertqAuthor Commented:
           <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

0
 
Geert BormansInformation ArchitectCommented:
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
0
 
qwertqAuthor Commented:
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.
0
 
Geert BormansInformation ArchitectCommented:
welcome
0
All Courses

From novice to tech pro — start learning today.