Sample XSLT (Encode)

The following is the sample XSLT for the encode function, which encodes the special characters in the <payload> element of request message to the URL- encoded characters.

In the following example, the description field is defined as Single general admission theater ticket. The encode() function transforms the value of description field as Single%20general%20admission%20theater%20ticket.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:url="http://www.tibco.com/asg/content-types/url" xmlns:f="http://www.tibco.com/asg/functions/url" exclude-result-prefixes="xsl f">
    <xsl:output indent="yes" method="xml" />
    <xsl:template match="/">
        <context>
            <entry name="request">
                <http>
                    <payload>
                        <xsl:copy-of select="f:encode(context/entry[@name='request']/http/payload)" />
                    </payload>
                </http>
            </entry>
        </context>
    </xsl:template>
</xsl:stylesheet>