Custom Web Publishing Guide

Table Of Contents
Converting CDML solutions to FileMaker XSLT 111
After conversion of this example, there are fewer elements in the checkoutform because the –format tag has
been removed. To fix this example, you must manually change the JavaScript to check
document.checkoutform.elements[2] rather than document.checkoutform.elements[3].
1 The expression evaluation logic in CDML is different from the logic in XSLT. For example, the following
CDML expression outputs “userchoice less than 1” if userchoice is empty:
[fmp-if: currentcookie:userchoice .lt. 1 ]
userchoice less than 1
[fmp-else]
userchoice not less than 1
[/fmp-if]
In XSLT, the same converted expression outputs “userchoice not less than 1” if userchoice is empty:
<xsl:choose>
<xsl:when test="fmxslt:get_cookie('userchoice') &lt; '1'">
userchoice less than 1
</xsl:when><xsl:otherwise>
userchoice not less than 1
</xsl:otherwise>
</xsl:choose>
The reason for the difference is that the CDML expression performs a numeric comparison, but the XSLT
expression performs a string comparison. To return the same results in XSLT as the original CDML
expression, change the XSLT statements to account for the empty string. For example:
<xsl:variable name="userchoice" select="fmxslt:get_cookie('userchoice')"/>
<xsl:choose>
<xsl:when test="string-length($userchoice) = 0 or $userchoice &lt; '1'">
userchoice less than 1
</xsl:when><xsl:otherwise>
userchoice not less than 1
</xsl:otherwise>
</xsl:choose>
Conversion of CDML replacement tags to XSLT-CWP
This section describes the conversion of all CDML replacement tags to XSLT-CWP statements. In all cases:
1 The converted XSLT-CWP statements use the fmresultset grammar.
1 When an XSLT-CWP statement returns a value inside an SGML element attribute value, the {name} form
is used; otherwise, the
<xsl:value-of select="name" /> form is used.
1 When a CDML tag has an Encoding parameter, the converted XSLT-CWP value is passed through one of
the following extension functions for encoding:
fmxslt:break_encode(), fmxslt:html_encode (), or
fmxslt:url_encode (). See “Using the string manipulation extension functions” on page 64. The Encoding
value “Raw” specifies no encoding. When the encoding is set to “Raw”, the CDML Converter sets the
“disable-output-escaping” attribute of the
<xsl:value-of> and <xsl:text> elements to “yes”.
1 When inside an HTML-type document, the fmxslt:html_encode () extension function is not used.