<subjectdef>

The <subjectdef> element defines a subject. A subject can be used to define a controlled value or a taxonomic classification.

The <subjectdef> element can use a <navtitle> element to supply a label for the subject. The @href attribute on <subjectdef> can be used to reference a topic that provides more information about a subject and how authors should use it when classifying content or specifying a value for an attribute.

The <subjectdef> element is specialized from <topicref>. It is defined in the subject scheme module.

The following attributes are available on this element: link-relationship attributes, universal attributes, @collection-type, @impose-role, @keyref, @keys, @linking, @processing-role, and @toc.

For this element, the @impose-role attribute has a fixed value of keeptarget.

Examples

This section contains examples of how <subjectdef> elements can be used.

Figure 1. Example of defining a set of controlled values

The following code sample shows how <subjectdef> elements can be used to define a set of controlled values:

<subjectdef keys="values-product">
    <subjectdef keys="free"/>
    <subjectdef keys="premium"/>
</subjectdef>

When this set of controlled values is bound to an attribute, the only valid values for the attribute are free and premium.

Figure 2. Example of defining a simple taxonomy

The following code sample shows how <subjectdef> elements can be used to define a simple taxonomy of recreational hobbies:

<subjectdef keys="hobbies">
    <subjectdef keys="fiber-arts">
        <subjectdef keys="knitting"/>
        <subjectdef keys="quilting"/>
        <subjectdef keys="sewing"/>
    </subjectdef>
    <subjectdef keys="woodworking">
        <subjectdef keys="scroll-sawing"/>
        <subjectdef keys="whittling"/>
        <subjectdef keys="wood-turning"/>
    </subjectdef>
</subjectdef>

The taxonomy might be used to classify DITA topics or maps.