Conditional Sections

Top Previous Topic Next Topic  Print this topic

A Conditional Section is a paragraph that is displayed only if a certain condition (derived from the input data) is met. In other words, the element is only rendered if the expression evaluates to a true value.

Example:

A collection of CDs is considered as input XML file.

For example, sections that fulfill a certain condition (for example title and artist of the albums having prices over 10$ or having a certain year of appearance) can display a certain text.

In order to do that the user needs create a Repeating Section in order to test the condition for each CD.

 

1. To insert a Repeating Section, the user must access the Repeating Section button located in the Dynamic Content group under the Insert tab.

 

2. The Edit Expression dialog will be displayed. The path to the referenced node must be chosen (in this example cd) and the OK button selected.

 

3. Using the Conditional Section button located in the Dynamic Content group under the Insert tab must be selected in order to insert a Conditional Section into the Repeating Section.

 

4. The Edit Expression dialog will be displayed again. The section's condition must be selected (for example price>10) and then the OK button selected

 

In Design View the section will be displayed as the following.

 

conditional_sections1

 

5. There are two editable sections: the first one will display a customized content if the condition is met and the second one (the fallback section) a customized content if the condition is false.

 

In this example, for displaying titles and artists for the albums having prices over $10, the title and artist fields must be dragged and dropped form the Data Source Tree.

The fallback section will display "Special Offer" in a red color for albums with prices lower than $10. Also, the title of album and artist were added too.

 

Below are shown the results displayed in Design View and the output.

 

Design mode:

 

conditional_sections2

 

 

 

PDF result:

 

conditional_sections3s

 

 

Note:

In Design View a Conditional Section's condition is displayed with a lily background (when the cursors position is inside the section).

 

conditional_sections4