Pregunta

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?

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top