IDML Reference / Conditional text
Conditions and condition sets
The Condition and ConditionSet elements in designmap.xml, AppliedConditions on a run, and ConditionalTextPreference — spelled the way InDesign reads them.
Reviewed against engine v0.71.6
A Condition is a named switch in the design map; a run names the switches that govern it in AppliedConditions.
In short Conditions are direct children of Document in designmap.xml. Each
Condition has a Self id, a Name, a Visible flag and an on-screen indicator whose
colour is a typed IndicatorColor property. A ConditionSet stores a saved combination
of visibilities as <Properties><SetConditions> with one VisibilityPair per
condition. A ConditionalTextPreference follows them. In a story, a
CharacterStyleRange lists the conditions that govern it, space-separated, in
AppliedConditions.
One hidden condition in the design map and a run that names it: the run is in the story and does not print.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?aid style="50" type="document" readerVersion="6.0" featureSet="257" product="20.0(32)"?>
<Document xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging" DOMVersion="20.0" Self="d" StoryList="ustory" Name="conditional-run.indd" CMYKProfile="Coated FOGRA39 (ISO 12647-2:2004)" RGBProfile="sRGB IEC61966-2.1" SolidColorIntent="UseColorSettings" AfterBlendingIntent="UseColorSettings" DefaultImageIntent="UseColorSettings">
<idPkg:Graphic src="Resources/Graphic.xml"/>
<idPkg:Fonts src="Resources/Fonts.xml"/>
<idPkg:Styles src="Resources/Styles.xml"/>
<Condition Self="Condition/Draft" Name="Draft" IndicatorMethod="UseHighlight" Visible="false">
<Properties>
<IndicatorColor type="enumeration">Red</IndicatorColor>
</Properties>
</Condition>
<ConditionalTextPreference ShowConditionIndicators="ShowIndicators" ActiveConditionSet="n"/>
<idPkg:Preferences src="Resources/Preferences.xml"/>
<idPkg:Tags src="XML/Tags.xml"/>
<idPkg:MasterSpread src="MasterSpreads/MasterSpread_umaster.xml"/>
<idPkg:Spread src="Spreads/Spread_uspread.xml"/>
<idPkg:Story src="Stories/Story_ustory.xml"/>
<idPkg:BackingStory src="XML/BackingStory.xml"/>
</Document>
Condition
A Condition is a direct child of Document in the design map. InDesign 20.0.1 reads
conditions there, before the idPkg:Preferences reference or after the layers.
Conditions wrapped in a RootConditionalTextGroup element in Resources/Styles.xml, a
spelling some generated files use, are invisible to InDesign.
Selfis the id a run names, conventionallyCondition/<name>.Nameis the name shown in InDesign's Conditional Text panel.Visible="false"hides every run that names the condition.IndicatorMethodis how the condition is marked on screen; InDesign writesUseHighlight.- The indicator colour is a typed property,
<Properties><IndicatorColor type="enumeration">Red</IndicatorColor></Properties>. AnIndicatorColorattribute is ignored.
| Attribute · Condition | Values | Seen in |
|---|---|---|
| IndicatorMethod | enum | 100% |
| Name | enum | 100% |
| Self | reference | 100% |
| Visible | bool | 100% |
The indicator marks the text while editing. Whether it shows, and whether it prints, is
set document-wide in ConditionalTextPreference.
AppliedConditions on a run
A CharacterStyleRange names its conditions in AppliedConditions, a space-separated
list of Condition ids such as "Condition/Print Condition/Draft". A range without the
attribute is not conditional. A run with one condition prints when that condition is
visible and is left out when it is hidden. What happens to a run with several
conditions, some visible and some hidden, is covered in
visibility.
| Attribute · CharacterStyleRange | Values | Seen in |
|---|---|---|
| AppliedConditions | ref | 0% |
ConditionSet
A ConditionSet is a named, saved combination of condition visibilities, the kind an
author switches between ("Print edition", "Web edition"). It is a direct child of
Document, after the conditions. Its contents are a typed list:
<Properties><SetConditions> holding one
<VisibilityPair Condition="Condition/…" Visibility="true"/> per condition, each pairing
a condition with the visibility the set gives it.
A space-separated Conditions="a b" attribute on ConditionSet, another generated-file
spelling, is ignored by InDesign, and a set written that way silently captures every
condition in the document.
| Attribute · ConditionSet | Values | Seen in |
|---|---|---|
| Self | reference | 100% |
| Name | text | 100% |
ConditionalTextPreference
One ConditionalTextPreference follows the conditions in the design map.
ShowConditionIndicators controls the indicators; with ShowIndicators, the only value
in the census, they appear on screen and do not print. ActiveConditionSet names the
set currently applied, or n for none. All 271 InDesign-exported documents in the
census carry it, with no set active.
| Attribute · ConditionalTextPreference | Values | Seen in |
|---|---|---|
| ActiveConditionSet | — | 100% |
| ShowConditionIndicators | ShowIndicators | 100% |
In Paged: conditions and sets are read from the design map and, for older files, from
Styles.xmlin either spelling; saving writes InDesign's spelling. A condition id that names noConditioncounts as visible. A set'sVisibilityPairs are read as its members, whatever theirVisibilityvalue, and the active-set preference is not read. Scripts can show or hide a condition, or activate a set, which shows its members and hides every other condition. Supported · verified
Frequently asked questions
Where are conditions defined in an IDML file?
In designmap.xml, as direct children of Document. InDesign does not see conditions
placed inside a RootConditionalTextGroup in Styles.xml.
How is a condition's indicator colour written?
As a typed property: <Properties><IndicatorColor type="enumeration">Red</IndicatorColor></Properties>.
The attribute form is ignored.
How does a run name more than one condition?
With a space-separated list in AppliedConditions, for example
"Condition/Print Condition/Draft".
How does a condition set list its conditions?
As VisibilityPair elements inside <Properties><SetConditions>, one per condition,
each with Condition and Visibility attributes. A Conditions attribute is ignored.
Does the condition indicator print?
Not with ShowConditionIndicators="ShowIndicators", the value in every census document:
the indicator then appears on screen only.
Conditional text
How one IDML document carries several versions of its text — named conditions in the design map, runs that name them, and when their text is left out.
Visibility
When conditional text prints — a run under a hidden condition, a run under several conditions (shown while any is visible), sets and indicators.