2

我有看起来像这样的 XSL 代码......

<xsl:template name="doHeader">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />
<head>
    <xsl:processing-instruction name="IMPORT">
        namespace="search" implementation="../html/scripts/button.htc"
    </xsl:processing-instruction>
    <style type="text/css">
        @import url("../temp/theme.css");
        @import url("../html/css/view.css");
        @import url("../html/css/search.css");
    </style>
    <script src="../html/scripts/utils.js" />
    <script src="../html/scripts/search.js" />
</head>
</xsl:template>

(当然,我在 ie10 版本中添加了那个元标记)。无论如何,在ie9中运行的html中,有按钮的代码,但在ie10中,没有按钮代码。

ie9看起来像这样...

<TR><TD>
    <?import namespace = search urn = "_" implementation = "file:///C:/Users/.../button.htc" /><search:button onclick=handleSubmit() value="OK">
    <DIV>
    <DIV style="LINE-HEIGHT: 1px; BACKGROUND-COLOR: #a1b8c9; MARGIN: 0px 2px; DISPLAY: block; HEIGHT: 1px; FONT-SIZE: 1px">&nbsp;</DIV>
    <DIV style="BORDER-BOTTOM: #a1b8c9 0px solid; BORDER-LEFT: #a1b8c9 1px solid; LINE-HEIGHT: 1px; MARGIN: 0px 1px; DISPLAY: block; BACKGROUND: #eef5f9; HEIGHT: 1px; FONT-SIZE: 1px; BORDER-TOP: #a1b8c9 0px solid; BORDER-RIGHT: #a1b8c9 1px solid">&nbsp;</DIV>
    <DIV style="BORDER-BOTTOM: #a1b8c9 0px solid; POSITION: relative; TEXT-ALIGN: center; BORDER-LEFT: #a1b8c9 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eef5f9; PADDING-LEFT: 20px; PADDING-RIGHT: 20px; DISPLAY: block; FONT-FAMILY: tahoma; WHITE-SPACE: nowrap; COLOR: #000000; FONT-SIZE: 10pt; BORDER-TOP: #a1b8c9 0px solid; CURSOR: default; BORDER-RIGHT: #a1b8c9 1px solid; PADDING-TOP: 4px; TOP: 0px; LEFT: 0px" tabIndex=0>
    <DIV>OK</DIV>
    <P style="POSITION: absolute; COLOR: #ff0000; TOP: 5px; LEFT: 35px"></P></DIV>
    <DIV style="BORDER-BOTTOM: #a1b8c9 0px solid; BORDER-LEFT: #a1b8c9 1px solid; LINE-HEIGHT: 1px; MARGIN: 0px 1px; DISPLAY: block; BACKGROUND: #eef5f9; HEIGHT: 1px; FONT-SIZE: 1px; BORDER-TOP: #a1b8c9 0px solid; BORDER-RIGHT: #a1b8c9 1px solid">&nbsp;</DIV>
    <DIV style="LINE-HEIGHT: 1px; BACKGROUND-COLOR: #a1b8c9; MARGIN: 0px 2px; DISPLAY: block; HEIGHT: 1px; FONT-SIZE: 1px">&nbsp;</DIV></DIV></search:button>
</TD></TR>

但在 ie10 中它看起来像......

<TR><TD><search:button onclick=handleSubmit() value="OK"></search:button></TD></TR>

我需要做什么才能让 ie10 生成与 ie9 相同的(ish)html?

4

1 回答 1

2

在将 xml 转换为 html 时,我需要指定 UTF-8 字符集。我不得不将此标签添加到我的 XSL 文件的顶部。

<xsl:output method="html" encoding="UTF-8"/>

在某些文件中,<xsl:output method="html" />存在,但添加编码解决了问题。

于 2012-11-28T17:32:10.523 回答