Custom Web Publishing Guide

Table Of Contents
60 Custom Web Publishing Guide
Here is an example of creating a session and then storing a favorite color in the session:
<xsl:variable name="session">
<xsl:choose>
<xsl:when test="not (fmxslt:session_exists(string($session-name)))">
<xsl:value-of select="fmxslt:create_session(string($session-name))"/>
</xsl:when>
<xsl:otherwise>true</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="favorite-color" select="fmxslt:set_session_object(string($session-name), 'favorite-color',
string($color))"/>
Important
1 To make sure that users are logged out of a database after completing a session, use the
fmxslt:invalidate_session () function to force the session to time out immediately.
1 If you are using global fields or a script that sets or modifies a state, you must use the Administration
Console to enable the
XSLT Database Sessions option for the Web Publishing Engine. Otherwise, global field
values and states are not maintained between requests. See the FileMaker Server Advanced Web Publishing
Installation Guide
.
fmxslt:set_session_object(String
session-name, String name, Object value)
XSLT object
(number, string,
boolean, or
node-set)
Stores an XSLT object (a number, string, boolean,
or node-set) under a session, which can be later
retrieved using the fmxslt:get_session_object ()
function.
This function also returns the previously stored
object under the specified session object name. If
nothing was stored under the name, it returns a
null object.
fmxslt:get_session_object(String
session-name, String name)
XSLT object Retrieves an XSLT object from the session.
fmxslt:remove_session_object(String
session-name, String name)
XSLT object Returns and then removes an XSLT object from
the session.
Session extension function
Data type
returned Description