Custom Web Publishing Guide

Table Of Contents
Chapter 5
|
Developing FileMaker XSLT stylesheets 65
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
.
1 If you switch to another database file when using Web Publishing Engine sessions, global field values
are not preserved. The Web Publishing Engine closes the first file before opening the second file. As an
alternative, you can access data from the second database file by using a layout in the first database file.
Sending email messages from the Web Publishing Engine
You can use the Web Publishing Engine to generate email messages, which is useful for custom web
solutions. To have the Web Publishing Engine send an email message, use one of the following three
fmxslt:send_email () extension functions in an XSLT stylesheet. You can use these functions to send one or
more separate messages. Because the
fmxslt:send_email () functions are contained in the Web Publishing
Engine’s server-side XSLT stylesheet, a client cannot use the Web Publishing Engine to send unauthorized
email messages.
Email extension function
Data type
returned Description
fmxslt:send_email(String smtpFields,
String body)
boolean Sends a plain text email message of any length from the
Web Publishing Engine using the Web Publishing
Engine’s default text encoding for email messages
fmxslt:send_email(String smtpFields,
String body, String encoding)
boolean Sends a plain text email message of any length using one
of the following text encodings: US-ASCII, ISO-8859-1,
ISO-8859-15, ISO-2022-JP, Shift_JIS, UTF-8. For
information on these encodings, see
“Setting text
encoding for requests” on page 56.
fmxslt:send_email(String smtpFields,
String xsltFile, Node xml, boolean
includeImages)
boolean Sends an HTML-based email message using the
encoding that is specified by encoding attribute of the
<xsl:output> element in the stylesheet. If the encoding
attribute is not included in the <xsl:output> element, the
Web Publishing Engine’s default text encoding for email
messages is used.