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.
- Querying Elements -- selectors, data extraction, the
fromclause, and theselfandpriorcontext variables. - Working with Collections -- counting, filtering, mapping, aggregation, sorting, and null handling.
- Constructing HTML -- building elements with
new, CSS shorthand for classes and IDs, attributes, children, and setter methods. - Variables and Composition --
letbindings,ifexpressions, dictionaries,@namespacedeclarations, and putting it all together.
Reference
The reference section documents every type, method, and syntactic construct in the language.
- Types -- the full type system: Number, String, Boolean, Null, List, Dictionary, Element, Temporal, Instance, Class, and Selector.
- Number -- integer and decimal arithmetic, comparison operators, coercion, rounding, and random generation.
- String -- concatenation, interpolation, substring methods, regex matching, cryptographic hashing, and random generation.
- List -- access, aggregation, transformation, validation, ordering, joining, and reduction.
- Dictionary -- literal syntax, dot and subscript access, property assignment, and methods like
.merge()and.entries(). - Element -- queried vs. constructed elements, getter and setter methods, provenance, sub-select, cloning, and mutation.
- Syntax -- complete grammar, operator precedence,
letbindings,ifexpressions, lambdas, destructuring, try/catch, andfromclauses. - Temporal -- date and time types modeled on JavaScript's
TemporalAPI, with arithmetic, formatting, and timezone support.
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: