Lesson 2: Adding template elements and conditions
You can add a range of template elements, queries, and
conditions to build a template.
About this task
Procedure
- From the Palette view, drag the Container element to the editor area.
- Select the container element.
- In the Properties view, select the General tab.
- For the name property, enter Packages Container.
- From the Data Source View, drag the Project/Packages/Package query to the container element.
- From the Palette view, add the Paragraph element to the container element.
- From the Data Source View, drag the Project/Packages/Package/Name query into the paragraph element. The Select Context window displays.
- Select Use as Value, and click OK.
A new text element is created inside the paragraph and its content
is set to the Name attribute.

- From the Palette view, drag a paragraph element into the editor.
- Drag the Project/Packages/Package/Description attribute from the
Data Source View into the paragraph element.

- Select the paragraph element.
- In the Properties view, select the Formatting tab.
- Click the Italic icon.
- List all the requirements from this package:
- From the Palette view, drag the List element after the Paragraph element.
- Double-click the list element. The New List window opens.
- Type 1 in the Insert the number of items field to create a list with a single item.
- Click OK in the New List window.
- Select the list element.
- In the Properties view, select the General tab.
- For the name property, enter Requirements list.
- Drag the Project/Packages/Package/RequirementsInPackage/Requirement query from
the Data Source View into the list item element.

- Add a hyperlink element to the editor:
- Drag the Hyperlink element from the Palette view to the editor.
- From the data source view, drag the Project/Packages/Package/RequirementsinPackage/Requirement/href attribute into the hyperlink element.
- Select the hyperlink element.
- In the Properties view, select the Specific tab.
- For the Display property, click
the
icon. - In the Set Display Value window, expand the Project/Packages/Package/RequirementsinPackage/Requirement attribute, and select the FullTag attribute.
- Click OK.
- From the Outline view, drag the InternalHyperlink style into the hyperlink element.
- Drag two text elements from the Palette view into the list item element after the hyper link element.
- Double-click the first text element to open the Set Content for Current® Element window.
- For the first text element, click the Simple value tab, and type a hyphen (-) to set the content as the static text. Click OK.
- Double-click the second text element to open the Set Content for Current Element window.
- For the second text element, click the Data Expression tab, expand the Project/Packages/Package/RequirementsinPackage/Requirement/Text, and select Text to set the content as the text attribute.
- Click OK in the Set Content
for Current Element window.

- Optional: Add the following elements to further
customize the template:
- From the Palette view, add Table of Contents element to the top of the template.
- Define a style and apply to a paragraph containing the package
name:
- In Document Studio, click Style > New Style.
- In the Style name field, type Style1 for the style name, and then click Next. The Select style properties window opens.
- In the Select style properties window, select
the property or group of properties to apply to the template element,
and click the
icon to select it, and then click Next. 
- In the Set Property Value window, type a value in the Property Value column for each property, and then click Next.
- Review the summary and click Finish.
- Set a condition to exclude the description attributes from output
if the data does not contain a value:
- Right-click the Paragraph element containing the description, and click Data > Edit Condition. The Set Condition for Current Element window is displayed.
- Expand Attributes and select the Description attribute.
- In the right view, select the Left operand field to Description.
- Set the Operator field to Not equal to.
- Type a space in the Right operand field,
and then click Add.

- Save the template.
Results
Lesson checkpoint
You added elements to a template.
Feedback