首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从XSLT生成IE版本的条件注释块

从XSLT生成IE版本的条件注释块
EN

Stack Overflow用户
提问于 2014-09-05 01:09:21
回答 1查看 841关注 0票数 0

我正在尝试添加这些条件注释:

代码语言:javascript
复制
<!doctype html>
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]>    <html class="ie7"> <![endif]-->
<!--[if IE 8 ]>    <html class="ie8"> <![endif]-->
<!--[if IE 9 ]>    <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
<head>

添加到xsl文件:

代码语言:javascript
复制
<xsl:comment>
      <![CDATA[[if lt IE 7 ]> <head class="ie6"> <![endif]]]>
      <![CDATA[[if IE 7 ]>    <head class="ie7"> <![endif]]]>
      <![CDATA[[if IE 8 ]>    <head class="ie8"> <![endif]]]>
      <![CDATA[[if IE 9 ]>    <head class="ie9"> <![endif]]]>
      <![CDATA[[if (gt IE 9)|!(IE)]><!--> <head class=""> <!--<![endif]]]>
    </xsl:comment>

不过,我的xsl语法有问题。任何人都能看到吗?

EN

回答 1

Stack Overflow用户

发布于 2014-09-05 01:25:36

这些条件中的每一个都需要是单独的<xsl:comment>

代码语言:javascript
复制
<xsl:comment><![CDATA[[if lt IE 7 ]> <html class="ie6"> <![endif]]]></xsl:comment>
<xsl:comment><![CDATA[[if IE 7 ]> <html class="ie7"> <![endif]]]></xsl:comment>
<xsl:comment><![CDATA[[if IE 8 ]> <html class="ie8"> <![endif]]]></xsl:comment>
<xsl:comment><![CDATA[[if IE 9 ]> <html class="ie9"> <![endif]]]></xsl:comment>
<xsl:comment>[if (gt IE 9)|!(IE)]></xsl:comment>
<html class=""> <xsl:comment><![endif]</xsl:comment>
  <!-- rest of the content goes here -->
</html>
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25671286

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档