Define a Transformation File

Refer to the Sample XSLT File sample file to define a transformation file. This XSLT file shows that the routing key is derived based on the value of the address element of the request message. The address element contains a telephone number. You can edit the file, as required.

Sample XSLT File Location

ASG_CONFIG_HOME/GetLocation/xslt/operations/parse_getLocation.xsl

Sample XSLT File

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:loc="urn:oma:wsdl:pxprof:terminallocation:1.0:interface:local">
    <xsl:template match="/">
        <xsl:variable name="nbRequestHref">
            <xsl:value-of select="/transformation/nbRequest/@href" />
        </xsl:variable>
        <xsl:variable name="nbRequest">
            <xsl:copy-of select="document($nbRequestHref)/soap:Envelope/soap:Body/*" />
        </xsl:variable>
        <output>
            <xsl:variable name="address">
                <xsl:value-of select="$nbRequest/loc:getLocation/loc:address" />
            </xsl:variable>
            <xsl:variable name="partner">
                <xsl:value-of select="$nbRequest/loc:getLocation/loc:requester" />
            </xsl:variable>
            <xsl:variable name="opCoId">
                <xsl:value-of select="substring($address,6,2)" />
            </xsl:variable>
            <requester>
                <xsl:value-of select="$partner" />
            </requester>
            <serviceInterfaceVersion></serviceInterfaceVersion>
            <referenceId></referenceId>
            <serviceId></serviceId>
            <timestamp></timestamp>
            <correlationId></correlationId>
            <identityId></identityId>
            <opCoId>
                <xsl:value-of select="$opCoId" />
            </opCoId>
            <partnerId>
                <xsl:value-of select="$partner" />
            </partnerId>
            <routingKey>
                <xsl:choose>
                    <xsl:when test="$opCoId != ''">
                        <xsl:value-of select="$opCoId" /></xsl:when>
                    <xsl:otherwise>undefined</xsl:otherwise>
                </xsl:choose>
            </routingKey>
            <address><xsl:value-of select="$address"/></address>
        </output>
    </xsl:template>
</xsl:stylesheet>