Skip to end of metadata
Go to start of metadata

Introduction

The XSLT plugin applies an XSL Transform (XSLT) style sheet to an input file as it passes from the source to the target. The plugin uses the Saxon XSLT processor which supports XSLT 2.0.

NOTE: Jitterbit Harmony now supports XSLT natively in Design Studio version 8.4 and later.

NameTypeRequiredDescription

XSLT.stylesheet

string

false

XSLT style sheet in plain text

XSLT.stylesheet_filename

string

false

Name of a file containing the XSLT style sheet to apply. It can be an absolute path or a path relative to the plugin install directory.

NOTE: This page uses Design Studio as an example; you may use this plugin in Cloud Studio using similar steps.

Example Use Case

A typical example is to fetch data from one web service and feed the data to a second web service. In this example, the data fetched from the source web service has namespaces (ns1). However, the target web service does not need the namespaces. Using the XSLT plugin, the namespaces will be removed from the source web service data prior to calling the target web service.

These steps outline how to use the XSLT plugin to remove the namespaces from the source web service data and then call the target web service.

  1. Download the XSLT plugin at XSLT 2.0 (.ZIP)
  2. Add the XSLT plugin to Jitterbit Harmony Management Console.
    1. To access the Plug-ins page, log in to the Harmony Portal, then click the orange hamburger menu in the top left:
    2. From the menu, hover over Management Console > Customizations and select Plug-ins:
  3. To add the XSLT plugin click the  button in the upper right corner of the Plugins page. In the popup, use the  button to browse to the plugin ZIP file. The fields will populate with information for the plugin.  Click the Save button.
  4. Once the plugin is saved it will display in the Plug-ins table as shown in the image below. To associate a plugin with an available Agent Group, use the Action dropdown on the far right and select Associate Agent Group.
  5. The available Agent Groups will be listed in the popup. Select the Agent Group you want to associate, then click Save.
  6. Use the Action dropdown on the far right and select View Manifest File. The manifest file will display as shown below.

    <JitterbitPlugin SpecVersion="1.0">
    <PipelinePlugin SpecVersion="1.0">
    <Name>
    org.jitterbit.plugin.pipeline.user.XSLTtransformSaxon
    </Name>
    <Version>1.1.0</Version>
    <DisplayName>Jitterbit XSLT 2.0 Transform Saxon</DisplayName>
    <Author>Jitterbit, Inc</Author>
    <Description>
    Applies an XSL stylesheet to input file. Uses the Saxon XSLT processor which supports XSLT 2.0.
    </Description>
    <UpdateUrl/>
    <DocumentationUrl/>
    <!--
     Command line used to execute the plugin. Since this plugin is implemented 
             using the Java SDK, it is executed by invoking Java. You need to use version
             6 or higher of Java to use the Java SDK. 
    -->
    <Command>C:\WINDOWS\SYSTEM32\java.exe</Command>
    <!--
     The arguments to pass to the executable. Since this plugin is packaged as an
             executable JAR file, you need to pass -jar and the path to the JAR file.
             $(plugin.directory) expands to the directory where the plugin is installed. 
    -->
    <Arguments>
    -jar "$(plugin.directory)jitterbit-xslt-saxon-plugin.jar"
    </Arguments>
    <DataElements>
    <DataElement Name="XSLT.stylesheet" Type="string" Required="false">
    <Documentation> XSLT Stylesheet in plain text. </Documentation>
    </DataElement>
    <DataElement Name="XSLT.stylesheet_filename" Type="string" Required="false">
    <Documentation>
    Name of a file containing the XSLT style sheet to apply. It can be an absolute path or a path relative to the plugin install directory.
    </Documentation>
    </DataElement>
    </DataElements>
    <!--
     The value describes where the plugin can be applied, e.g. Target, Source, WebServiceCall
             Relative is where in relation to the pipeline position this plugin is executed 
    -->
    <PipelinePosition Optional="true" Relative="Post" ExecutionOrder="50">Source</PipelinePosition>
    <PipelinePosition Optional="true" Relative="Pre" ExecutionOrder="50">Target</PipelinePosition>
    <PipelinePosition Optional="true" Relative="OnRequest" ExecutionOrder="75">WebServiceCall</PipelinePosition>
    <PipelinePosition Optional="true" Relative="OnResponse" ExecutionOrder="75">WebServiceCall</PipelinePosition>
    </PipelinePlugin>
    </JitterbitPlugin>
    
    
    1. It is important to read the manifest to find the location where the plugin expects Java to be installed. Verify Java is installed at that location.  If Java is in a different location on the private agent, you must perform these steps:
      • Stop the private agent.
      • Browse to the plugin folder on the private agent.
      • Edit the manifest file to point to the correct location of Java.
      • Restart the private agent.
  7.  Within Jitterbit Design Studio, create a new script (use XSLT code) to strip off the namespaces as shown in this example script:

    <trans>
    $XSLT.stylesheet = '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:ns1="urn:microsoft-dynamics-nav/xmlports/x50001" exclude-result-prefixes="ns1">
    <xsl:output method="xml" encoding="utf-8" indent="yes"/> 
    <xsl:strip-space elements="*"/
    <xsl:template match="ns1:*">
    <xsl:element name="{local-name()}" namespace="urn:microsoft-dynamics-nav/xmlports/x50001">
    <xsl:apply-templates select="node() | @*"/>
    </xsl:element>
    </xsl:template>
    <xsl:template match="node() | @*">
    <xsl:copy>
    <xsl:apply-templates select="node() | @*"/>
    </xsl:copy>
    </xsl:template>
    </xsl:stylesheet> ';
    </trans>

    NOTE: The variable name in the script above is very important. You need to use the same variable name that the plugin looks for. The plugin looks specifically for $XSLT.stylesheet and uses the value assigned to it in the script.

  8. In the operation shown below, you will see the script (XSLT Code), the source for the operation (Invoice Text), the transformation (CreateInvoices) and the web service call (createInvoice). 

    1. The script can be anywhere within this operation flow. 
    2. The plugin is applied at the point where the web service (createInvoice) is called.
    3. Right-click on the web service (createInvoice) and select Plugin in the dropdown.
  9. The Pipeline Plugins popup window should display as shown in the image below. 

    1. The plugin has been assigned to the private agent in previous steps, thereby allowing the Design Studio to see and display the plugin in the Available plugins section within the bottom half of the popup window. If the plugin does not immediately display, click the Refresh button in the popup window
    2. You must select the Pipeline Position. In this example, the plugin is called when the input is sent, which occurs while making the request to the web service. The WebServiceCall-On Request option is selected. 
    3. Click the Assign button.
  10. The XSLT 2.0 Transform Saxon plugin now displays in the Currently assigned section of the popup. Click the Apply button to assign the plugin and click on OK to close the popup.
  11. Save and deploy the operation. The operation is complete and is ready to test. 

Last updated:  Jan 31, 2020