Example: How hierarchies defined in a subject scheme map affect filtering

This scenario demonstrates how a processor evaluates attribute values when it performs conditional processing for an attribute that is bound to a set of controlled values.

Example

A company defines a subject category for "Operating system", with a key set to "os". There are sub-categories for Linux, Windows, and z/OS, as well as specific Linux variants: Red Hat Linux and SuSE Linux. The company then binds the values that are enumerated in the "Operating system" category to the @platform attribute.

<!-- This examples uses @navtitle rather than <navtitle> solely
to conserve space. Best practises for translate include using <navtitle>. -->
<subjectScheme>
  <subjectdef keys="os" navtitle="Operating system">
    <subjectdef keys="linux" navtitle="Linux">
      <subjectdef keys="redhat" navtitle="RedHat Linux"/>
      <subjectdef keys="suse" navtitle="SuSE Linux"/>
    </subjectdef>
    <subjectdef keys="windows" navtitle="Windows"/>
    <subjectdef keys="zos" navtitle="z/OS"/>
  </subjectdef>
  <enumerationdef>
    <attributedef name="platform"/>
    <subjectdef keyref="os"/>
  </enumerationdef>
</subjectScheme>

The enumeration limits valid values for the @platform attribute to the following: "linux", "redhat", "suse", "windows", and "zos". If any other values are encountered, processors validating against the scheme should issue a warning.

The following table illustrates how filtering and flagging operate when the above map is processed by a processor. The first two columns provide the values specified in the DITAVAL file; the third and fourth columns indicate the results of the filtering or flagging operation
att="platform" val="linux" att="platform" val="redhat" How platform="redhat" is evaluated How platform="linux" is evaluated
action="exclude" action="exclude" Excluded. Excluded.
action="include" or action="flag" Excluded. This is an error condition, because if all "linux" content is excluded, "redhat" also is excluded. Applications can recover by generating an error message. Excluded.
Unspecified Excluded, because "redhat" is a kind of "linux", and "linux" is excluded. Excluded.
action="include" action="exclude" Excluded, because all "redhat" content is excluded. Included.
action="include" Included. Included.
action="flag" Included and flagged with the "redhat" flag. Included.
Unspecified Included, because all "linux" content is included. Included.
action="flag" action="exclude" Excluded, because all "redhat" content is excluded. Included and flagged with the "linux" flag.
action="include" Included and flagged with the "linux" flag, because "linux" is flagged and "redhat" is a type of "linux". Included and flagged with the "linux" flag.
action="flag" Included and flagged with the "redhat" flag, because a flag is available that is specifically for "redhat". Included and flagged with the "linux" flag.
Unspecified Included and flagged with the "linux" flag, because "linux" is flagged and "redhat" is a type of linux Included and flagged with the "linux" flag.
Unspecified action="exclude" Excluded, because all "redhat" content is excluded If the default for @platform values is "include", this is included. If the default for @platform values is "exclude", this is excluded.
action="include" Included. Included, because all "redhat" content is included, and general Linux content also applies to RedHat
action="flag" Included and flagged with the "redhat" flag. Included, because all "redhat" content is included, and general Linux content also applies to RedHat
Unspecified If the default for @platform values is "include", this is included. If the default for @platform values is "exclude", this is excluded. If the default for @platform values is "include", this is included. If the default for @platform values is "exclude", this is excluded.