24.4.3.8 Mapping paragraph format aliases algorithmically

Suppose you use the same paragraph formats for numbered lists (for example, NumFirst and NumNext) both in material for <concept> topics and in material for <task> topics:

To choose between alternate format aliases depending on the DITA context, you can assign to a format a DITA2Go macro that selects an alias according to the start tag of the current topic. For example:

[DITAAliases]
NumFirst = <$(($$_ditastart is "task") ? "StepFirst" : "OLFirst")>
NumNext = <$(($$_ditastart is "task") ? "StepNext" : "OLNext")>

These assignments say that if the topic start tag is task, use the Step* format name, otherwise use the OL* format name, in place of the original Num* format name. The assignments use predefined macro variable $$_ditastart, which contains the start tag of the current DITA topic.

You would assign the desired DITA elements to the alternate format names. For example:

[DITAParaTags]
Step* = step 
OL* = li

You would also create entries for the alternate formats in [DITAParents], and if needed in [DITALevels], and so forth. In effect, you have created semantic formats from descriptive format.s.

The macros you assign do not have to select based on topic type; you can set macro variables to test for other properties or situations. The ability to assign a macro to a format name provides a general-purpose algorithmic way to map from formats to DITA elements, allowing you to deal with cases that normal mapping cannot handle.

Previous Topic:  24.4.3.7 Mapping paragraph format aliases to different elements

Next Topic:  24.4.3.9 Mapping several paragraphs formats to the same element

Parent Topic:  24.4.3 Mapping paragraph formats to DITA block elements

Sibling Topics:

24.4.3.1 Assigning DITA elements to paragraph formats

24.4.3.2 Omitting element tags for selected paragraph formats

24.4.3.3 Specifying a default element for unmapped paragraph formats

24.4.3.4 Omitting invalid tags for default DITA block elements

24.4.3.5 Overriding element mapping for paragraph formats

24.4.3.6 Providing aliases for paragraph formats

24.4.3.7 Mapping paragraph format aliases to different elements

24.4.3.9 Mapping several paragraphs formats to the same element