Set up DITA topics to use DITAval

You can make elements in a DITA document conditional by applying condition attributes to the elements. You then define, in a ditaval file, the elements to exclude or include in the output based on the condition attributes.

Before you create documents with conditional content, you need to first plan the criteria for the output. For example, say that a document has content that is conditionally targeted at administrators and end users. In the document, you apply condition attributes based on the target audience of the content (see Applying condition attributes to elements). You then create a ditaval file in which you specify the elements to include and exclude based on the attribute value defined in the document (see Creating a ditaval file to create conditional output.

Applying condition attributes to elements

To allow FrameMaker to conditionally process elements in a DITA document, you need to specify the elements to include or exclude for the output. In the document, you apply one or more of the following conditional attributes to the elements that you need to conditionally process:

audience:

Example: Administrators, authors, or end users.

platform:

Example: Windows, MAC, or Linux

product:

Example: FrameMaker, RoboHelp, or Captivate.

otherprops:

Use this attribute to define any other property that you need to use to enable conditional processing for the document. A few examples:

delivery

Example: Print, PDF, or Web

model

hatchback or sedan

You can apply multiple attributes to an element. For example, you can apply audience: administrator and platform: windows to an element. You can also add multiple values (each separated by a space) to a single attribute. For example, you can set platform: windows linux for content targeted at both Windows and Linux.

important:   The attributes listed above are recommended for use when working with Ditaval to single-source content. However, you are not restricted to only using these attributes. You can use any attribute defined for the selected element in a document.

To apply condition attributes to an element

1)Select an element in the Structure view of the document.

2)Open the Attributes pod (Element > Edit Attributes).

Update one or more of the following attributes:

audience

platform

product

otherprops

3)Specify the above condition for each of the element in the document that needs to be processed conditionally.

After you apply the attributes to the specific elements in the document, you conditionally output the content in your document depending on how you set up your ditaval file.

Creating a ditaval file to create conditional output

After setting up your content using condition attributes (audience, platform, product, and other­props) to define the elements that FrameMaker conditionally processes for output, you need to create a ditaval file. In a ditaval file, you define, based on an attribute name - value pair, the condi­tional processing of your document. For example, you can specify that content targeted at adminis­trators must exclude from the output content targeted at end users or authors.

To create a ditaval file:

1)Open the New XML dialog (File > New > XML).

2)In the Structured Applications section, select DITA_1.2_DITAVAL and click OK.

The top element of a ditaval file is the val element.

To define conditions, you need to create prop elements.

3)Add one or more prop elements:

Double-click the prop element in the Element pod (Element > Element Catalog).

Or press Ctrl+1 to display the Smart Catalog and choose prop and press Enter.

The Attributes for New Element dialog is displayed.

Attributes for New Element dialog

attributes_for_new_element_dt.png

4)In the Attributes for New Element dialog, specify the following attributes:

action

Choose to include or exclude the specified attribute (att, below) from the output.

att

The condition attribute name applied to the element in your document.

Enter the attribute name exactly as it is defined in the document element.

val

The condition attribute (att) value as defined in the element.

Enter the value exactly as you specify it for the attribute in the element.

For example, say that you apply the audience attribute to an element for conditional output and you set the value as admin. You need to enter audience in the attr field for the prop element in the ditaval file. Also, you need to enter admin in the val field. To exclude the element with the audience attribute set to admin, specify the action as exclude.

5)Click Insert Element and save the ditaval file.

6)Save the document with the .ditaval extension.


September 30, 2016

Legal Notices | Online Privacy Policy