The Integration blog covers the latest in product updates, best practices, customer stories, and more.

Edit XSLT Source Code in OIC Mapper UI

Ishruthilaya Malarvizhi
Technical Lead

This blog is for a new feature coming out in Oracle Integration Cloud (OIC) February 2021 release.

Previously the XSLT source code corresponding to a map, was available in readonly mode in Mapper UI. With this new feature, the editing of the XSL source code is allowed in the Mapper UI in the 'Code' tab like below:

This action is useful for use cases in which mapping is not possible in the graphical mapper. This eliminates the need to export your XSLT code from Oracle Integration, edit the code manually in a text editor or in a separate graphical tool such as Eclipse or Oracle JDeveloper and then re-import the code into the mapper in Oracle Integration.

Some examples of the use cases in which the mapping not possible in the graphical mapper and the editing in the Code tab can be used are:

  • Create internal variables using <xsl:variable>
  • Correlate multiple sources grouped by key fields using <xsl:for-each-group>
  • Dynamically create target name-value pairs based on runtime data using <xsl:element><xsl:attribute>
  • Implement "push style" XSLT using <xsl:template><xsl:call-template><xsl:apply-templates>
  • Write your own functions in XSLT using <xsl:function>
  • Copy node sets using <xsl:copy><xsl:copy-of>

Steps to Edit the XSLT Source Code in Mapper:

  1. Open the integration which contains the map whose source code has to be edited (Maps which were previously edited externally, outside of OIC and imported, could also be edited in Mapper UI now, using the Source Code editing in Code tab) 
  2. Locate the map for which the XSLT source code needs to be edited (any desired map including imported maps can be opened for xsl source code editing)
  3. Click on the 'Edit' option/pencil icon of the map action
  4. Once the Mapper UI is launched, navigate to the 'Code' tab in the Mapper UI and start editing the XSLT source code

Availability of Designer Tab (Graphical UI) in Mapper:

When the Mapper UI is launched for a map, the default tab is 'Designer' tab. However if the map contains reference to unsupported constructs, i.e constructs which are not recognised or allowed by the Designer tab of the Mapper, then the 'Code' tab is launched by default. In such a use case, an informational message is displayed to indicate the reason clearly like below:

Click on the number to the left of the message to view the reasons why the graphical view is not available, like below:

Editing in the Code Tab:

A few sections of the map are not allowed for editing and are rendered in readonly mode in the Code tab. Those sections are listed below:

XSLT Version Attribute in the Stylesheet Element

The 'version' attribute of the 'xsl:stylesheet' element in the map is not allowed for editing, hence displayed in the view only mode like below:

Map Sources and Target Specification Section

The section where the map's sources and target are specified, under the 'oracle-xsl-mapper:schema' is not allowed for editing and is rendered in read only mode in the Code tab like below:

Global Params Declaration

The statements declaring the global params in the map is not allowed for editing and displayed in readonly mode.

The remaining sections in the map are allowed for editing in the Code tab.

Navigation From Code Tab

The user can edit the mappings or create new mappings in the Code tab and navigate to other tabs if needed. If the edit made in the Code tab results in any xml syntax error, for example, there is no matching closing tag found for an opening tag, then the navigation to other tabs like Test, Designer, Recommend is not allowed until the syntax error is fixed.  The error is indicated with an error message in the banner of the page as well as the text  below the line where the matching closing tag is not found, is highlighted in red font. Below is a sample screenshot demonstrating this use case:

In the screenshot above, there is no matching closing tag found for the opening tag '<xsl:if>' at line no.34 and there is an attempt made to navigate to 'Recommend' tab which is prevented and the message is displayed.

To Designer/Recommend Tab

If the map refers to any constructs not supported in the Designer Tab, then on trying to navigate to the Designer/Recommend Tab, the tab is disabled and messages explaining the reason is displayed, like described in the 'Availability of Designer Tab (Graphical UI) in Mapper' sectionIf the unsupported constructs are removed, on trying to navigate to the Designer/Recommend tab, the tab becomes available again.

To Test Tab

The user can navigate to the 'Test' tab any time while editing the source code in the Code tab. If there are any XSLT validation errors, like a required attribute for a XSLT construct being empty, those error/warning messages are displayed in the banner of the page and the test tab is displayed.


Toolbar Options in Code Tab

Option     Description
Undo icon Undo your last editing changes to the XSLT code.
Redo icon Redo your last editing changes to the XSLT code.
Search icon Search for specific entries in your XSLT code. Use the next (Search for next entry) and previous (Search for previous entry) buttons to navigate through the code.
Find and replace icon Find and replace specific entries in your XSLT code.
  1. Enter the text to replace and press Enter:

    Replace text icon

  2. Enter the text to substitute and press Enter:

    Replace with text

  3. Replace the text individually or globally when prompted.

    Replace options of Yes, No, All, and Stop

Go to line icon Enter the line number in your XSLT code to access.


PS: Undo/Redo history is reset each time the user navigates to other tabs i.e the undo/redo history of the edits made in a tab is local to the tab and works as long as the user stays on the same tab and is lost if the user navigates to other tabs and returns to the tab where the user was editing the mappings. The undo/redo becomes available for the new changes again.

Validating and Saving the Source Code Changes

Once the source code is edited, the changes can be saved by clicking on the 'Validate' button at the top right corner. This triggers the validation process on the edited source code and if any error/warning exists, the corresponding message is displayed in the banner.

XML Syntax Errors

If any xml syntax errors are found on validating, for example, no matching closing tag found for an opening tag, the error message is displayed in the UI and the changes made are not saved to the map. The errors need to be fixed in order to save the changes. If the user chooses to exit the mapper ui, without fixing the errors, then the changes made in the code tab are not saved to the map.

XSL Syntax Errors

If there are any xsl syntax errors found in the validation of the source code, for ex, a typographical error in the xsl construct name or a required attribute of a xsl construct missing its value, then the changes are saved to the map and the corresponding error/warning message is displayed in the UI. If the user chooses to exit the mapper UI without fixing the errors/warnings, then the map action is marked with a error/warning badge in the integration layout screen. However the changes made by the user would be saved to the map and the user can always revisit the mapper UI to fix the errors/warnings.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.