Get Started

Sample Inbound XSL Stylesheet

The configured inbound XSL is used to transform XML incoming response to another XML, conforming to Canonical XML Message schema.   An example XSL stylesheet is listed below. This XSL which when applied to sample response above, would generate a Canonical XML Message. 

<xsl:stylesheet version="1.0>
    <xsl:output method="xml" encoding="utf-8" indent="no"/>
    <xsl:template match="/">
        <realTimeCallbackResponse xmlns="http://bp.globalpay.wu.com/realtime">
            <xsl:variable name="code">
                <xsl:value-of select="//mockStatusUpdateResponse/responseCode"/>
            </xsl:variable>
            <xsl:choose>
                <xsl:when test="$code = '200'">
                    <success>true</success>
                </xsl:when>
                <xsl:otherwise>
                    <success>false</success>
                </xsl:otherwise>
           </xsl:choose>
           <errorCode>
                <xsl:value-of select="$code"/>
            </errorCode>
            <narrative>
                 <xsl:value-of select="//mockStatusUpdateResponse/responseMessage"/>
            </narrative>
        </realTimeCallbackResponse>
    </xsl:template>
</xsl:stylesheet>