Conditional text in FrameMaker allows you to apply conditions to text. Once you have applied conditions, you can then decide, based on the applied conditions, the text to show or hide.
When you apply a tag to text in a document, the text is marked as conditional. If you have defined Conditional Indicators (such as style, color, or background color), the text on which the tags is applied is conditionally formatted based on the indicators. However, all text displays in FrameMaker. You still need to specify the text to show and text to hide based on the applied tags.
To show or hide conditional text, use the Show / Hide Conditional Text dialog.
After applying conditional tags to the text in a document, you use the Show / Hide Conditional Text dialog to set up and define the text to show or hide.
Show / Hide Conditional Text dialog
Show All:
Default. All text in the document is displayed (unconditionally) irrespective of the conditions applied.
note: The Show All option ensures that all text is displayed. However, the conditionalized text displays with the specified conditional indicators.
Show as per Condition:
Select this option and move conditional tags between the Show and Hide tag lists to specify the tagged text to show or hide, respectively. For details, see Show / hide conditional text using conditional tags.
Show if all Conditions Applied:
Select this option to ensure that any tagged text in the document displays only if all conditional tags selected in the Show list are applied to that text.
Show as per Expression
Select this option and choose a conditional expression that defines the show and hide conditions. For details, see Show / hide conditional text using conditional expressions.
Show Conditional Indicators:
When you define conditional indicators for the conditional text in a document, by default, the text displays and outputs (PDF) with the indicators. You can choose to turn off this option.
Condition indicators (strikethrough and underline) identify two conditions.
Apply Show/Hide settings to Nested Books
If you have nested books in your main book file, then select this option to ensure that the conditional tags are applied to all nested books.
Update Book after Apply
Select this option to apply conditional tags to all files in your book. For details, see
Applying conditional tags at book level.
1)Open the Show / Hide Conditional Text dialog.
2)To show or hide text in the document using conditional tags, select Show as per Condition.
3)Use the arrows to move tags between the Show and Hide conditional tag lists.
For example, to show only text tagged as print; ensure the PrintOnly tag is in the Show list. Move all other tags to the Hide list.
To show text tagged as PrintOnly and MobileOnly; ensure only these tags are in the Show list.
4)To show and hide the conditionalized text depending on the list to which you add them, click Apply.
The conditional text is hidden or displayed.
If conditional indicators are applied to tags in the Show list, the corresponding tagged text displays with the specified indicators. You can choose to remove the indicators by unchecking the Show Conditional Indicators option in the Show / Hide Conditional Text dialog.
important: If you plan to publish generate a Apply conditional tags of a document on which conditional text is applied, you need to turn off this option. If you keep the Show Conditional Indicators option on, the PDF output will display with the indicators.
Using conditional tags, you can show or hide text depending on the tags you place in the Show and Hide tag lists, respectively. This means that any tag in the Show list causes the corresponding tagged text to display. However, consider the following example:
A document defines the Comment, PrintOnly, and MobileOnly conditional tags. Paragraphs in the document are tagged with different combinations of these tags:
•Paragraph one is tagged as PrintOnly.
•Paragraph two is tagged as PrintOnly and MobileOnly.
•Paragraph three is tagged PrintOnly and Comment.
You need to set up the document to display only text tagged as PrintOnly and MobileOnly. If you move the PrintOnly and MobileOnly tags to the Show list, all three paragraphs display since all have either one of these tags associated. To handle this, you create conditional expressions that allow you to combine multiple tags with the and, or, and not operators.
In the above example, the expression “PrintOnly” and “MobileOnly” ensures that only text with both PrintOnly and MobileOnly tags is included.
To create a conditional expression:
1)In the Show / Hide Conditional Text dialog, click Build Expression.
In the Manage Conditional Expression dialog, you can create or edit conditional expressions.
2)To create an expression, enter a name for the expression.
You build an expression using the available tags in combination with the and, or, and not operators.
3)In the above example, click the PrintOnly tag and click the arrow to add the tag to the expression box at the insertion point.
Alternatively, you can double-click the PrintOnly tag.
4)Click and to add the operator after the PrintOnly tag.
5)Click the MobileOnly tag and click the arrow to add the tag to the expression.
6)Click Save.
The conditional expression displays in the list.
7)On the Show / Hide Conditional Text dialog, select Show as per Expression.
8)From the Build Expression list, choose the required expression and click Apply.
The text is displayed based on the conditional expression.
Conditional expression might require grouping of sub-expressions in brackets. Take the example of a document with the following tags:
Platforms:
Win, Mac, and Unix
Versions:
Version 1.0, Version 2.0, and Version 3.0
Output:
PDF, HTML, EPUB, and RTF
To display text tagged as Win or Mac with all versions except Version 1.0 and output PDF or HTML, create the following expression:
Using parentheses to simplify conditional expressions
When you create conditional expressions:
•Tag names display in green text.
•Tag names must be included in double-quotes.
If you select a tag name from the Condition Tag list, the name displays in double-quotes. However, you can also enter the tag name manually. In this case, ensure that you enter the name in double-quotes.
•Misspelled tag names are underlined with a red squiggly.
•And, or, and not operators display in blue text.
•Syntax errors display with a yellow background.
•The Save button is disabled if there are errors in the expression.