<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
它在 DOCTYPE 中出现解析错误。如何解决?
最佳答案
W3C HTML 5 Reference建议使用 doctype-system="about:legacy-compat"
:
For compatibility with legacy producers of HTML — that is, software that outputs HTML documents — an alternative DOCTYPE is available for use by systems that are unable to output the DOCTYPE given above. This limitation occurs in software that expects a DOCTYPE to include either a PUBLIC or SYSTEM identifier, and is unable to omit them. The canonical form of this DOCTYPE is as follows:
<!DOCTYPE html SYSTEM "about:legacy-compat">
您可以通过以下任何 XSLT 处理器实现此目的:
<xsl:output method="html" doctype-system="about:legacy-compat" />
它将生成:
<!DOCTYPE HTML SYSTEM "about:legacy-compat">
关于php - 文档类型错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12128031/