How are attribute values enclosed in DITA markup?

In DITA markup, attribute values are enclosed within double quotation marks (” “). This syntax is used to define and delimit the values of attributes associated with DITA elements.

Enclosing attribute values involves attribute assignment, quotation marks, and whitespace.

Attribute Assignment:

Attributes are assigned values using the following syntax within DITA elements:


<elementname attributename="attributevalue">Content</elementname>
    

<elementname>: This is the name of the DITA element to which the attribute is being applied.

attributename: This is the name of the attribute.

"attributevalue": The attribute value, enclosed within double quotation marks. This is where the value is defined and enclosed.

Quotation Marks:

The use of double quotation marks is essential for attribute values to clearly define the beginning and end of the value. These quotation marks signal to the parser that what’s inside is the value of the attribute.

Whitespace:

Attribute values can contain whitespace characters (e.g., spaces) as long as they are enclosed within double quotation marks. The quotation marks ensure that spaces are treated as part of the value rather than as separators.

Example:


<topic>
    <title attributename="attribute value with spaces">
        This is the content of the title element.
    </title>
</topic>
    

In this example:

  • <title> is the DITA element.
  • attributename is the name of the attribute.
  • "attribute value with spaces" is the attribute value, enclosed within double quotation marks.
  • The content within <title> is unrelated to the attribute but is included to show the context of the element.