Adaptation Instructions

Adaptation instructions are a vocabulary to be used within HTML documents or CSS/JavaScript resources for server-side enhanced responsive web design with FIT. They are meant to be processed by the FIT Server.

Constructs defined in this specification use names with the prefix ai- to differentiate from the surrounding syntax.

Expressions are XPath expressions, evaluated in the context of the root element of the Delivery Context document. Any regular or FIT specific XPath functions may be used in the expression.

Content can be modified via filtering. HTML, CSS and JavaScript documents can be modified by text filters that use a comment syntax. HTML can additionally be filtered via DOM filters that use elements or attributes. Both filters are applied during the parse flow action. Text filter expressions are evaluated before the document is parsed to a DOM, DOM filter expressions afterwards.

The filtering has to be enabled in conf/config.xml via:

    <dom-filter />
    <text-filter />

Content models

These content models help to explain where DOM filter elements can be used and what content they can contain. The relevant content models are augmented flow content, transparent content, parent-transparent content, and text content.

Augmented flow content

Augmented flow content is flow content augmented with ai-if, ai-choose, ai-value-of, ai-fragment elements. See the definition of flow content in the HTML5 specification.

Transparent content models

See the definition of transparent content models in the HTML5 specification.

Parent-transparent content models

Some elements are described as parent-transparent; they have “parent-transparent” in the description of their content model. The content model of a parent-transparent element is derived from the content model of its grand-parent element: the elements required in the part of the content model that is “parent-transparent” are the same elements as required in the part of the content model of the grand-parent of the parent-transparent element in which the parent-transparent parent element finds itself.

Consider the following markup fragment:

    <ai-when test="foo = 1">This is <strong>important</strong></ai-when>
    <ai-otherwise>This is not important</ai-otherwise>

The ai-when and ai-otherwise parent ai-choose element is found in the p element, whose content model is phrasing content. Thus, text and the strong element are allowed.

Consider another markup fragment:

    <ai-when test="foo = 1"><h1>This is <strong>important</strong></h1></ai-when>
    <ai-otherwise><h1>This is not important</h1></ai-otherwise>

The h1 element is not phrasing content, and so, in the preceding example, not allowed in the ai-when and ai-otherwise elements.

Text content

See the definition of text content in the HTML5 specification.