Custom Web Publishing Guide

Table Of Contents
66 Custom Web Publishing Guide
[ ] Large
If a user selected Red only, then the field would contain the string “Red.” To determine whether the field
contains “Blue”, you could use the following function call:
fmxslt:contains_checkbox_value(<field value node>,'Blue')
where <field value node> is the XPath to the <data> element for the checkbox field. The function would return
“false” in this example.
A common application of this function is to display the checkbox value list in a web page and select the
checkboxes in the web page that are selected in the database. For example, the following HTML and XSLT
statements create a set of checkboxes for a field named style using a value list named color_size:
<xsl:variable name="field-value" select="fmrs:field[@name='style']/fmrs:data" />
<xsl:for-each select="$valuelists[@NAME = 'color_size']/fml:VALUE">
<input type="checkbox">
<xsl:attribute name="name">style</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute>
<xsl:if test="fmxslt:contains_checkbox_value($field-value,.)">
<xsl:attribute name="checked">checked</xsl:attribute>
</xsl:if>
</input><xsl:value-of select="."/><br/>
</xsl:for-each>
The HTML and XSLT statements in the example would output the following checkboxes on a web page, with
Red and Medium selected:
[x] Red
[ ] Blue
[ ] Green
[ ] Small
[x] Medium
[ ] Large
Using the date, time, and day extension functions
You can use extension functions to get the current date, time, or day, and to compare any two dates, times, or
days.
The functions in the following table use these predefined date and time formats in the United States, which are
defined by the defaults for the locale in the host computer where the Web Publishing Engine is installed:
1 Short date format is: M/d/yy
1 Long date format is: MMM d, yyyy
1 Short time format is: h:mm a
1 Long time format is: h:mm:ss a z
1 Short day format is: EEE (in all locales). For example: “Sun”