A program which needs to generate XML/HTML (for example, the view layer of a web application) can hope to get two key things out of a preprocessor/library for doing so. Those are making sure that start tags and end tags are balanced, and quoting text to avoid HTML injection attacks (h-escaping or whatever word you use for changing ampersands to ampersand-amp; and the like).
However, erb, haml, jsp, php, and many other popular systems fail to provide one or both of the above (in particular, h-escaping should be the default and special syntax should be needed to disable it, or better yet there should be more powerful mechanisms which make it less necessary to output strings without quoting). I'd be glad to tell anyone who is interested about Erector ( http://erector.rubyforge.org ), an open-source library in which templates are ruby programs, in which nested HTML tags are generated by nested blocks, and which could also be considered another example of how ruby libraries can approximate the readable syntax of custom-designed languages.
I'll hope to hear from other people what they have found works and doesn't work in view layers, what experiences have been with erb, haml, and others, and whether they have tried something like erector.
(see JimKingdon for more background on me).