Sessel

Sessel is a CSS expression language for querying, transforming, and constructing HTML. It extends CSS selectors with methods, variables, and element construction, so you can count elements, aggregate values, filter collections, and build new HTML fragments -- all using the selector syntax you already know.

Sessel expressions appear throughout Pagelove: in constraints that validate documents before they are saved, in expression bindings that compute values at render time, in triggers that fire before request processing, and in processors that shape responses afterward.

Learn Sessel

The four learn guides form a progressive sequence. Each builds on the one before it, starting from CSS selectors and ending with full expression composition.

  1. Querying Elements -- selectors, data extraction, the from clause, and the self and prior context variables.
  2. Working with Collections -- counting, filtering, mapping, aggregation, sorting, and null handling.
  3. Constructing HTML -- building elements with new, CSS shorthand for classes and IDs, attributes, children, and setter methods.
  4. Variables and Composition -- let bindings, if expressions, dictionaries, @namespace declarations, and putting it all together.

Reference

The reference section documents every type, method, and syntactic construct in the language.

Why Sessel?

For the motivation behind a CSS-based expression language -- and how it relates to JavaScript and schema-defined types -- see the Concept pages: