【发布时间】:2011-07-31 05:48:52
【问题描述】:
我正在尝试清理一些 html。我已经把它们转换成 xhtml 了
$ tidy -asxml -i -w 150 -o o.xml index.html
生成的 xhtml 最终具有命名实体。 在这些 xhtml 上尝试 xsltproc 时,我不断收到错误。
$ xsltproc --novalid -o out.htm t.xsl o.xml
o.xml:873: parser error : Entity 'mdash' not defined
resources to storing data and using permissions — as needed.</
^
o.xml:914: parser error : Entity 'uarr' not defined
</div><a href="index.html#top" style="float:right">↑ Go to top</a>
^
o.xml:924: parser error : Entity 'nbsp' not defined
Android 3.2 r1 - 27 Jul 2011 12:18
如果我将 --html 添加到 xsltproc,它会抱怨具有相同名称的 name 和 id 属性的标签(这是有效的)
$ xsltproc --novalid --html -o out.htm t.xsl o.xml o.xml:845: element a: validity error : ID top already defined
<a name="top" id="top"></a>
^
xslt 很简单:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//*[@id=side-nav]"/>
</xsl:stylesheet>
为什么 --html 不起作用?它为什么抱怨?还是我应该忘记它并修复实体?
【问题讨论】:
-
那么问题是什么?我没有看到。