I think you can use a combination of session attributes and jx macros to get the effect you want, e.g.
// Flow script
function toSAX(str, consumer) { ... }
cocoon.session.setAttribute("stringToSAX", toSAX);
So you can set a Flowscript function as an attribute of a Session? Well, I suppose it makes sense, since in the end it's just an Object, but it would have never occurred to me.
Since both Flow script (cocoon.load()) and JXTemplateGenerator (<jx:import/>) support including other files you can factor such code into supporting "library" files and include them in your application code.
That's true, but I suspect it's going to quickly become a FAQ unless we do something to support it out-of-the-box. The number one FAQ related to XSP is already "How do I insert an XML fragment taken from whatever source inside my output without having special characters escaped?" or a similar one.
Ugo
