What is the correct xlink namesapce to use in Docbook 5?

回眸只為那壹抹淺笑 提交于 2019-12-13 21:24:04

问题


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>

and I attempt to validate it against the Docbook 5 DTD downloaded from here with:

xmllint --noout --dtdvalid docbook.dtd test.xml

I get the following error:

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

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>

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).

So why does xl fail when xlink succeeds?


回答1:


The issue was actually that the DocBook 5.0 DTD specifically listed the xlink:href attribute, and any others were not valid.



来源:https://stackoverflow.com/questions/21152687/what-is-the-correct-xlink-namesapce-to-use-in-docbook-5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!