XSLTExternalMappingIU

Class name

com.ebd.hub.datawizard.iu.XSLTExternalMappingIU


This Integration Unit can be used to execute an XSLT transformation on an XML file. See example below.

Parameters


Parameter

Allowed values

Default value

Description

debug

true, false

false

If true, the temporary files (see log) are not deleted.

xslt factory


net.sf.saxon.TransformerFactoryImpl

Specification of XSLT factory.

xslt file



Path of XSLT file. Note: Several XSLT files can be specified, separated by semicolons, which are then processed sequentially. For example, ./conf/xslt_test/xslt_v1.xslt;./conf/xslt_test/xslt_v2.xslt

By default, the Saxon library is used for the transformation, which has to be installed first. You could, for example, go to page https://sourceforge.net/ and search for "saxon". Download the ZIP file and move the contained .jar files to the folder ./extlib. The specified factory in the Integration Unit (parameter xslt factory) must be available in the classpath of the Integration Server (which it is if you put the .jar files in the folder ./extlib). Note: You have to restart the Integration Server to make the new classes 'visible' (to load them).

The parameter xslt file specifies the XSLT file that is used for the transformation.


xslt factory

net.sf.saxon.TransformerFactoryImpl

xslt file

./conf/xslt_test/xslt_v1.xslt


If you do not provide the correct Saxon library, you will get the following error message when executing a profile using this Integration Unit.


... Provider net.sf.saxon.TransformerFactoryImpl not found ...

Example


Create a new profile, choose Input Agent "Man. Upload", and then select document type "Custom Class" (this setting sends the data directly to the Integration Unit). You can use the settings above for the Integration Unit in phase 5. The specified XSLT file will be provided below. Create a Response of type "File" and use the file path ./tmp/xslt/ausgabe_xslt.xml . Set the content to Output of IU. Important note: The Integration Unit expects files with UTF-8 encoding.

The following is the XSLT file specified in the Integration Unit. Download: xslt_v1.xslt


xslt_v1.xslt
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="teacher">
<p><u><xsl:value-of select="."/></u></p>
</xsl:template>
<xsl:template match="student">
<p><b><xsl:value-of select="."/></b></p>
</xsl:template>
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


Use the following XML file as the input file for the profile. Download: xslt_test.xml


xslt_test.xml
<?xml-stylesheet type="text/xsl" href="class.xsl"?>
<class>
<student>Jack</student>
<student>Harry</student>
<student>Rebecca</student>
<teacher>Mr. Bean</teacher>
</class>


Your profile should produce the following output file.


output_xslt.xml
<html>
<body>
<p><b>Jack</b></p>
<p><b>Harry</b></p>
<p><b>Rebecca</b></p>
<p><u>Mr. Bean</u></p>
</body>
</html>