Show TOC

XSLT MappingLocate this document in the navigation structure

Use

Interface descriptions are in the form of XML documents. XSL Transformation (XSLT) is a member of the XML family of languages. It describes how one XML structure is transformed into another XML structure.

Features

Recommendation Related to Usage of SAP XML Toolkit and JDK

In releases lower than SAP NetWeaver Process Integration (PI) 7.1, XSLT programs are executed using the SAP XML Toolkit. SAP XML Toolkit is supported by SAP NetWeaver PI 7.1, and will continue to be supported by higher release versions.

However, new customers are advised to use Java Development Kit (JDK) for all new XSLT mapping programs and to test any existing XSLT programs with JDK and modify them accordingly. Check out for the latest

JDK has the following advantages over the SAP XML Toolkit:

  • Quicker execution of XSLT programs

  • More advanced troubleshooting

  • Greater scope of functions

When you have installed SAP NetWeaver 7.3, we recommend you use JDK 6. This also applies to enhancement package 1 for SAP NetWeaver 7.3.

Note

To use the JDK as the runtime for XSLT mapping programs, do not select Use SAP XML Toolkit in the operation mapping from which you reference the XSLT mapping program.

XPath and <xsl:include>

You can define mappings using XSLT together with XPath. XPath is also a specification of the XML family. Using XPath you can address any node in an XML document. XSLT implements XPath expressions to select substructures of an XML document. Using templates in XSLT you can define the mapping rules for the selected substructures.

You can use the XSLT tags <xsl:include> and <xsl:import> to include predefined templates for substructures in a complete mapping definition. In this way you can reuse mappings for data types.

Runtime Constants

In the same way as in Java mappings, the mapping runtime in XSLT programs also returns parameters that you can use to evaluate information in the XSLT program that is not known until runtime.

Mapping Runtime Constants

Constant

Meaning

Relevant for PCK

$MessageClass

Classification of message. Possible values:

  • ApplicationMessage : Asynchronous or synchronous request message

  • ApplicationResponse : Response to a request message

  • SystemAck , ApplicationAck , SystemError , ApplicationError : Acknowledgment Messages

Yes

$VersionMajor

XI message protocol version. Example: For the XI 3.0 message protocol VERSION_MAJOR = 3 and VERSION_MINOR = 0.

No

The PCK only uses message protocol XI 3.0.

$VersionMinor

No

$ProcessingMode

The mode of a message can be synchronous or asynchronous. Correspondingly, these constants can have the value synchronous or asynchronous .

Yes

$MessageId

The message ID. It can change during communication:

  • Response messages get a new message ID.

  • If new messages result from a message (the message is copied at multiple receivers), the new messages get new message IDs.

Yes

$RefToMessageId

The ID of a referenced message that belongs semantically to this message. For example, a response message uses this field to note which request message it belongs to.

Yes

$ConversationId

This field is not mandatory in the message. It enables an ID to be used to group messages that belong together. This field is not intended to be used for message serialization and has nothing to do with the serialization context ( ABAP proxy runtime, Java proxy runtime).

Yes

$TimeSent

Time stamp specifying when the message was sent by the sender. The format of the time stamp is as follows:

YYYY-MM-DDTHH:MM:SSZ

The letter 'T' separates the date from the time, which is generally specified in UTC. If it is a local time, the closing 'Z' is omitted.

Yes

$Interface

Sender interface name. As of SAP XI 3.0, use this constant instead of the constant SENDER_NAME used previously.

Yes

$InterfaceNamespace

Sender interface namespace.

As of SAP XI 3.0, use this constant instead of the constant SENDER_NAMESPACE used previously.

Yes

$SenderParty

Communication party that sent the message.

Yes

See also: Communication Party

$SenderPartyAgency

Issuing agency for the message sender.

Yes

$SenderPartyScheme

Identification scheme used by the sender.

Yes

$SenderService

Service on the sender side that sent the message. For example, the name of a business system.

As of SAP XI 3.0, use this constant instead of the constant SENDER_SYSTEM used previously.

Yes

See also: Service

$ReceiverName

Receiver interface name.

Yes

$ReceiverNamespace

Receiver interface namespace.

Yes

$ReceiverParty

Communication party to receive the message.

Yes

See also: Communication Party

$ReceiverPartyAgency

Issuing agency for the message receiver.

Yes

$ReceiverPartyScheme

Identification scheme used by the receiver.

Yes

$ReceiverService

Service on the receiver side that receives the message. For example, the name of a business system.

As of SAP XI 3.0, use this constant instead of the constant RECEIVER_SYSTEM used previously.

Yes

See also: Service

$MappingTrace

Returns an AbstractTrace object that you can use to write messages to monitoring in the mapping program.

No

If you want to access one of the constants in the XSLT program, you first have to declare the constant as a parameter, for example:

<xsl:param name="MessageId" />

Java Enhancements

Moreover, using an XSLT definition you can call external Java methods to convert XML structures. This procedure gives you more flexibility when defining mappings. For more information about XSLT mapping with Java enhancement , see further documentation.

Note

For more information about XSL/XSLT and XPath, see the Web page of the http://www.w3c.org/Information published on non-SAP site .

Example

The function for booking a flight contains a parameter for the flight class. The outbound interface represents flight classes as symbolic values; in the inbound interface, flight classes have numerical values. The XSLT section converts the symbolic representation of the source system into the numerical representation of the target system.

The XPath expression match="//hh:class" selects the node <hh:class> in the outbound interface. The XSLT statement < xsl:choose > then defines the mapping rule for how the Process Integration runtime converts the symbolic values in the source system into the numerical values in the target system.