Using non-Scheme languages for XML/HTML

XQuery language

Bundled with Kawa is a fairly complete implementation of W3C’s new XML Query language. If you start Kawa with the --xquery it selects the "XQuery" source language; this also prints output using XML syntax. See the Qexo (Kawa-XQuery) home page for examples and more information.

XSL transformations

There is an experimental implementation of the XSLT (XML Stylesheet Language Transformations) language. Selecting --xslt at the Kawa command line will parse a source file according to the syntax on an XSLT stylesheet. See the Kawa-XSLT page for more information.

KRL - The Kawa Report Language for generating XML/HTML

KRL (the "Kawa Report Language") is powerful Kawa dialect for embedding Scheme code in text files such as HTML or XML templates. You select the KRL language by specifying --krl on the Kawa command line.

KRL is based on on BRL, Bruce Lewis’s "Beautiful Report Language", and uses some of BRL’s code, but there are some experimental differences, and the implementation core is different. You can run KRL in BRL-compatility-mode by specifying --brl instead of --krl.

Differences between KRL and BRL

This section summarizes the known differences between KRL and BRL. Unless otherwise specified, KRL in BRL-compatibility mode will act as BRL.

  • In BRL a normal Scheme string "mystring" is the same as the inverted quote string ]mystring[, and both are instances of the type <string>. In KRL "mystring" is a normal Scheme string of type <string>, but ]mystring[ is special type that suppresses output escaping. (It is equivalent to (unescaped-data "mystring").)

  • When BRL writes out a string, it does not do any processing to escape special characters like <. However, KRL in its default mode does normally escape characters and strings. Thus "<a>" is written as &lt;a&gr;. You can stop it from doing this by overriding the output format, for example by specifying --output-format scheme on the Kawa command line, or by using the unescaped-data function.

  • Various Scheme syntax forms, including lambda, take a body, which is a list of one or more declarations and expressions. In normal Scheme and in BRL the value of a body is the value of the last expression. In KRL the value of a body is the concatenation of all the values of the expressions, as if using values-append.

  • In BRL a word starting with a colon is a keyword. In KRL a word starting with a colon is an identifier, which by default is bound to the make-element function specialized to take the rest of the word as the tag name (first argument).

  • BRL has an extensive utility library. Most of this has not yet been ported to KRL, even in BRL-compatibility mode.