I've been thinking about doing something like this as an alternative to having to invoke a transformation using Javascript. The main drawback seems to be that it's hard to parameterize it, that is, to make anything dependent on data content or user input.
Michael Kay
Saxonica