Difference between a WAM Layout and a Layout Weblet

Date:18 April 2008
Product/Release:LANSA for the Web V11 SP4
Abstract:Difference between a WAM Layout and a Layout Weblet
Submitted By:LANSA Technical Support

Assist in understanding the difference between a WAM Layout and a Layout Weblet.

This is the basic architecture a WAM layout:

Click to enlarge

The main webroutine calls a template called “layout”. The layout template renders the HTML for the layout and passes control back to the main webroutine.xsl in the appropriate place with an <xsl:apply-templates select=”*” wd:role=”std:webroutine”/>. Every layout file has a template called “layout”. The actual file used is controlled by the <xsl:import> at the top of the webroutine.xsl. When you drag a new layout onto a webroutine the editor changes the <xsl:import> as appropriate.

Layout Weblets add some complication to this. A layout Weblet is used by many WAM layouts. The layout Weblet provides the master layout for the WAM layout. The WAM layout then modifies portions of the layout for it’s own needs.

Click to enlarge

The main webroutine calls the wam_layout. This immediately hands off the drawing of the layout to the layout Weblet. The template in the Weblet must have a different name. An <xsl:call-template name=”layout”/> inside the first layout template would just cause it to call itself. The layout Weblet allows the wam_layout to modify parts of the layout through the use of “.override” templates. The standard layouts provide .override template for the menu areas of the layout.

When you drag a layout onto a webroutine, the editor knows what you are doing and it updates the import. When you drag a layout Weblet onto a layout the editor does the same thing as it does for any Weblet – it adds an <xsl:import> and a <xsl:call-template> (and it copies any .override templates from the Weblet into the layout). When you specify a layout in the RDMLX and generate all you are doing is changing the <xsl:import> that is generated in the Webroutine XSL. The Webroutine XSL will still call a template called “layout”.

The difference between a Layout and a Layout Weblet is in the template name. A Layout has a template named “layout” and is called by the webroutine. A layout Weblet has a template named anything but “layout” and is called from a WAM Layout.

Note: We have found that a technique being commonly used is to apply a common layout to existing webroutines is to delete the layout Weblet from the webroutine layout and then drag another webroutine layout onto it. In other words treat the webroutine layout as if it was a layout Weblet. You would end up with something like this:

Click to enlarge

By renaming the “layout” template in wam_layout.xsl the endless loop problem is avoided, and by dragging wam2_layout onto wam_layout, it adds wam2_layout to the import tree. And by renaming the “layout” template in wam_layout that template is taken out of the process. So the call-template in the webroutine now jumps straight past wam_layout to wam2_layout. This method allows WAM layout to be treated like a layout Weblet and drag it onto another WAM Layout. But this method is NOT recommended because wam2_layout is not called from a layout Weblet and may not always work correctly.