setCookie (name : string, value : string, expires : datetime) : void

The example output looks like: 


The first output is a URL without the use of “urlEncode”. Unlike the second output, where all special characters are replaced.

<xsl:variable name="value">username</xsl:variable>
<xsl:value-of select="web:setCookie('cookiename', $value)" />
<xsl:value-of select="web:setCookie('cookiename', '', dt:date-time())" />

In the example, a cookie with the name “cookiename” and the content of the variable “value” is created first.

Finally, the same cookie is accessed and the current date and time set. The cookie has thus been set to expired.

The option of setting the current date does not come without a risk, since it may be that the validity of the cookies is queried in the same time and it has thus not yet passed. It is better to set the time to at least a few seconds before the current time.