xmldtdrelaxngdocbook-5

Discrepancy between docbook.dtd and docbook.rng on the DocBook 5.0 Distribution


When I validate my document using RelaxNG and the docbook.rng schema provided on the DocBook 5.0 distribution, errors like this crop up,

error: attribute "title" not allowed at this point; ignored

and the offending XML element is informaltable. In fact, I read on the O'Reilly site that the basic definition of an informaltable is a table without a title. However, the docbook.dtd DTD, that is provided on that same distribution, specified the title as an attribute on an informatltable. So is this an error in the DTD?

DTD snippet, included here, for reference. If this DTD is indeed incorrect, is there a correct one around somewhere, or can I generate it somehow?

<!ELEMENT informaltable (info?, ((textobject*, (mediaobject+|tgroup+))|((col*|colgroup*), thead?, tfoot?, (tbody+|tr+))))>

<!ATTLIST informaltable
    xmlns   CDATA   #FIXED  "http://docbook.org/ns/docbook"
    role    CDATA   #IMPLIED
    %db.common.attributes;
    %db.common.linking.attributes;
    tabstyle    CDATA   #IMPLIED
    floatstyle  CDATA   #IMPLIED
    orient  (land|port) #IMPLIED
    colsep  (0|1)   #IMPLIED
    rowsep  (0|1)   #IMPLIED
    frame   (all|bottom|none|sides|top|topbot|void|above|below|hsides|lhs|rhs|vsides|box|border)    #IMPLIED
    pgwide  (0|1)   #IMPLIED
    rowheader   (firstcol|norowheader)  #IMPLIED
    class   CDATA   #IMPLIED
    style   CDATA   #IMPLIED
    title   CDATA   #IMPLIED
    lang    CDATA   #IMPLIED
    onclick CDATA   #IMPLIED
    ondblclick  CDATA   #IMPLIED
    onmousedown CDATA   #IMPLIED
    onmouseup   CDATA   #IMPLIED
    onmouseover CDATA   #IMPLIED
    onmousemove CDATA   #IMPLIED
    onmouseout  CDATA   #IMPLIED
    onkeypress  CDATA   #IMPLIED
    onkeydown   CDATA   #IMPLIED
    onkeyup CDATA   #IMPLIED
    summary CDATA   #IMPLIED
    width   CDATA   #IMPLIED
    border  NMTOKEN #IMPLIED
    rules   (none|groups|rows|cols|all) #IMPLIED
    cellspacing CDATA   #IMPLIED
    cellpadding CDATA   #IMPLIED

>

Solution

  • The DocBok 5.0 DTD is only an approximation. A document that validates against the DTD is not necessarily valid against the normative RELAX NG schema.

    DocBook supports two types of table structures, CALS and HTML. The title attribute on informaltable is only supported in HTML tables. The RELAX NG schema can distinguish between these two types of tables (with the same name), but in a DTD it is not possible to enforce the restriction that title is allowed only in HTML tables.

    See also https://docbook.org/docs/howto/howto.html#introduction-schemas.