##### 3.4.2.8 The type attribute

The type attribute is most often used on linking elements to describe the target of a cross-reference. It is also used on the note element to describe the type of the current note, and on several other elements for varying purposes.

The descriptions for the type attribute on linking elements and on note are too long to fit in the usual attribute table, so they are included in this section; for other elements, such as audience, copyright, or object, the description can be found with the element.

###### Using type on a linking element

The type attribute describes the target of a cross-reference and may generate cross-reference text based on that description. Only the <xref> element can link to content below the topic level: other types of linking can target whole topics, but not parts of topics. Typically <xref> should also be limited to topic-level targets, unless the output is primarily print-oriented. Web-based referencing works best at the level of whole topics, rather than anchor locations within topics.

If not explicitly specified on an element, the type attribute value cascades from the closest ancestor element. If there is no explicit value for the type attribute on any ancestor, a default value of “topic” is used. During output processing for references to DITA topics (format="dita"), it is an error if the actual type of a DITA topic and the explicit, inherited, or default value for the type attribute are not the same as or a specialization of the type attribute value. In this case, an implementation may (but need not) give an error message, and may (but need not) recover from this error condition by using the type attribute value. During output processing for references to non-DITA objects (i.e., either scope is not “local” or format is neither “dita” nor “ditamap”) or other cases where the type of the referenced item cannot be determined from the item itself, the explicit, inherited, or default value for the type attribute is used without any validation. When a referencing element is first added to or updated in a document, DITA aware editors may, but are not required to, set the type attribute value based on the actual type of a referenced DITA topic.

If the type attribute is specified when referencing DITA content, it should match one of the values in the referenced element's class attribute. The type value may be an unqualified local name (e.g. "fig") or a qualified name exactly as specified in the class attribute (e.g., "mymodule/mytype"). Processors may ignore qualified names or may consider only the local name.

For example, if type="topic", the link could be to a generic topic, or any specialization of topic, including concept, task, and reference. Applications may, but need not, issue a warning when the specified or inherited type attribute value does not match the target (or a specialization ancestor of the target).

Some possible values for use on the xref element and its specializations include:

fig

Indicates a link to a figure.

table

Indicates a link to a table.

li

Indicates a link to an ordered list item.

fn

Indicates a link to a footnote.

section

Indicates a link to a section.

Other values that may be used on any linking element include:

concept, task, reference, topic

Cross-reference to a topic type.

(no value)

The processor should retrieve the actual type from the target if available. If the type cannot be determined, the default should be treated as "topic".

-dita-use-conref-target

See 3.4.2.4.1 Using the -dita-use-conref-target value for more information.

Other values can be used to indicate other types of topics or elements as targets. Processing is only required to support the above list or specializations of types in that list. Supporting additional types as targets may require the creation of processing overrides.

###### Using type in a note element

In a note element, this defines the type of note. For example, if the note is a tip, the word Tip may be used to draw the reader's attention to it. The values danger, warning, and notice have new or additional meanings with DITA 1.2 that are based on ANSI Z535 and ISO 3864 regulations.

If type is set to other, the value of the othertype attribute may be used. If you use othertype, many processors will require additional information on how to process the value. Allowable values for the type attribute are:

note

This is just a note.

attention

Please pay extra attention to this note.

caution

Care is required when proceeding.

danger

Important! Be aware of this before doing anything else. When used with the hazardstatement element, this indicates an imminently hazardous situation which, if not avoided, will result in death or serious injury.

fastpath

This note will speed you on your way.

important

This note is important.

notice

Indicates a potential situation which, if not avoided, may result in an undesirable result or state.

remember

Don't forget to do what this note says.

restriction

You can't do what this note says.

tip

This is a fine little tip.

warning

Indicates a potentially hazardous situation. When used with the hazardstatement element, this indicates a situation which, if not avoided, could result in death or serious injury.

other

This is something other than a normal note.

Previous Topic: 3.4.2.7 The conkeyref attribute

Next Topic: 3.4.2.9 The format attribute

Parent Topic: 3.4.2 Complex attribute definitions

Sibling Topics:

3.4.2.1 The href attribute

3.4.2.2 The keys attribute

3.4.2.3 The keyref attribute

3.4.2.4 The conref attribute

3.4.2.5 The conaction attribute

3.4.2.6 The conrefend attribute

3.4.2.7 The conkeyref attribute

3.4.2.9 The format attribute

3.4.2.10 The scope attribute

3.4.2.11 The role attribute