Custom Web Publishing with XML and XSLT

Table Of Contents
Chapter 6
|
Developing FileMaker XSLT stylesheets 71
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