Custom Web Publishing Guide

Table Of Contents
76 FileMaker Server Advanced Custom Web Publishing Guide
Checking the error status of extension functions
You can use the following extension function within an XSLT stylesheet to check the current error status of
the most recently called FileMaker XSLT extension function and handle errors that occur during the
processing of your pages:
fmxslt:check_error_status()
When the fmxslt:check_error_status() function is called, the Web Publishing Engine returns the current error
code value for the most recently called function as a Number type, and then resets the error status to 0 (“No
Error”). For information on the error code values, see
“Error code numbers for the FileMaker XSLT
extension functions” on page 111.
Using logging
You can use the standard XSLT <xsl:message> element to write log entries to the Web Publishing Engine
application log file. See
“Using the Web Publishing Engine application log” on page 83.
Using server-side processing of scripting languages
The underlying XSLT transformer embedded in the Web Publishing Engine supports server-side processing
of scripting languages. As a result, you can use JavaScript to develop your own extension functions that can
be called directly from an XSLT stylesheet.
With FileMaker Server 8 Advanced, two Java libraries are installed to enable this functionality:
1 bsf.jar – This library allows the XSLT transformer to connect to scripting languages.
1 js.jsr – This library is a full JavaScript implementation from the Mozilla project.
With these libraries, you can create your own extension functions inside your XSLT stylesheet code. These
extension functions can implement any scripting logic and can be more manageable than relying on XSLT
and XPath to accomplish logical functions.
You can find more detailed information about the extension support of the XSLT transformer on the Apache
Xalan Extensions website:
http://xml.apache.org/xalan-j/extensions.html
Defining an extension function
To define an extension function inside your stylesheet:
1. Define the namespace for the extension.
Add the xalan namespace to instruct the XSLT transformer to support extension components, providing
the name for your own extension function namespace. The following example uses
fmp-ex as the
extension function namespace prefix.
<xsl:stylesheet version="1.0"
xmlns:xsl=http://www.w3.org/1999/XSL/Transform
xmlns:xalan=http://xml.apache.org/xslt
xmlns:fmp-ex="ext1"
exclude-result-prefixes="xsl xalan fmp-ex">