#### 26.7.2 Specifying ancestry for figure elements

To specify the ancestor elements DITA2Go must use to wrap <figure> elements:

    [DocBookOptions]
    ; ImageParents = parents for image tags, default none (use content
    ; model), may include sets from [DocBookElementSets].
    ImageParents = list of parent elements

List ancestors in hierarchical order; see §26.5.2 Designating DocBook ancestor elements. You can include element sets, as well as single elements; see §26.5.5 Specifying alternate ancestries for the same element. If you do not specify any ancestor elements, DITA2Go picks the first valid element listed in the content model, which might not be what you had in mind.

For example, suppose you want most of your images wrapped in <section>, except for those that occur in paragraphs that are mapped to <example>:

    [DocBookOptions]
    ImageParents = $iparents

    [DocBookElementSets]
    $iparents = section example

To specify ancestry for a single image element or a discrete group of image elements, assign the parent name or parent set name to the graphic ID of the image (see §4.3 Identifying files and elements), or to the graphic group ID (see §32.4.1.4 Creating named groups of graphics). For example, to make sure icons in table cells have <entry> as a parent:

    [GraphGroup]
    ab01f853 = alerts
    ab012c13 = alerts
    ab00b5d3 = alerts

    [DocBookImageParents]
    ; image ID (may be group) = parents to be used for image element.
    alerts = entry

You can make a single [DocBookImageParents] setting in an HTMLConfig marker, also; see §42.2.2 Overriding settings with configuration PI markers.

Sequence matters in element sets

Although DITA2Go knows which elements are valid within other elements, DITA2Go has no idea at all about required sequences of elements. For example, if you set:

    [DocBookElementSets]
    $iparents = section entry example graphic

DITA2Go will always choose example over graphic. Where the image is valid in both <graphic> and <example>, DITA2Go lacks any real criterion for choosing one over the other. Instead, DITA2Go selects, from the list of candidates, the first element that is valid as a parent of the image element.

In this example, if more of your images belong in <graphic>, you could set:

    [DocBookElementSets]
    $iparents = section entry graphic example

and then use [DocBookImageParents] for the lesser number of images that should be in <example>.

Previous Topic: 26.7.1 Deciding what to include in a figure element

Next Topic: 26.7.3 Omitting size attributes from images for DocBook

Parent Topic: 26.7 Specifying options for figure elements

Sibling Topics:

26.7.1 Deciding what to include in a figure element

26.7.3 Omitting size attributes from images for DocBook

Table of Contents • Index