XML / XSLT条件注释IE样式表 [英] XML/XSLT conditional comment IE stylesheet
问题描述
我遇到一个问题,我似乎无法确定。我在不久之前在HTML中建立了一个网站,最近已经集成了Symphony CMS,并且不得不将一切都改为XML。
I'm having an issue that I just can't seem to figure out. I built a website not too long ago in HTML and have recently integrated Symphony CMS and have had to change everything to XML.
最初在我的头上,具体样式表,头像这样:
Originally in my head, I had a internet explorer specific stylesheet, the head looked something like this:
<head>
<link rel="stylesheet" href="../css/master.css" type="text/css" media="screen"></link>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="../css/ie.css"></link>
<script src="../js/html5shiv.js"></script>
<![endif]-->
</head>
由于切换,这个条件注释不再工作,我改变了这个,我的master.css正在被Chrome / Firefox等忽略...它只是为所有浏览器加载ie.css样式表。
Since switching, this conditional comment does no longer work, I've changed it to this but unfortunately, my master.css is getting ignored for Chrome/Firefox etc... It is just loading the ie.css stylesheet for all browsers.
<head>
<link rel="stylesheet" href="../css/master.css" type="text/css" media="screen"></link>
<xsl:comment>[if IE]<![CDATA[><!]]></xsl:comment>
<link rel="stylesheet" type="text/css" href="../css/ie.css"></link>
<script src="../js/html5shiv.js"></script>
<xsl:comment><![CDATA[<!]]>[endif]</xsl:comment>
</head>
对不起,我是相当新的,我只是不知道我做错了,我猜我可能需要某种类型的xsl:如果评论,但只是不知道如何去真的。我只需要一些将使chrome / firefox / opera / safari忽略ie.css样式表。
Sorry I'm fairly new at this and I'm just not sure what I'm doing wrong, I'm guessing I might need some sort of xsl:if comment but just not sure how to go about it really. I just need something that will make chrome/firefox/opera/safari ignore the ie.css stylesheet.
任何帮助将非常感谢!感谢
Any help would be greatly appreciated! Thanks
推荐答案
只需使用一个 xsl:comment
<![CDATA []]>
的内容
<head>
<link rel="stylesheet" href="../css/master.css" type="text/css" media="screen"></link>
<xsl:comment><![CDATA[[if IE 6]>
<link rel="stylesheet" type="text/css" href="../css/ie.css"></link>
<script src="../js/html5shiv.js"></script>
<![endif]]]></xsl:comment>
</head>
这篇关于XML / XSLT条件注释IE样式表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!