SXML as a higher-order markup language and a tool for literate programming
Date: Mon, 31 Dec 2001 18:55:07 -0800 (PST) From: oleg@pobox.com
SXML as a higher-order markup language and a tool for literate programming
S-expressions, DOM trees and syntax-heavy XML documents are three different realizations of a hierarchy of containers made of strings and other containers (Infoset). Unlike DOM trees, S-expressions and XML documents both have an external representation. SXML is a S-expression-based, parsed, abstract syntax tree representation of an XML document; as such SXML is concise, expressive and more suitable for queries and transformations than the raw XML.
One of the benefits of SXML is that you can convert the same document into various presentation formats -- XML, HTML or LaTeX [sic!]. In fact, the SXML specification itself was authored in SXML and then converted to a web page, a LaTeX document and then to a Postscript file.
http://pobox.com/~oleg/ftp/Scheme/xml.html#SXML-spec.
SXML however is more expressive than XML, HTML and LaTeX. For one thing, SXML makes it trivial to introduce higher-order "tags", which expand to one or several XML local or non-local XML tags. As an example of expressiveness, you can use a "style" 'verbatim' both inside and outside SXML tables, whose cells may span several rows or columns. Typesetting of this kind is challenging in TeX/LaTeX.
SXML is also suitable for literate XML programming -- design of a markup format. A literate design document should permit a transformation into a well laid-out, easy-to-read hyperlinked user manual. A literate design document should be easy to write. And yet the user manual should be precise enough to allow automatical extraction of a formal specification. SXML fulfills all these roles. SXML is similar to TeX, but far easier to write and read. SXML transformations do the job of "weaving" a document type specification and of "typesetting" the user manual. See:
http://pobox.com/~oleg/ftp/Scheme/xml-old.html#literate-DTD
See also: XML and Scheme
http://okmij.org/ftp/Scheme/xml.html
Prepared by Robin Cover for The XML Cover Pages archive. See "SGML/XML and Literate Programming".