General Rexsel Syntax

All of Rexsel keywords map, more or less, to an equivalent XSLT construction. Where it is possible the same keyword is related directly to the XSLT element. The examples given elsewhere use the default XML namespace for XSLT, thus not requiring the ‘xsl:’ prefix with the XSLT elements.

The generalised form of a Rexsel statement is

keyword options { block elements }

where keywords are valid instructions (stylesheet, variable, etc.); options are an optional list of names or expressions, either single or in pairs; and block elements are a list of valid instructions enclosed by brackets. If there are no block elements required then the brackets can be ignored.

Instructions can obviously be nested

keyword options { keyword options { block elements } keyword options { block elements } }
Rexsel Comments

Comments are ignored by the Rexsel compiler and are identical to comments in C, Swift, etc. Single-line comments begin with two forward-slashes (//). Multi-line comments are not currently supported, but will be added in future versions.

XSLT/Rexsel Equivalents
XSLT1.0 Rexsel Equivalent
<apply-imports> apply-imports
<apply-templates> apply-templates using "..."
<attribute name="attrib-name"> attribute "attrib-name"
<attribute-set name="attrib-set-name"> attribute-set "attrib-set-name" { ... }
<call-template name="proc-name"> call fnName { with "param-name" "value" }
<choose> choose { ... }
<comment> comment "..."
<copy> copy { ... }
<copy-of> copy-of "..."
<decimal-format> decimal-format { ... }
<element> element "..." { ... }
<fallback> fallback { ... }
<for-each> foreach "..." { ... }
<if> if "..." { ... }
<import> import "..."
<include> include "..."
<key> key using "xpath-expr" { ... }
<message> message terminate "yes"|"no" { ... }
<namespace-alias> namespace-alias map-from "..." to "..."
<number> number { ... }
<otherwise> otherwise { ... }
<output> output { ... }
<param> parameter name { ... }
<preserve-space> preserve-space "..."
<processing-instruction> processing-instruction "..." { ... }
<sort> sort { ... }
<strip-space> strip-space "..."
<stylesheet> stylesheet
<stylesheet version="1.0"> stylesheet { version "1.0" ... }
<stylesheet xmlns:prefix="URI"> stylesheet { xmlns "prefix" "URI" ... }
<template name="fn-name"> proc name { ... }
<template match="xpath-expr"> match using "xpath-expr" { ... }
<text> text "..."
<value-of> value "..."
<variable> variable/constant name { ... }
<when> when "..." { ... }
<with-param> with name { ... }
XSLT1.1 Rexsel Equivalent
<script> script prefix "..." ...
Copyright 2024 Hugh Field-Richards. All Rights Reserved.