设置XSL文档类型 [英] Setting XSL doctype
问题描述
我在查看IE8 +中的应用程序时遇到问题...具体来说,在IE9中,当打开开发人员工具时,似乎IE7标准设置为文档模式。查看源代码时,我认为问题出在我的文档类型显示为:
I have an issue viewing an application in IE8+... Specifically, in IE9, when opening developer tools, its seems IE7 Standards is set as Document Mode.. Upon viewing source, i think the issue is with my doctype displaying as:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
看看我的代码,这是我的文档类型设置的方式:
Looking at my code, here is how my doctype is set:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" version="4.01" doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd" indent="yes"/>
如何将其修改为< doctype html>
谢谢
更新:
在以下位置进一步查看代码:
Looking through the code further, within the:
<xsl:template match="/">
部分,没有元设置。
推荐答案
简而言之,你做不到。 <!DOCTYPE html>
(根据HTML5规范故意)没有有效的XML文档类型(也没有有效的SGML,HTML 4也是如此)。
In short, you can't. <!DOCTYPE html>
is (deliberately by the HTML5 spec) no valid XML doctype (and no valid SGML, too, which HTML 4 was).
HTML5规范规定了此doctype,而不是:
The HTML5 spec dictates this doctype, instead:
<!DOCTYPE html SYSTEM "about:legacy-compat">
您可以使用以下输出
生成它:
You can generate it with this output
:
<xsl:output method="xml" doctype-system="about:legacy-compat"/>
但是,当XSLT处理器想要处理/验证系统标识符时,它将失败。 AFAIK,它应该可以在MSXML中工作。
However, when the XSLT processor wants to process/validate the system identifier, it will fail. AFAIK, it should work in MSXML.
这篇关于设置XSL文档类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!