Allow "sxml" respond type to handle both html and xml

If the data is html node, e.g. (html SXML), we render it as html;
otherwise we render it as xml.

Also start adding SXML templating function; currently we only support
simple substitution, but eventually we'll add more complex patterns.
Make sure to clean up temporary files