Chapter 12. Presentation (Bebop) Tutorial

This chapter provides useful tutorials for learning and exercising the presentation system using Bebop, as introduced in Chapter 5 WAF Component: Presentation. The focus is primarily on integrating other presentation methods such as CSS, CSL and JSP into WAF, while demonstrating how to use Bebop. This chapter does not provide any general tutorials on these other tools. For a starting point to finding tutorials about these methods, see Chapter 14 References.

12.1. Calling XSLT from a WAF Application

The gateway to XSLT from WAF is the PresentationManager interface, whose servePage method selects a stylesheet to use, applies the selected stylesheet to an XML document, and sends the output from the transformation to the client. This information was originally discussed in Section 5.2.1 Integrating XSLT with WAF.

The most commonly used implementation of PresentationManager is the provided BasePresentationManager, which searches for a stylesheet for a request by first looking for a stylesheet associated with the active site node, then the parents of the active site node, and finally the default stylesheet for the current package. It also takes the locale and output type for the request into account when selecting stylesheets.

Any selected stylesheet may use the xsl:import or xsl:include tags to import rules from another stylesheet. There are two common uses for this: a package's default stylesheet will import stylesheets from other packages that it depends on; and a customized stylesheet (for example, for a site node) can import another stylesheet and the rules defined in the customized stylesheet will override conflicting rules in the imported one.

Calling XSLT from WAF applications is transparent if you use Bebop — you pass a Bebop Page object directly as an argument to BasePresentationManager.servePage(). That form of servePage will save the step of explicitly generating an XML document as output from the Page object:

Page p = ... Bebop page ...;
BasePresentationManager.getInstance().servePage(p, request,

Any WAF application code that wants to render an XML Document object into HTML output directly, without using Bebop, would call the servePage method of PresentationManager using approximately this pattern:

import com.arsdigita.templating.PresentationManager; import

Document doc = ... generated document ...

// grab a presentation manager instance
PresentationManager pm = SomePMClass().getInstance();
pm.servePage(doc, request, response);