3. How easy would it be to wire this into the existing codebase (eg. JXTemplateTransformer)?
It is (relatively) easy, and it has nothing to do neither with JXTemplateTransformer, nor with Cocoon core in general.
What you want is easily implemented as a ScriptSource, implementation of a Source interface, which would parse function name and parameters from the URI, call a method, and serialize (if getInputStream is called), or XML-ize (if toSAX is called) returned object.
Proposed URI syntax:
script:myMethod(param1, param2, param3)
Actually, it won't differ much from what is already possible in Gecko browsers, where GIF image source can be obtained as a result of method execution:
<script>
function getPicture(a,b,c) {
return ...;
}
</script>
<img src="javascript:getPicture('a', 'b', 'c')"/>Vadim
