Some design guidelines for XSP pages.

In short: use Logicsheets.

The simplest XSP pages place the logic and expressions directly into the page, i.e. the functions are declared and invoked from the same page ('Embedded logic'). The cleanest way is to remove the logic into a separate page (a Logicsheet). This is the preferred way to create XSP pages.

As Logicsheets are implemented as transforms, they become reusable tag libraries:

This separation does provide the potential to implement tag libraries using different languages, although it's not clear if Cocoon supports a mixture of languages in a single XSP. Probably not...