Data

Data is a generic component that represents metadata within a topic or map. Complex metadata is represented by nested data structures.

Syntax

The syntax for representing this component varies depending on the authoring format:

Authoring format Syntax and example
XDITA

<data>

<data name="author" value="Victoria Fernando"/>
HDITA

<meta>

<head>
  <title>An innovative, attractive, and out of the ordinary concept</title>
  <meta name="author" content="Victoria Fernando">
</head>
MDITA

There is no specific syntax for data in MDITA core profile. In the MDITA extended profile, data is represented by variables declared in a YAML front-matter header. The front matter must be the first block in the file, and it must be set between triple-dashed lines.

---
author: Victoria Fernando
---

Usage information

A metadata property specified using a <data>component usually applies to the structure that contains the <data> component.

CAUTION (non-normative):
By default, processors do not render the content of the <data> component. Use the <data> component only for properties; do not use it to embed text as part of the content flow.

Rendering expectations

By default, processors SHOULD treat a data component as unknown metadata. The contents of the data component SHOULD NOT be rendered.

Processors that recognize a particular data component MAY make use of it to trigger specialized rendering.

Attributes

The available attributes vary based on the authoring format:

XDITA
The following attributes are available on this element: data-element attributes, link relationship attributes, localization attributes, universal attributes, @keyref, and @props.
HDITA
The following attributes are available on this element: link relationship attributes, localization attributes, universal attributes, @keyref, and @props.
MDITA
For the MDITA core profile, the equivalent of the XDITA @keyref attribute is supported. For the MDITA extended profile, attributes can be specified by using the HDITA representation.

Examples

This section is non-normative.

This section contains examples of how the data component can be used in the three authoring components:

Example 1. XDITA example

The following code sample shows how the <data> element can be used to trigger specialized processing in an XDITA topic. The company has implemented specialized processing that renders a list of prerequisite items at the location of the <data> element.

<topic id="installing-acme-test-suite">
  <title>Installing the Acme Test Suite</title>
  <shortdesc>Install the Acme Test Suite in order to test whether your
             applications will work with the Acme core code.</shortdesc>
  <body>
    <section>
      <title>Before you begin</title>
      <p>You will need the following items:</p>
      <data name="trigger" value="generatePrereqList"/>
    </section>
    <!-- ... -->
  </body>
</topic>

For an example of how the <data> element can be used in the topic prolog to specify metadata, see <data>.

Example 2. HDITA example

The following code sample shows how data components can specify metadata that applies to the topic as a whole. The <head> element holds three <meta> elements, which store metadata about the author, product, and user goal that is associated with the topic.

<head>
  <title>Installing the Acme Test Suite</title>
  <meta name="author" content="Carolyn Miller"/>
  <meta name="product" content="Acme Test Suite"/>
  <meta name="goal" content="installing"/>
</head>
Example 3. MDITA example

The following code sample shows how topic-level metadata can be represented an MDITA extended profile topic. The data components are represented by variables declared in a YAML front-matter header, which provide information about the author, product, and user goal that is associated with the topic.

---
author: Carolyn Harris
product: Acme Test Suite
goal: installing
---