The Crash Course to DocBook

4.2. Using Entities to Include Other files

The document type declaration is also the right place to include other files. The documentation usually tend to become very big, so it's a good idea to split it into several files that are included into a single main file like this:

Example 4-2. Entities used to include other files


<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" [
  <!ENTITY introduction SYSTEM "introduction.docbook">
  <!ENTITY marketing SYSTEM "marketing-plan.docbook">
  <!ENTITY advertising SYSTEM "advertising-campain.docbook">
  <!ENTITY conclusion SYSTEM "conclusion.docbook">
  <!ENTITY cereals "<productname>Frobozz Cerals</productname>">
  <!ENTITY orange-juice "<productname>Hourmade Orange Juice</productname>">
]>
 
<book id="marketing-study" lang="en">
 
<bookinfo>
<title>Marketing study about &cereals;</title>
</bookinfo>
 
&introduction;
&marketing;
&advertising;
&conclusion;

</book>

Of course, you must create files named introduction.docbook, marketing-plan.docbook, etc, that will hold your chapters, to make this example work.