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.
<!--[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.
<xsl:text disable-output-escaping="y es><!--[if lt IE 7.]></xsl:text>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<xsl:text disable-output-escaping="y es><!--[if lt IE 7.]></xsl:text>
<script defer type="text/javascript" src="whatever.js"></script >
<xsl:text disable-output-escaping="y es><![endi f]--></xsl :text>
Doesn't work.
Fatal Error 38: Unescaped '<' not allowed in attributes values
Fatal Error 65: attributes construct error
<script defer type="text/javascript" src="whatever.js"></script
<xsl:text disable-output-escaping="y
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 &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
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
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.
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.
welcome