docbookdocbook-5

Docbook: How to create an article with parts


I need to create a "Terms of Use" document that consists of three parts... and I've tried to create an article like this:

<!DOCTYPE article [
  ...
]>
<article xmlns="http://docbook.org/ns/docbook" version="5.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://docbook.org/ns/docbook http://docbook.org/xml/5.0/xsd/docbook.xsd"
  xmlns:xi="http://www.w3.org/2001/XInclude"
  xml:lang="en-US"
  xml:id="terms-of-use">
<info>
  <title>Terms of Use</title>
  <copyright>
    <year>2015</year>
    <holder>My Company, Inc.</holder>
  </copyright>
  <legalnotice>blah blah blah</legalnotice>
  <date>October 16, 2015</date>
  <releaseinfo>1.0</releaseinfo>
</info>
<part label="I">
  <title>Title Part One</title>
  <xi:include href="part-1/file-1.xml"/>
  <xi:include href="part-1/file-1.xml"/>
  <xi:include href="part-1/file-N.xml"/>
</part>
<part label="II">
  <title>Title Part Two</title>
  <xi:include href="part-2/file-1.xml"/>
  <xi:include href="part-2/file-1.xml"/>
  <xi:include href="part-2/file-N.xml"/>
</part>
</article>

The document above doesn't work because I guess it doesn't comply with the schema... Is there any helpful example that shows how to create an article with parts?


Solution

  • You can’t actually create a DocBook article that contains a part element. In DocBook, a part is a division in a book. I think what you want here instead is just the section element.

    You can of course title your sections as Part One, etc., and conceptually just think of them as “parts”—but in DocBook, the thing that’s actually given the special name part is a thing that’s restricted to modeling just the parts of a book, and section is a thing for modeling the parts (and sub-parts, recursively) of an article or of a chapter in a book.