<!-- 

A simple checkbook DTD 

-->

<!-- parameter entities -->

<!ENTITY % basic.content '#PCDATA'>
<!ENTITY % entry.content 'amount, date, description?'>

<!-- main elements -->

<!ELEMENT checkbook    (deposit | payment)*>
<!ELEMENT deposit      (payor, %entry.content;)>
<!ATTLIST deposit      type (cash | check | direct-deposit | transfer) 
  #REQUIRED>
<!ELEMENT payment      (payee?, %entry.content;)>
<!ATTLIST payment      type (atm | check | debit) #REQUIRED>

<!-- basic elements -->

<!ELEMENT amount       (%basic.content;)*>
<!ELEMENT date         (%basic.content;)*>
<!ELEMENT payee        (%basic.content;)*>
<!ELEMENT payor        (%basic.content;)*>
<!ELEMENT description  (%basic.content;)*>
<!ATTLIST description 
  category (cash | entertainment | food | income | work) 'food'>


Example 5-3:

<!-- ================================================================== -->
<!--
     Barebones DocBook DTD Version 0.1
     Offered as a teaching tool, without any warranty whatsoever.

     Module dependencies: 
       1. Cals Table (XML) Version 1.0 by Norman Walsh
       2. ISO-8879 character entities

     Contact: Erik Ray <eray@oreilly.com>
-->

<!-- ================================================================== -->
<!--                       ATTRIBUTE GROUPS                             -->
<!--            Common attributes for list declarations.                -->
<!-- ================================================================== -->

<!ENTITY % common.atts "
                               id        ID        #IMPLIED
                               role      CDATA     #IMPLIED
                               xml:space (default | preserve) 'default'
">

<!ENTITY % id.required.atts "
                               id        ID        #REQUIRED
                               renderas  NMTOKEN   #IMPLIED
                               role      CDATA     #IMPLIED
                               xml:space (default | preserve) 'default'
">

<!-- ================================================================== -->
<!--                        ELEMENT GROUPS                              -->
<!--               Sets of elements for content models.                 -->
<!-- ================================================================== -->

<!ENTITY % block.group "
                                 blockquote
                               | figure
                               | note
                               | para
                               | programlisting
                               | table
">

<!ENTITY % chaplevel.group "
                                 appendix
                               | chapter
                               | preface
">

<!ENTITY % inline.group "
                                 acronym
                               | application
                               | citetitle
                               | command
                               | date
                               | emphasis
                               | filename
                               | firstterm
                               | quote
                               | sgmltag
                               | symbol
                               | systemitem
                               | xref
">

<!ENTITY % list.group "
                                 itemizedlist
                               | orderedlist
                               | variablelist
">

<!ENTITY % ubiq.group "
                                 indexterm
                               | graphic
                               | comment
">

<!-- ================================================================== -->
<!--                          CONTENT MODELS                            -->
<!--           Pre-fab content models for element declarations.         -->
<!-- ================================================================== -->

<!ENTITY % component.title.content "
                               title,
                               subtitle?
">

<!ENTITY % component.content "
                                 %block.group;
                               | %list.group;
                               | %ubiq.group;
">

<!ENTITY % indexterm.content "
                                 #PCDATA
                               | %inline.group;
">

<!ENTITY % para.content "
                                 #PCDATA
                               | footnote
                               | %inline.group;
                               | %ubiq.group;
">

<!ENTITY % title.content "
                                 #PCDATA
                               | %inline.group;
">


<!-- ================================================================== -->
<!--                     HIERARCHICAL ELEMENTS                          -->
<!-- ================================================================== -->

<!ELEMENT appendix (
                               %component.title.content;,
                               (
                                   %component.content;
                                 | sect1
                               )*
)>
<!ATTLIST appendix
                               %id.required.atts;
>

<!ELEMENT book (
                               title?, subtitle*, author?,
                               (
                                   %chaplevel.group;
                               )*
)>
<!ATTLIST book
                               %common.atts;
>

<!ELEMENT chapter (
                               %component.title.content;,
                               (
                                   %component.content;
                                 | sect1
                               )*
)>
<!ATTLIST chapter
                               %id.required.atts;
>

