XML Add On – Conditional/Filtered DITA content output in AEM

27 / Sep / 2022 by Vijay Kumar 0 comments

Use cases

  • Let’s assume we have a large number of published articles or topics. Each article contains some paragraphs or content that is obsolete now and should not be displayed to the end users. Since the number of articles is large, it is difficult to update the content quickly.
  • Let’s say we have all content ready, but this needs to be released in a phased manner.

To achieve these kinds of requirements we can utilise the DITAVAL editor. Using DITAVAL

  • Content editors or authors can set conditions on a piece of content to control whether it is displayed in the final output.
  • Content editors can choose upon publication to show/hide different conditions. 

Set the conditions in the topics

  • Open the topic for editing and add all the required content to it.
  • Select or put the cursor inside a particular element and add the required attributes and values from the right side. Refer to the following snapshots.
  • Save the content.

As shown in the above screenshots the first paragraph is added with the audience as internal and the second paragraph with the audience as external.

Creating or editing DITAVAL file
To create or update the DITAVAL file follow the steps mentioned in the DITAVAL editor documentation.
In our use case the following two DITAVAL files are created.


Author View

Source View

Author View

Source View

Include these DITAVAL files in a publishing DITA map and generate the output

Inclusion of internal DITAVAL file

Final content output

Here we can notice that external content is not available in the page as this was excluded in the internal DITAVAL file.

Inclusion of external DITAVAL file

Final content output

Here we can notice that internal content is not available in the page as this was excluded in the external DITAVAL file.

As we can see, although all the content is available in the original topics, the content is excluded based on what conditional elements are used in the DITAVAL file. So we can achieve similar scenarios using conditional processing.



Leave a Reply

Your email address will not be published. Required fields are marked *