我正在使用XSLT来创建HTML输出页面.我需要在输出页面添加一个doctype.我用谷歌搜索,这似乎能够让它工作:
<xsl:output
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
/>
Run Code Online (Sandbox Code Playgroud)
所以我将它添加到测试转换文件transform.xsl中:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
/>
<xsl:template match="/">
<html>
<head>
<title>test</title>
</head>
<body>
content!
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)
但输出HTML不包含doctype .... 其余的例子......很好.
我做错了什么,为什么不添加doctype?
谢谢!
编辑:问题解决了,我正在使用eXist,似乎xsl:output指令不起作用,解决方案:邮件列表