I am wondering why this Docbook 5.0 document is not valid:
<?xml version='1.0' encoding='utf-8'?>
<article xmlns='http://docbook.org/ns/docbook' xmlns:xlink='http://www.w3.org/1999/xlink' version='5.0'>
<section xml:id='H_0'>
<title>This is a title</title>
<para>
Blah <link linkend='H_0'>This is a link</link>blah blah blah.</para>
</section>
</article>
Here is what I get from xmlstarlet:
$ xmlstarlet val --err --xsd /usr/share/xml/docbook/schema/xsd/5.0/docbook.xsd test.xml
test.xml:3.22: Element '{http://docbook.org/ns/docbook}section', attribute '{http://www.w3.org/XML/1998/namespace}id': '' is not a valid value of the atomic type 'xs:ID'.
test.xml:6.25: Element '{http://docbook.org/ns/docbook}link', attribute 'linkend': '' is not a valid value of the atomic type 'xs:IDREF'.
test.xml - invalid
I just want internal links in the document, to the sections.
Addition: maybe this is an xmlstarlet problem, as other tools happily process the files. Anyway, I'd be glad if somebody could explain the problem.
Maybe it’s a bug in the version of
xmlstarletyou have installed? It works for me on Debian:Here’s my
xmlstarletversion info:Incidentally, though, the DocBook document in the question isn’t actually valid—because a DocBook
articleelement must have either atitleorinfochild:See http://tdg.docbook.org/tdg/5.0/article.html:
The lack of a
?question mark aftertitleandinfothere, combined with theOne ofmeans that one or the other oftitleorinfois required.I’m surprised the XSD schema doesn’t catch that. But I guess maybe it’s an indication that to make sure your DocBook documents actually are valid, you probably want to consider validating against the RelaxNG schema (
/usr/share/xml/docbook/schema/rng/5.0/docbook.rngfile) instead.