Adding a container element
A container element is different
from a paragraph. Unlike paragraphs, containers have no footprint
in the output document. So you can define conditions, perform calculations,
or identify data on a group of elements without affecting the formatting
of the output.
Tip: If you have an existing
paragraph that you do not need to preserve its formatting and want
to convert to a container element, see the Converting a paragraph
to a container element section on the bottom of this topic.
About this task
- You can perform the following tasks with containers:
- Drag a container element into any of the following elements:
- Containers
- Lists
- List items
- Paragraphs
- Iterations
- Tables
- Rows
- Cells
- Drag a container into another container when that container includes only elements that are allowed in a container. For example, you can drag a container into another container that is in a row element. However, if the container has a paragraph element in it, it cannot be dragged into another container that is in a row element because rows cannot contain paragraphs.
- Drag a container into another container that is limited by queries. For example, you can drag a container in another container at the root of the template or drag a container in a container inside a paragraph.
- Drag a container element into any of the following elements:
- You cannot perform the following tasks with containers:
- Drag containers into elements other than containers, lists, list details, paragraphs, iterations, tables, rows, or cells. For example, you cannot drag a container into a text element.
- Drag a container included in a table, row, or cell element outside of that element type. For example, if a row has a container element in it, the container element cannot be moved to a different row in the table. In general, do not drag a container included in an element outside of that element type.
- Set the once per table property to true for a row element when the row is inside of a container element.
- Iterating on containers
- When you use an iterator, you can use it within the container. An iterator helps to change the formatting element easily and also makes the template more uniform. For tables, the advantage is that you can avoid seeing empty rows in the output when you put a condition in the row that is based on the attributes of the parent container. You can also avoid seeing rows with uneven number of cells.
- When tables are being used, you can put the query in containers
that host rows or in containers inside cells, depending on where you
must iterate. When you are not using tables, you can put all queries
on containers and then inside those containers, you can put the rendering
elements, such as paragraphs, hyperlinks, and text.Important: After you add a container to a table, row, or cell element, you cannot move that query outside of the table element. Containers are handled differently inside tables and that context does not apply outside of a table element. Use new container elements when necessary.
Procedure
What to do next
- Iterating on a container
- A Loop function adds the do while loop capabilities to IBM® Rational® Publishing Engine, which enables actions to be run repeatedly. You can set the do while property of the container to true so that the container and all of its children are evaluated again.
- Converting a paragraph to a container element
- Starting in version 1.3 release, you can convert a paragraph to
a container element. Once a paragraph is converted, you cannot transform
the newly converted container back to a paragraph unless you immediately
undo the change. Although all the data in the paragraph including
queries, assignments, conditions, and filters are preserved, the formatting
defined in the paragraph is not preserved in the newly converted container.
- To convert a paragraph to a container in the template content
editor:
- In the editor area or in the Outline view, right-click the paragraph element and select .
- (Optionally) After the previous step, you have only a single opportunity
to undo the conversion:
- In the editor area or in the Outline view, right-click the newly converted container element and select Undo Create Container.
- To convert a paragraph to a container in the template content
editor: