24.7.1 Designating ancestors for <image> and <fig> elements

To specify the ancestor elements DITA2Go must use to wrap <image> and <fig> elements:

[DITAOptions]
; ImageParents = parents for <image> tags, whether wrapped in <fig>
; or not; default none (use content model), may include sets from
; [DITAElementSets].
ImageParents = list of parent elements

List ancestors in hierarchical order; see §24.5.2 Designating DITA ancestor elements. You can include element sets, as well as single elements; see §24.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.

Note:  Do not include fig either in the list for ImageParents or in an element set in that list.

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

[DITAOptions]
ImageParents = $iparents
[DITAElementSets]
$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
[DITAImageParents]
; image ID (may be group) = parents to be used for image/fig element.
alerts = entry

You can make a single [DITAImageParents] 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:

[DITAElementSets]
$iparents = conbody section entry example context choice

DITA2Go will always choose example over context when in <taskbody>. Where the image is valid in both <context> 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 <context>, you could set:

[DITAElementSets]
$iparents = conbody section entry context example choice

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

Previous Topic:  24.7 Specifying options for images in DITA XML

Next Topic:  24.7.2 Specifying what to include in a <fig> wrapper

Parent Topic:  24.7 Specifying options for images in DITA XML

Sibling Topics:

24.7.2 Specifying what to include in a <fig> wrapper

24.7.3 Omitting size attributes from images for DITA output