<!ELEMENT preface (
                               %component.title.content;,
                               (
                                   %component.content;
                                 | sect1
                               )*
)>
<!ATTLIST preface
                               %id.required.atts;
>

<!ELEMENT sect1 (
                               %component.title.content;,
                               (
                                   %component.content;
                                 | sect2
                               )*
)>
<!ATTLIST sect1
                               %id.required.atts;
>

<!ELEMENT sect2 (
                               %component.title.content;,
                               (
                                   %component.content;
                                 | sect3
                               )*
)>
<!ATTLIST sect2
                               %id.required.atts;
>

<!ELEMENT sect3 (
                               %component.title.content;,
                               (
                                   %component.content;
                               )*
)>
<!ATTLIST sect3
                               %id.required.atts;
>


<!-- ================================================================== -->
<!--                        BLOCK ELEMENTS                              -->
<!-- ================================================================== -->

<!ELEMENT author
                               (#PCDATA)*
>

<!ELEMENT blockquote (
                               title?,
                               (
                                   para
                                 | %ubiq.group;
                               )+
)>
<!ATTLIST blockquote
                               %common.atts;
>

<!ELEMENT comment 
                               (%para.content;)*
>
<!ATTLIST comment
                               %common.atts;
>

<!ELEMENT figure (
                               title, graphic
)>
<!ATTLIST figure
                               %id.required.atts;
>

<!ELEMENT footnote (
                               para+
)>
<!ATTLIST footnote
                               %common.atts;
>

<!NOTATION gif              SYSTEM "image/gif">
<!NOTATION eps              SYSTEM "image/eps">
<!ELEMENT graphic
                               EMPTY
>
<!ATTLIST graphic
                               fileref   CDATA     #REQUIRED
                               %common.atts;
>

<!ELEMENT note (
                               title?,
                               (
                                   %block.group;
                                 | %list.group;
                                 | %ubiq.group;
                               )*
)>
<!ATTLIST note
                               %common.atts;
>

<!ELEMENT para 
                               (%para.content;)*
>
<!ATTLIST para
                               %common.atts;
>


<!ELEMENT programlisting
                               (%para.content;)*
>
<!ATTLIST programlisting
                               xml:space (preserve) #FIXED 'preserve'
                               id        ID        #IMPLIED
                               role      CDATA     #IMPLIED
>

<!ELEMENT subtitle 
                               (%title.content;)*
>
<!ATTLIST subtitle
                               %common.atts;
>


<!-- Reference CALS table module. -->
<!ENTITY % calstbls PUBLIC
  "-//Norman Walsh//DTD CALS Table Model XML V1.0//EN"
  "calstblx.dtd">
%calstbls;

<!ELEMENT title
                               (%title.content;)*
>
<!ATTLIST title
                               %common.atts;
>


<!-- ================================================================== -->
<!--                        LIST ELEMENTS                               -->
<!-- ================================================================== -->

<!ELEMENT itemizedlist (
                               title?,
                               (
                                   %ubiq.group;
                                 | listitem
                               )+
)>
<!ATTLIST itemizedlist
                               %common.atts;
>

<!ELEMENT listitem (
                               (
                                   %block.group;
                                 | %list.group;
                                 | %ubiq.group;
                               )+
)>
<!ATTLIST listitem
                               %common.atts;
>

<!ELEMENT orderedlist (
                               title?,
                               (
                                   %ubiq.group;
                                 | listitem
                               )+
)>
<!ATTLIST orderedlist
                               numeration (arabic|alpha|roman) 'arabic'
                               %common.atts;
>

<!ELEMENT term 
                               (%para.content;)*
>
<!ATTLIST term
                               %common.atts;
>

<!ELEMENT variablelist (
                               title?,
                               (
                                   %ubiq.group;
                                 | varlistentry
                               )+
)>
<!ATTLIST variablelist
                               %common.atts;
>

<!ELEMENT varlistentry (
                               (%ubiq.group;)*,
                               term+,
                               (%ubiq.group;)*,
                               listitem,
                               (%ubiq.group;)*
)>
<!ATTLIST varlistentry
                               %common.atts;
>


<!-- ================================================================== -->
<!--                       INLINE ELEMENTS                              -->
<!-- ================================================================== -->

<!ELEMENT acronym           (%para.content;)*>
<!ATTLIST acronym
                               %common.atts;
>

<!ELEMENT application       (%para.content;)*>
<!ATTLIST application
                               %common.atts;
>

<!ELEMENT citetitle         (%para.content;)*>
<!ATTLIST citetitle
                               %common.atts;
>

<!ELEMENT command           (%para.content;)*>
<!ATTLIST command
                               %common.atts;
>

<!ELEMENT date              (%para.content;)*>
<!ATTLIST date
                               %common.atts;
>

<!ELEMENT emphasis          (%para.content;)*>
<!ATTLIST emphasis
                               %common.atts;
>

<!ELEMENT filename          (%para.content;)*>
<!ATTLIST filename
                               %common.atts;
>

<!ELEMENT firstterm         (%para.content;)*>
<!ATTLIST firstterm
                               %common.atts;
>

<!ELEMENT function          (%para.content;)*>
<!ATTLIST function
                               %common.atts;
>

<!ELEMENT quote             (%para.content;)*>
<!ATTLIST quote
                               %common.atts;
>

<!ELEMENT sgmltag           (%para.content;)*>
<!ATTLIST sgmltag
                               class     CDATA     #IMPLIED
                               %common.atts;
>

<!ELEMENT symbol            (%para.content;)*>
<!ATTLIST symbol
                               %common.atts;
>

<!ELEMENT systemitem        (%para.content;)*>
<!ATTLIST systemitem
                               role      (computer|url)   #REQUIRED
                               %common.atts;
>

<!ELEMENT xref              EMPTY>
<!ATTLIST xref
                               linkend   IDREF     #REQUIRED
                               format    CDATA     #IMPLIED
                               %common.atts;
>


<!-- ================================================================== -->
<!--                        INDEX ELEMENTS                              -->
<!-- ================================================================== -->

<!ELEMENT indexterm (
                               (
                                   primary
                                 | secondary
                                 | see
                                 | seealso
                               )*
)>
<!ATTLIST indexterm
                               class ( singular | startofrange
                                       | endofrange ) "singular"
                               startref  CDATA     #IMPLIED
                               %common.atts;
>

<!ELEMENT primary
                               (%indexterm.content;)*
>
<!ATTLIST primary
                               sortas    CDATA     #IMPLIED
                               %common.atts;
>

<!ELEMENT secondary
                               (%indexterm.content;)*
>
<!ATTLIST secondary
                               sortas    CDATA     #IMPLIED
                               %common.atts;
>

<!ELEMENT see
                               (%indexterm.content;)*
>
<!ATTLIST see
                               sortas    CDATA     #IMPLIED
                               %common.atts;
>

<!ELEMENT seealso
                               (%indexterm.content;)*
>
<!ATTLIST seealso
                               sortas    CDATA     #IMPLIED
                               %common.atts;
>


<!-- ================================================================== -->
<!--                ISO-8879 Entity modules                             -->
<!-- ================================================================== -->

<!ENTITY % ISOamso
    PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN//XML"
    "isoamso.ent"
>
<!ENTITY % ISOamsr
    PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN//XML"
    "isoamsr.ent"
>
<!ENTITY % ISOdia
    PUBLIC "ISO 8879:1986//ENTITIES Diacritical Marks//EN//XML"
    "isodia.ent"
>
<!ENTITY % ISOgrk3
    PUBLIC "ISO 8879:1986//ENTITIES Greek Symbols//EN//XML"
    "isogrk3.ent"
>
<!ENTITY % ISOlat1
    PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN//XML"
    "isolat1.ent"
>
<!ENTITY % ISOlat2
    PUBLIC "ISO 8879:1986//ENTITIES Added Latin 2//EN//XML"
    "isolat2.ent"
>
<!ENTITY % ISOnum
    PUBLIC "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN//XML"
    "isonum.ent"
>
<!ENTITY % ISOpub
    PUBLIC "ISO 8879:1986//ENTITIES Publishing//EN//XML"
    "isopub.ent"
>
<!ENTITY % ISOtech
    PUBLIC "ISO 8879:1986//ENTITIES General Technical//EN//XML"
    "isotech.ent"
>

%ISOamso;
%ISOamsr;
%ISOgrk3;
%ISOlat1;
%ISOlat2;
%ISOnum;
%ISOpub;
%ISOtech;

