XSLT and m4 macros are both purely
declarative and Turing-complete, but XSLT supports only recursions and
not loops. It is quite complex, certainly the most difficult language
to master of any in this chapter's case studies — and probably
the most difficult of any language mentioned in this
Despite its complexity, XSLT really is a minilanguage. It
shares important (though not universal) characteristics of the breed:
A restricted ontology of types, with (in particular) no analog
of record structures or arrays.
Restricted interface to the rest of the world. XSLT processors are
designed to filter standard input to standard output, with a
limited ability to read and write files. They can't open sockets
or run subcommands.
The program in Example8.3 transforms an XML
document so that each attribute of every element is transformed into a new
tag pair directly enclosed by that element, with the attribute
value as the tag pair's content.
We've included a glance at XSLT here partly to illustrate the
point that ‘declarative’ does not imply either
‘simple’ or ‘weak’, and mostly because
if you have to work with XML documents, you will someday have
to face the challenge that is XSLT.
XSLT: Mastering XML Transformations [Tidwell] is a good introduction to the
language. A brief tutorial with examples is available on the
[an error occurred while processing this directive]