为什么我的 XHTML5 页面会导致 IE 的怪异模式?
为什么我的 XHTML5 页面会导致 IE 出现怪异模式?
这是文档类型等,包括发送 MIME 类型和 的 PHP:
<?php header('Content-Type: application/xml;charset=UTF-8'); ?>
<?php echo '<?';?>xml version="1.0" encoding="UTF-8"?>
<?php echo '<?';?>xml-stylesheet type="text/xsl" href="ie-xhtml-fix.xsl"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr">
<head><meta charset="UTF-8" />
然后是 ie-xhtml-fix.xsl,来自 http://www.w3.org/MarkUp/2004/xhtml-faq#ie,是:
<stylesheet version="1.0"
xmlns="http://www.w3.org/1999/XSL/Transform">
<template match="/">
<copy-of select="."/>
</template>
</stylesheet>
抱歉我必须问。我似乎无法弄清楚这一点,我找不到任何有关可能导致问题的信息。我希望它能在 IE7 及更高版本中运行。
Why is my XHTML5 page causing IE's quirks mode?
Here is the doctype and such, including PHP which sends the MIME type and <?
:
<?php header('Content-Type: application/xml;charset=UTF-8'); ?>
<?php echo '<?';?>xml version="1.0" encoding="UTF-8"?>
<?php echo '<?';?>xml-stylesheet type="text/xsl" href="ie-xhtml-fix.xsl"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr">
<head><meta charset="UTF-8" />
Then ie-xhtml-fix.xsl, from http://www.w3.org/MarkUp/2004/xhtml-faq#ie, is:
<stylesheet version="1.0"
xmlns="http://www.w3.org/1999/XSL/Transform">
<template match="/">
<copy-of select="."/>
</template>
</stylesheet>
Sorry I have to ask. I can't seem to figure this out, I can't find any info about what could be causing the problem. I'm hoping for it to work in IE7 and up.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题似乎是您的 XSLT 模板将处理指令复制到输出,这意味着 IE 在 doctype 之前解析它们,这会导致 IE 进入 Quirks 模式。
请尝试使用此 XSLT:已
在 IE6 及更高版本中测试并工作。
The problem appears to be that your XSLT template is copying the processing instructions to the output, which means that they are parsed by IE before the doctype, and this causes IE to go into Quirks mode.
Try this XSLT instead:
Tested and working in IE6 and above.