XSLT Mapping with Java
Enhancement 
The XSLT specification proposes an enhancement mechanism that enables the system to call external routines from XSLT for transforming XML structures. Java is a programming language that is supported by some Java XSLT processors as an enhancement language.
Using the XSLT mapping with Java enhancement, you can implement mappings quicker and more flexibly.

The current working draft of the specification for XSL transformations (XSLT) version 2.0 (version from December 20, 2001), does not define the features of the enhancement mechanism of the XSL transformation. There are also no accompanying standards that standardize the enhancement mechanism with Java. For this reason, XSLT processors available on the open market vary considerably in this respect.
Below is a description of one of the ways that the SAP J2EE Engine supports the XML Toolkit 2.0.
To implement an XSLT mapping with Java enhancement, proceed as follows:
1. Implement a Java class that contains the static methods of transforming XML documents or structures.
2. Include the method calls in the XSLT mapping program.
3. Import the XSLT mapping program and the Java class as archive to the Integration Repository. If you use two separate archives, you have to import them to the same namespace.
The following example illustrates the procedure using a simple message mapping.
The following graphic shows a source message that is to be transferred to the target message, using an XSLT mapping program with Java enhancement.
The class method merge() of the Java class com.company.group.MappingClass, groups the values of the elements <first name> and <last name> of the source message together in a string that represents the value of the element <name> of the target message.
In the XSLT mapping program in which you want to call the Java method above, declare the Java class with namespace definition as an attribute of the element <xsl:stylesheet>. The namespace name can be any string you want; in the example it is called javamap. The namespace ID comprises the string java: as a prefix and the full name of the class. The complete name of a Java class comprises the name of the package and the class name.
Use <xsl:param> to define the parameters that you want to transfer in the method calls. Give these parameters the appropriate values. In this example, two parameters of the signature of the method merge () are defined correspondingly. The parameter first adopts the value of the element <first name>, while the parameter last adopts the value of the element <last name>.
In this example, the method call is called with the element <xsl:value of>. Specify the method with the corresponding parameters using the attribute select. The name for the namespace javamap replaces the complete class name as a prefix.

SAP advises you to check the availability of methods before you call them. Test the XSL element <xsl:if> using the attribute test, for example.

Using this mapping program, the source message is converted to the target message.