What types of values can DITA attributes have?
DITA attributes can have various types of values, which define the format and content of the attribute. These values serve different purposes and are used to provide metadata, control behavior, or convey information about DITA elements.
The values which DITA attributes can have are text, numeric, date and time, reference, boolean, tokenized, ID, path, and language values.
Text Values:
Text values are plain, unformatted character strings.
They can contain alphanumeric characters, symbols, and spaces.
Text values are commonly used for attributes that store textual information, such as titles, names, and descriptions.
Example: <title text="Introduction">
Numeric Values:
Numeric values represent numerical data, including integers and floating-point numbers.
These values are typically used for attributes that involve counting, measuring, or specifying numerical quantities.
Example: <quantity value="10">
Date and Time Values:
Date and time values represent specific dates and times.
They follow a defined format, such as ISO 8601, to ensure consistency.
Date and time values are used for attributes that involve time-sensitive information.
Example: <date value="2023-09-15">
Reference Values:
Reference values are used to establish links or references to other elements, resources, or documents.
They contain identifiers or references to the target content.
Reference values are common in attributes that create hyperlinks, cross-references, or associations with related content.
Example: <link href="https://example.com">
Enumeration Values:
Enumeration values are used to represent a fixed set of predefined options or choices.
They are often used for attributes that have a limited set of valid values, and the value must match one of the predefined options.
Example: <status value="completed">
Boolean Values:
Boolean values represent binary states, typically “true” or “false.”
They are used for attributes that control binary behaviors or conditions.
Example: <active value="true">
Tokenized Values:
Tokenized values consist of multiple space-separated tokens within a single attribute value.
They are used when an attribute can have multiple values, and each value is separated by spaces.
Tokenized values are commonly used for attributes related to categories, tags, or keywords.
Example: <keywords value="DITA XML documentation">
ID Values:
ID values are used for attributes that require unique identifiers within a document.
They ensure that elements with the same ID value are considered the same entity.
ID values are common for attributes like @id
, which uniquely identifies elements.
Example: <section id="section1">
Path Values:
Path values represent file paths or location references.
They specify the location of external resources or files.
Path values are used for attributes related to linking to external content.
Example: <image src="images/pic.jpg">
Language Values:
Language values indicate the language or locale associated with text content.
They are used for attributes that specify the language of content within multilingual documents.
Example: <text lang="en-US">Hello World</text>