Data attributes

Data attributes customize how a document displays content. Use data attributes to add a table of contents and to customize calculated values, define conditions, filters, conditional formatting properties, and styles.

Calculated values

Create JavaScript snippets to process data attributes. You might use these snippets to combine data attributes, trim white space, and transform numeric values into textual descriptions. You can process any data attribute from the current context, which includes the query attributes of the element and the attributes from all the parent queries of the elements.

Conditions

Use expressions that are based on data attributes or template variables to define conditions for when an element is to be rendered. A condition is a JavaScript expression that evaluates to a Boolean value.

Filter versus conditions

Although filters and conditions seem similar, they are two different mechanisms that serve different purposes: A condition is evaluated only once for an element, even if that element is a query. Therefore, you cannot use the current query as a context for a condition.

Although you can sometimes use conditions instead of filters, using filters yields better performance because only a subset of data is processed.

Conditional formatting

You can use expressions to define formatting properties based on data attribute values. Conditional formatting is similar to element conditions except that the return values depend on the property type.

Feedback