Creating and editing a style

To create a style, you define the properties for the style and provide values for them.

Procedure

  1. To create a style:
    1. In Document Studio, click Style > New Style. The Welcome page opens; click Next.
    2. In Style name, type the name and click Next. The Select Style Properties window opens.
      Note: You can also type the style's name in the style name property of the desired element in the Properties view.
    3. From the left pane, select the property or group of properties that you want to apply to the template element, and click Style icon. to move it to the right pane. Click Next. The Set Property Value window opens.
    4. Enter the value for the selected property in the Property Value column and click Next.
    5. Review the summary and click Finish.
  2. To apply a style:
    1. In the Outline view, select the style.
    2. Drag on the style to desired element in the editor area.
  3. To edit a style:
    1. In the Outline view, right-click the style, and then select Edit Style. The Select Style Properties window opens.
    2. Select the property or group of properties that you want to apply to the template element, and click Style icon. to move it to the right pane. Click Next. The Set Property Value window opens.
    3. Enter the value for the selected property in the Property Value column and click Next.
    4. Review the summary and click Finish.
  4. To change the values for a style's properties:
    1. In the Properties view, select the property.
    2. In the Value column, type the value or click the ellipsis (…) to select the values for the properties.

Example

Setting heading styles using script expression based on data source attributes

You can set some formatting properties of the Template elements based on the values of data attributes. For example, you can set the heading style for a paragraph element using a java script expression that produce a value based on a data source attribute value.

Use the Generic XML schema and the PR_Requirements.xml file located in the source/XML/examples folder in the installation directory of Rational® Publishing Engine.

The Generic XML schema has the level attribute of the PRRequirement query. For the paragraph used to display information of this query, set the style name value to a java script expression. This expression will use the parseInt java script function that will return the number value of the string representing an integer number passed as input parameter. Taking into account that the level attribute of the PRRequirement query can have also the “0” value use the parseInt(Level) + 1 java script expression to set the style name.

The template content has a container. The query Project/Requirements/PRRequirement is set to this container. In the container, create a paragraph to present the data from the data source. This paragraph contains a text element displaying the value of a data source attribute. The style name property of the paragraph is set to the parseInt(Level) + 1 value.

This is a fragment of the output document produced by Rational Publishing Engine using this template: The Heading style 1 is set to the Requirement of Level 0 and the Heading style 2 is set to the Requirements of Level 1.


Feedback