我已经看到了这个资源链接文本,但我仍然无法使用 MSXML 解析器生成有效的 XHTML 文档。
我输入了以下文件:
<?xml version="1.0" encoding="UTF-8" ?>
- <html xml:lang="it" xmlns="http://www.w3.org/1999/xhtml">
- <head xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Bla bla bla</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/bla.css" />
</head>
- <body xmlns="" style="background-color:#DFDFDF;left-margin:0;margin-top:0">
....
</body>
</html>
因为我插入了指令,所以产生了讨厌的 xmlns="" :
parserInstance.documentElement.setAttribute "xmlns", "http://www.w3.org/1999/xhtml"
在转换之前创建输入文档时。
XSLT 导入我用于捕获 html 元素的转换
<xsl:stylesheet
version="1.0"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xhtml xsl"
>
<xsl:import href="_lib.xsl"/>
<xsl:import href="_standard.xsl"/>
在 _standard.xsl 我有进行相关转换的代码:
<xsl:template match="html">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates select="head" />
<xsl:apply-templates select="body" />
</xsl:copy>
我仍然在 html 标记中没有所需的 xmlns:
<html xml:lang="it">
而且我仍然在 html 代码中穿插了令人讨厌的 xmlns:
<h1 xmlns="http://www.w3.org/1999/xhtml">BLA BLA</h1>
我哪里错了?
请注意:我必须使用拉模型进行转换,我不能使用身份转换