问题描述
如果我具有以下Docbook 5 XML:
If I have the following Docbook 5 XML:
<article xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0">
<title>Test</title>
<section>
<title>LS command</title>
<para xml:id="ls">
This command is a synonym for <command linkend="dir">DIR</command> command.
</para>
<para xml:id="dir">
This command is a synonym for <command linkend="ls">LS</command> command.
</para>
<para>
<application xl:href="http://www.gnu.org/software/emacs/">Emacs</application>
</para>
</section>
</article>
,我尝试根据从此处下载的Docbook 5 DTD进行验证. a>与:
and I attempt to validate it against the Docbook 5 DTD downloaded from here with:
xmllint --noout --dtdvalid docbook.dtd test.xml
我收到以下错误:
test.xml:1: element article: validity error : No declaration for attribute xmlns:xl of element article
test.xml:11: element application: validity error : No declaration for attribute href of element application
但是,如果我将xl
命名空间更改为xlink
,就像这样:
However, if I change the xl
namespace to xlink
, like so:
<article xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
<title>Test</title>
<section>
<title>LS command</title>
<para xml:id="ls">
This command is a synonym for <command linkend="dir">DIR</command> command.
</para>
<para xml:id="dir">
This command is a synonym for <command linkend="ls">LS</command> command.
</para>
<para>
<application xlink:href="http://www.gnu.org/software/emacs/">Emacs</application>
</para>
</section>
</article>
一切都很好.我从Docbook文档此处中获得了xl
命名空间(以及使用示例带有外部参照的应用程序的文章直接来自该文档.
Everything validates just fine. I got the xl
namespace from the Docbook documentation here (and the example of using an article with an application that had a xref is straight from that documentation).
那么为什么xl
成功后xl
会失败?
So why does xl
fail when xlink
succeeds?
推荐答案
问题实际上是DocBook 5.0 DTD专门列出了xlink:href属性,而其他属性均无效.
The issue was actually that the DocBook 5.0 DTD specifically listed the xlink:href attribute, and any others were not valid.
这篇关于在Docbook 5中使用正确的xlink名称空间是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!