Skip to content

ADR 2: Themes without XSLT

Context

In the original version of IT4KT graphical themes (or designs) where defined by a complete set of XSL transformations, CSS files and images. This means that each theme contained its own copy of all transformations and also semantics of transformations was tangled with styling information.

Experimental version of the IT4KT added Jinja templates for definition of page layout, but XSL transformations remained closely coupled with CSS.

Decision

We decided to separate structural transformations using XSLT from themes. Themes would not contain XSLT but only Jinja templates and CSS. Core of page content derived from the source file is provided to the theme already transformed to HTML. The theme fills the rest: header, footer, menu etc.

The fact that content of the pages is universal for all themes means that generated HTML cannot contain theme-specific tags and classes. The structure of the generated HTML would be generic and classes would be named using the BEM notation, so they would correspond to the structure of blocks and their elements.

Status

Accepted.

Consequences

Themes would share the same structure of content, so it would be possible to share JavaScript code for syntax highlighting or results hiding, etc.

On the other hand universal HTML structure may be too limiting for some themes. This aspect should be tested by porting existing themes to the new architecture.

Some parts of the content may not be part of the universal structure, but instead would be generated using Jinja or even CSS. In this case, Jinja and CSS would also need to handle translations.