Flagging content

Define a common set of images, and common alternative text for them, so that you can flag consistent content across your information set. Generally flagging is supported for block-level elements such as paragraphs, but not for phrase-level elements within a paragraph. This ensures that the images flagging the content are easily scanned by the reader, instead of being buried in text.

At least one value in at least one attribute must be set to "flag" for the element to be flagged.

  1. Create a DITA filter file in the directory where you want to add the file. Give the file a descriptive name, such as "audience-flag-build.ditaval".
  2. Open the file, and type this content into it:
    <?xml version="1.0" encoding="UTF-8"?> 
    <val> </val>
  3. Define the property on which you want to flag:
    1. Type a new property for flag by adding a new line <prop att="" val="" action="flag" img="" alt=""/>.
    2. Select the attribute ("audience", "platform", "product", "otherprops") you want to flag on. For example, "audience".
    3. Type the value you want to flag. For example, "programmer".
    4. Enter the image you want to use to flag the content. Local absolute paths, or relative paths from the filter file both are supported. For example, "D:\resource\delta.gif".
    5. Type the alternate text for the image that will be used by screen readers. For example, "sample alt text".
    You can define more properties by following the steps above. The final .ditaval file with the example values should look like this:
    <?xml version="1.0" encoding="UTF-8"?> 
      <prop att="audience" val="programmer" action="flag" img="D:\resource\delta.gif" alt="sample alt text"/>
  4. When you publish output from the topic or map, specify the .ditaval file you want by using the parameter /filter:{args.input.valfile} for the output options.
Content is flagged when any of the flagged values appear in any of the attributes. When flagged values are found in a map, links generated from affected topicrefs will be flagged on output.


<p audience="admin programmer">

When admin is set to flag, the paragraph will be preceded by the image you specified for admin.

When both values are set to flag, both images will appear before the paragraph.

<topicref platform="linux" href="abc.dita">
When linux is set to flag, any links to abc.dita derived from this topic reference will be flagged with the image you specified. In addition, any links derived from child topicrefs will also be flagged: metadata attributes are inherited.