Custom Web Publishing Guide

Table Of Contents
58 Custom Web Publishing Guide
For example, suppose you wanted to create a pull down menu for a field named Color that is populated with
the values from a value list named shirts that are defined in a layout in a FileMaker database. Here’s how you
can use the
document() function to load the layout information into a XSLT variable:
<xsl:variable name="layout" select="document(concat($xml-base-uri,'/fmi/xml/FMPXMLLAYOUT.xml?-db=products
&-lay=sales&-view'))" />
<select size="1">
<xsl:attribute name="name">Color</xsl:attribute>
<option value="">Select One...</option>
<xsl:for-each select="$layout/fml:FMPXMLLAYOUT/fml:VALUELISTS/fml:VALUELIST[@NAME = 'shirts']/
fml:VALUE">
<option>
<xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute>
<xsl:value-of select="."/>
</option>
</xsl:for-each>
</select>
Using content buffering
When content buffering is disabled, the Web Publishing Engine streams the result of an XSLT transformation
directly back to the client. Content buffering is always disabled unless you explicitly enable it. If you enable
content buffering, the Web Publishing Engine stores the transformed content until the entire transformation is
finished.
Content buffering is required for XSLT stylesheets that manipulate headers. Because headers are written
before the response body, the body must be buffered so that the added header information can be included.
There are four FileMaker extension functions that require the XSLT transformation result to be buffered:
1 fmxslt:create_session(): See “Using the session extension functions” on page 59.
1 fmxslt:set_header(): See “Using the header functions” on page 62.
1 fmxslt:set_status_code (): See “Using the header functions” on page 62.
1 fmxslt:set_cookie(): See “Using the cookie extension functions” on page 63.
In order for these FileMaker extension functions to work properly, you must include the following XSLT
processing instruction in the top level document for the request:
<?xslt-cwp-buffer buffer-content="true"?>
Important If you have a base stylesheet that includes another stylesheet, then the base stylesheet must include
the
<?xslt-cwp-buffer?> processing instruction. This instruction is ignored if it is used in an included stylesheet.
A benefit of using the processing instruction to buffer the response is that the Web Publishing Engine can
determine the length of the response and set the Content-Length header in the response. Buffering the response
might reduce the Web Publishing Engine’s performance.
Using Web Publishing Engine sessions to store information between requests
You can use the Web Publishing Engine’s server-side sessions to track and store any type of information
between requests. Sessions allow you to create a web application that is able to maintain state by using
persistent arbitrary pieces of information between requests. For example, user client information that is entered
on a first form page could be stored in a session and then used to populate values on a subsequent page.