DITA Resource Center

Conditional processing values and groups

Conditional processing attributes classify elements with metadata. The metadata is specified using space-delimited string values or grouped values.

For example, the string values within @product in <p product="basic deluxe"> indicate that the paragraph applies to the “basic” product and to the “deluxe” product.

Groups organize classification metadata into subcategories. This is intended to support situations where a predefined metadata attribute applies to multiple specialized subcategories. For example, the @product attribute can be used to classify an element based on both related databases and related application servers. Using groups for these subcategories allows each category to be processed independently; when filter conditions exclude all applicable databases within a group, the element can be safely excluded, regardless of any other @product conditions.

Groups can be used within @audience, @product, @platform, or @otherprops. The following rules apply:

  • Groups consist of a name immediately followed by a parenthetical group of one or more space-delimited string values. For example, "groupName(valueOne valueTwo)".
  • Groups cannot be nested.
  • If two groups with the same name are found in a single attribute, they should be treated as if all values are specified in the same group. The following values for the @otherprops attribute are equivalent:
    otherprops="groupA(a b) groupA(c) groupZ(APPNAME)"
    otherprops="groupA(a b c) groupZ(APPNAME)"
  • If both grouped values and ungrouped values are found in a single attribute, the ungrouped values belong to an implicit group; the name of that group matches the name of the attribute. Therefore, the following values for the @product attribute are equivalent:
    product="a database(dbA dbB) b appserver(mySERVER) c"
    product="product(a b c) database(dbA dbB) appserver(mySERVER)"

Setting a conditional processing attribute to an empty value, such as product="", is equivalent to omitting that attribute from the element. An empty group within an attribute is equivalent to omitting that group from the attribute. For example, <ph product="database() A"> is equivalent to <ph product="A">. Combining both rules into one example, <ph product="operatingSystem()"> is equivalent to <ph>.

If two groups with the same name exist on different attributes, a rule specified for that group will evaluate the same way on each attribute. For example, if the group "sampleGroup" is specified within both @platform and @otherprops, a DITAVAL rule for sampleGroup="value" will evaluate the same in each attribute. If there is a need to distinguish between similarly named groups on different attributes, the best practice is to use more specific group names such as platformGroupname and productGroupname. Alternatively, DITAVAL rules can be specified based on the attribute name rather than the group name.

If the same group name is used in different attributes, a complex scenario could be created where different defaults are specified for different attributes, with no rule set for a group or individual value. In this case a value might end up evaluating differently in the different attributes. For example, a DITAVAL can set a default of "exclude" for @platform and a default of "flag" for @product. If no rules are specified for group oddgroup(), or for the value oddgroup="edgecase", the attribute platform="oddgroup(edgecase)" will evaluate to "exclude" while product="oddgroup(edgecase)" will resolve to "flag". See DITAVAL elements for information on how to change default behaviors in DITAVAL provile.

note

While the grouped values reuse the generalized attribute syntax found in Attribute generalization, the @audience, @product, @platform, and @otherprops attributes cannot be specialized or generalized.

Was this page helpful?