Custom Web Publishing Guide

Table Of Contents
64 Custom Web Publishing Guide
Using the string manipulation extension functions
You can use the string manipulation functions to change the encoding of strings of any length.
String manipulation
extension function
Data type
returned Description
fmxslt:break_encode(String value) string Returns an HTML break-encoded string. Characters
such as “&” (ampersand) are replaced with “&”.
New line characters such as line feeds and carriage
returns are replaced with <br/>. This function works only
if the disable-output-escaping attribute of the <xsl:value-
of> and <xsl:text> elements is set to “yes” (disable-output-
escaping="yes").
Note To include a line feed or carriage return in the
string that the fmxslt:break_encode() function is applied
to, you must use the following escape characters in the
string: “&#10;” (for line feed) or “&#13;” (for carriage
return). You cannot include a line feed or carriage return
in the string by pressing the return key in your text editor.
fmxslt:html_encode(String value) string Returns an HTML-encoded string; characters such as
“&” (ampersand) are replaced with “&amp;”
fmxslt:url_encode(String value) string Returns a URL-encoded string. URL encoding is used to
transmit characters over the Internet, particularly for
URL’s. For example, the “&” (ampersand) in a URL-
encoded form is %26. If a reserved character is used in
your href, use this function to URL-encode your string.
fmxslt:url_encode(String value,
String encoding)
string Returns a URL-encoded 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 know that a
web server will be expecting a different character
encoding than the one used in your current stylesheet.
For example, your web site entrance page might be
displayed in UTF-8, but users may click a link to go to a
Japanese page. If the request includes Japanese
characters and the Japanese pages use Shift_JIS
encoding, it is best to encode the string in Shift_JIS.
fmxslt:url_decode(String value) string Returns a URL-decoded string from a URL string that
was previously encoded.