Solved

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

Posted on 2008-10-28
7
2,001 Views
Last Modified: 2013-11-18
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.
0
Comment
Question by:qwertq
  • 4
  • 2
7 Comments
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 22821888
<xsl:text disable-output-escaping="yes><!--[if lt IE 7.]></xsl:text>
0
 
LVL 18

Accepted Solution

by:
zc2 earned 125 total points
ID: 22821897
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
 
LVL 60

Assisted Solution

by:Geert Bormans
Geert Bormans earned 125 total points
ID: 22821918
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:qwertq
ID: 22821993
           <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
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 22822034
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
 

Author Comment

by:qwertq
ID: 22822084
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
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 22822108
welcome
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Migrating to Exchange 2013 4 42
Google adds suggestions 3 58
Advice on what platform to use for a web app for AWS 3 95
Question on web subscription for apps 3 92
When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
The viewer will learn how to count occurrences of each item in an array.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now