Java Integration

Creating an extension with Java

Layout of this Document:

Sample – Building the Java Component

Calling the extension from TransactXML Server

Calling the extension from the XSLT engine

=======  Sample – Building the Java Component =======

  1. Install the JDK (Java Development Kit)

Download from:

2. Save the following text to

public class HelloJava {

public static String SayHello(String strInput)    {

String strRet = “[“;

strRet += strInput;

strRet += “]:Hello Java”;

return strRet;



3. Create the class file by compiling like this:


4. Set the [Java] section in TXML.TXT like this


5.  Move the class file from step 3 into the location configured in step 4

Copy HelloJava.class c:\MyJavaObjects

Now your custom java extension is ready to be used from TransactXML Server or the XSLT engine. Both examples are shown.

===  Calling the extension from TXML Server ===

1.      From DesignerXML, double click an element to get the following dialog:

Java-E1Change the “Element Value Source” to “Custom extension” and the following dialog box will popup. The Dialog will be empty by default. You should set the following values to call the example built above:

Java-E2This causes the Element “MyElement” to get it’s value from the external Java function.  Double click the parameter to set it’s value.

===  Calling the extension from XSLT Engine ===

XSLT Engine Syntax:           functoid:LANGUAGE%COMPONENT%INTERFACE%METHOD()

To call the example above use the following syntax:


Here’s a complete example to transform this XML:

<customers at=’yes’>






to this HTML table:


 by processing this XSL:

<xsl:stylesheet version=’1.0’xmlns:xsl=””xmlns:functoid=”functoid”&gt;

<xsl:template match=”customers”>

<table width=”20%” border=”1″>


<xsl:for-each select=”name”>

<!–Sort the table by customer name–>




<xsl:value-of select= “functoid:Java%HelloJava.class%HelloJava%SayHello(.)”/>








Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s