Mapping Container

The input document to the XSLT file for XSLT transformations is described by the following schema(XSD):

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<xs:element name="transformation" type="transformationType"/>
<xs:complexType name="transformationType">
<xs:sequence>
<xs:element name="nbRequest" type="stageType" minOccurs="0"/>
<xs:element name="cnRequest" type="stageType" minOccurs="0"/>
<xs:element name="sbRequest" type="stageType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="sbResponse" type="stageType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="cnResponse" type="stageType" minOccurs="0"/>
<xs:element name="nbResponse" type="stageType" minOccurs="0"/>
<xs:element name="context" type="stageType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="stageType">
<xs:attribute name="href" type="xs:string"/>
</xs:complexType>
</xs:schema>

The request payloads and the request context is passed to the XSLT as a map, keyed using the values of the “href” attribute for each element. In order to access the actual payload, it is necessary to load it using the document() function.

The schemas contains the following elements:

  • nbRequest – This element represents the northbound request payload.
  • cnRequest – This element represents the request payload after the northbound forward mapping has been applied.
  • sbRequest – This one element is present for each of the array of request payloads after the southbound forward mapping has been applied
  • sbResponse – This one element for each request sent to the southbound service endpoint. It contains either the received response or an error document.
  • cnResponse – This element represents the response payload generated by the southbound reverse mapping.
  • nbResponse – This element represents the response payload after the northbound reverse mapping has been applied.
  • context – This element represents additional context document related to the request. It contains the headers from request and response and transport related information.

At any stage during request processing, only the versions of the request payload created up to that point are available. Though the mapping container has the corresponding element present, an attempt to load the payload via document() causes the XSLT processor to throw an error.

For example, use the following XSLT snippet to map a value when the received request is SOAP :

<xsl:variable name="nbRequest">
<xsl:value-of select="/transformation/nbRequest/@href"/>
</xsl:variable>
<xsl:choose xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<xsl:when test="count(document($nbRequest)/soap:Envelope/soap:Body)=1">
This is a SOAP request
</xsl:when>
<xsl:otherwise>This is not a SOAP request</xsl:otherwise>
</xsl:choose>