• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Learning DITA

Free DITA training

Free DITA training

  • Log in
  • Register
  • Newsletter
  • Profile
  • Privacy
  • Home
  • About
  • Courses
  • News
  • Resources
    • Recordings
  • Questions?
  • Contact

Marking conditional elements

Posted on 12.02.16

Advanced reuse in DITA Lesson 1: Using conditions Marking conditional elements

DITA conditional filtering allows you to choose what to show and hide in your DITA topics when they are processed for output.

You mark DITA elements for filtering by adding special conditional attributes to elements; the value you use with a conditional attribute is used to determine whether the element should be hidden (filtered out) or shown.

The four basic conditional attributes and their suggested uses are:

audience
Content is intended for a specific group of readers. The audience can be seen a number of different ways; it might be the experience level, role, security clearance, or some other way of grouping potential readers.
platform
Content is specific to a particular hardware or software platform.
product
Content is specific to a particular product.
otherprops
Content is specific to a custom aspect.

For example, you might use the platform attribute to indicate whether content is intended for iPhone or Android users:

<p platform="android">Visit Google Play for more information.</p> 
<p platform="iphone">Visit the App Store for more information.</p>

When generating output for Android users, you can tell the DITA filtering mechanism to hide elements where platform=”iphone” and show elements where platform=”android”. To generate output for iPhone users, you show elements where platform has the value “iphone” and hide elements where platform has the value “android”. (How to hide and show content is described later in this lesson.)

The names of the attributes are defined in the DITA specification. They are a suggestion about how you might use them, but you should not feel locked into using them specifically for audience, platform, or product filtering; it’s up to you to determine how you want to use each one.

As with the attributes themselves, the values you use with each of the conditional attributes are up to you to decide. You can use any characters you want for the conditional attribute values, except for the space character. Case is important in the conditional attribute values, so choose one form of capitalization and use it consistently.

You can specify multiple values in these attributes; separate each value with one or more spaces.

The single most important thing, however, is that all content creators in your group, team, company, or organization agree on the purpose of each of the attributes and the values to use with the attributes.

Note: The four attributes listed here are just a starting point. It is possible to use DITA specialization to create additional conditional attributes that have meaning for your content. The DITA specification identifies another conditional attribute: props. This attribute is used as the basis for specialization.

Keep in mind that filtering of elements extends to DITA map elements, such as <topicref> and <mapref>. This way, you can use conditional attributes and filtering to remove entire topics or chapters from your output.

Contributors
  • Simon Bate
  • Jake Campbell
  • Gretyl Kinsey
Previous Topic
Back to Lesson
Next Topic

sidebar

Blog Sidebar

  • Scriptorium logo
    Maximize the value of your content. Read more.
  • Scriptorium logo
    Already in DITA and need support? Contact us.
RSSLinkedin

Want to add content? Join the ditatraining GitHub repository.

  • Home
  • News
  • Contact
  • Privacy
  • Cookie Policy

Maintained by Scriptorium Publishing

Logo and site presentation © 2015–2023 Scriptorium Publishing. Content based on the open-source DITA training project.

Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage vendors Read more about these purposes
View preferences
{title} {title} {title}
Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage vendors Read more about these purposes
View preferences
{title} {title} {title}