#### 26.5.7 Specifying full ancestry for nested sections

When you have nested DocBook sections you must specify parentage starting with $top for every section title. For example:

    [DocBookParents]
    Heading1 = $top section
    Heading2 = $top section section
    Heading3 = $top section section section
    Heading4 = $top section section section section

Otherwise, the higher levels would also match the rule for the lower levels; so, for example, the following settings:

    [DocBookParents]
    Heading1 = section
    Heading2 = section section

would allow another Heading1 section to follow a Heading2 section without closing the lower-level Heading2 section. The starting $top prevents this.

In addition, you would need to specify:

    [DocBookFirst]
    Heading* = section

so that each heading starts a new section when it occurs at the same level as the preceding section. Otherwise a second Heading2 section would be valid inside the first Heading2 section, and would not close that section and start a new section of its own at the same level.

See also:

§26.5.5 Specifying alternate ancestries for the same element

§26.5.6 Specifying first-child status for nested elements

Previous Topic: 26.5.6 Specifying first-child status for nested elements

Next Topic: 26.5.8 Closing DocBook ancestor elements

Parent Topic: 26.5 Nesting DocBook block elements

Sibling Topics:

26.5.1 Understanding how DITA2Go determines element nesting

26.5.2 Designating DocBook ancestor elements

26.5.3 Fixing up interpolated ancestries

26.5.4 Deciding when to fully specify ancestry

26.5.5 Specifying alternate ancestries for the same element

26.5.6 Specifying first-child status for nested elements

26.5.8 Closing DocBook ancestor elements

26.5.9 Opening DocBook ancestor elements

26.5.10 Configuring multi-paragraph list items

26.5.11 Specifying DocBook element levels