Custom Web Publishing Guide

Table Of Contents
70 FileMaker Server Advanced Custom Web Publishing Guide
Comparing strings using Perl 5 regular expressions
You can use the fmxslt:regex_contains() extension function to compare strings using Perl 5 regular
expressions. A regular expression comparison is an advanced type of text matching that enables you to
determine if a string matches a specified pattern. The syntax of this function is:
fmxslt:regex_contains(String input, String pattern)
where input is a string and pattern is a Perl 5 regular expression. For more information on the syntax of Perl 5
regular expressions, see www.perldoc.com. The
fmxslt:regex_contains() function returns a boolean value.
This function is useful if you need more advanced string manipulation than is provided by standard XSLT.
For example, you can determine if a field value contains a valid telephone number or email address by
comparing the string against a Perl 5 regular expression.
Here is an example of using this function to determine if a field value contains email addresses that are
constructed correctly:
<xsl:variable name="email" select="'foo@bar.com'"/>
<xsl:if test="fmxslt:regex_contains($email,'^\w+[\w-\.]*\@\w+((-\w+)|(\w*))\.[a-z]{2,3}$')">Valid Email</xsl:if>
If the Web Publishing Engine cannot parse the pattern, the error status is set to error code 10311. See “Error
code numbers for the FileMaker XSLT extension functions” on page 111.
Checking for values in a field formatted as a checkbox
You can use the following extension function to determine whether a particular value in a checkbox value
list is stored in a field in the FileMaker database:
fmxslt:contains_checkbox_value(String valueString, String valueListEntry)
where valuestring is an XPath specifying the field, and valueListEntry is the value you want to check for.
If the specified value is stored in the field, this boolean function returns true(). Otherwise, it returns false().
You can use this function to determine whether to set the checked attribute in an HTML form to display a
checkbox as being selected.
fmxslt:url_decode(String value) string Returns a URL-decoded string from a URL string
that was previously encoded.
fmxslt:url_decode(String value, String
encoding)
string Returns a URL-decoded string using the character
encoding you specify for the encoding parameter,
which can be: US-ASCII, ISO-8859-1, ISO-8859-
15, ISO-2022-JP, Shift_JIS or UTF-8.
Use this function in situations where you must
specify the character encoding used in a URL
encoded string in order to decode the string properly.
For example, even though your web site uses ISO-
8859-1, users might submit a form using a different
character encoding.
String manipulation
extension function
Data type
returned Description