how xpath is specified
The level of algebra is the core of the system. All xpath expressions are converted to this level which is indeed a ready-to run Scheme program.
The level of string is a traditional xpath as string. The program parses xpath nad converts it to algebra level.
The level of s-expression is an original SXPath method of specifying xpath. Why we need it: no need to parse, intuitive, work for manu cases.
An idea for s-exp level: do code generation using C++ templates or Java or C# generics. Maybe it is possible.