Xao / Technical Fieldnotes

Core Concepts · Issue 1.0.0-dev · 3 min read

XSLT 3.0 Themes vs CSS Skins

Why XSLT themes are structurally and semantically richer than CSS-only themes — including accessibility-first DOM transformations.

Audience: Designers, accessibility engineers, and CMS buildersWords: 444Source: content/xslt-themes.md
Open library index (12 documents)

Most modern web frameworks treat "theming" as swapping CSS variables, colors, and fonts while keeping the HTML DOM fixed. That works for cosmetic branding, but breaks down as soon as different audiences need different document structure, reading order, or assistive landmarks.

With XSLT 3.0, every theme is a structural transformation from one semantic XML source tree into an arbitrary target HTML DOM.

Five Themes, One XML Tree

In XaoDocs, every documentation page produces the exact same <xao-docs> XML conglomeration (inspectable at /xml/{slug}), then routes it through one of five independent XSLT 3.0 theme collections:

ThemePrimary AudienceStructural Transformation (Not Just CSS)
Atlas (?theme=atlas)Framework developers3-column grid: left categorized nav sidebar, center article, right sticky "On this page" outline
Folio (?theme=folio)Architects & evaluatorsEditorial cover spread, collapsible library <details>, and XPath 3.1 sibling-grouped numbered chapters
Console (?theme=console)Operators & SREsTelemetry strip (slug, words, reading-minutes, phc/xsl3), nav rail, and collapsible <details> H2 modules
Reader (?theme=reader)Screen-reader & low-vision usersUpfront Document Summary, inline numbered TOC, <figure><figcaption> code wrappers, directory after article, zero JS
Handbook (?theme=handbook)Technical auditors & print<dl class="spec-meta"> specification ledger, numbered section index, @media print page layout

How Accessibility Benefits From XSLT

Consider the Reader theme (themes/reader/page.xsl):

  • Reading order matters for screen readers: Sidebars placed before <main> force keyboard and screen-reader users to tab past dozens of navigation links before discovering what a page is about. In Reader, XSLT reorders the DOM completely: skip landmarks first, an explicit Document Summary (id="doc-summary") second, a numbered Table of Contents (id="doc-toc") third, the article body fourth, and the full Site Directory (id="site-directory") after the article.

  • Template overrides for richer semantics: themes/reader/page.xsl includes themes/shared/commonmark.xsl and overrides cm:code_block with priority="2" to wrap every code block in <figure class="code-figure"><figcaption>Code example (...)</figcaption>...</figure>, giving assistive technologies explicit context for every code listing.

  • Zero JavaScript: Unlike themes that need scripts for accordions or dynamic outlines, Reader emits 100% self-contained static semantic HTML.

Shared Templates & xee-xslt Patterns

XaoDocs' themes share Markdown element rendering via <xsl:include href="../shared/commonmark.xsl"/> and navigation partials via <xsl:include href="../shared/partials.xsl"/>.

Under PHC's xee-xslt engine, XaoDocs uses:

  • Named modes (<xsl:apply-templates select="." mode="theme-switcher"/>) for reusable layout partials.

  • XPath 3.1 sibling grouping (following-sibling::*[preceding-sibling::cm:heading[@level='2'][1] is $h][not(self::cm:heading[@level='2'])]) to group flat CommonMark cm:heading[@level='2'] siblings into Folio chapters and Console accordion modules.

  • Text value templates (expand-text="yes") and XPath 3.1 functions (replace(), lower-case(), normalize-space()) to generate deterministic heading anchor IDs.