Edit XSLT Code in the Mapper

You can directly edit the XSLT code of your mappings inside the mapper. 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.

Editing of XSLT code for advanced use cases such as the following is supported:
  • 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>, and <xsl:apply-templates>
  • Write your own functions in XSLT using <xsl:function>
  • Copy node sets using <xsl:copy> and <xsl:copy-of>
  1. Click Code.

    The current XSLT code for your mappings is displayed.


    This image shows the XSLT code view of your mappings. Sections at the very top of the code do not allow editing. Above the code are three icons to the left and eight icons to the right.

See the following sections for XSLT code editing guidelines:

Restrictions on Editing

The following sections of your XSLT code remain read-only and cannot be edited.
  • Attribute version numbers:
    <xsl:stylesheet version="2.0"
  • The mapper schema section where sources and targets are specified:
    <oracle-xsl-mapper:schema xml:id="id_2">
                  <!--SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY.-->
                  <oracle-xsl-mapper:mapSources xml:id="id_3">
                        <oracle-xsl-mapper:source type="WSDL" xml:id="id_4">
                              <oracle-xsl-mapper:schema location="../../application_8/outbound_9/resourcegroup_10/echoRequest_REQUEST.wsdl" xml:id="id_5"/>
                              <oracle-xsl-mapper:rootElement name="execute" namespace="http://xmlns.oracle.com/cloud/adapter/REST/echoRequest_REQUEST/types" xml:id="id_6"/>
                        </oracle-xsl-mapper:source>
                        <oracle-xsl-mapper:source type="WSDL" xml:id="id_20">
                              <oracle-xsl-mapper:schema location="../../processor_83/resourcegroup_84/sList_REQUEST.wsdl" xml:id="id_21"/>
                              <oracle-xsl-mapper:rootElement name="ListFilesResponse" namespace="http://xmlns.oracle.com/cloud/adapter/stagefile/sList_REQUEST/types" xml:id="id_22"/>
                              <oracle-xsl-mapper:param name="sList" xml:id="id_23"/>
                        </oracle-xsl-mapper:source>
                        <oracle-xsl-mapper:source type="XSD" xml:id="id_24">
                              <oracle-xsl-mapper:schema location="../../processor_27/resourcegroup_28/ICSIntegrationMetadata.xsd" xml:id="id_25"/>
                              <oracle-xsl-mapper:rootElement name="metadata" namespace="http://www.oracle.com/2014/03/ic/integration/metadata" xml:id="id_26"/>
                              <oracle-xsl-mapper:param name="self" xml:id="id_27"/>
                        </oracle-xsl-mapper:source>
                  </oracle-xsl-mapper:mapSources>
                  <oracle-xsl-mapper:mapTargets xml:id="id_7">
                        <oracle-xsl-mapper:target type="WSDL" xml:id="id_8">
                              <oracle-xsl-mapper:schema location="../../application_8/outbound_9/resourcegroup_10/echoRequest_REQUEST.wsdl" xml:id="id_9"/>
                              <oracle-xsl-mapper:rootElement name="executeResponse" namespace="http://xmlns.oracle.com/cloud/adapter/REST/echoRequest_REQUEST/types" xml:id="id_10"/>
                        </oracle-xsl-mapper:target>
                  </oracle-xsl-mapper:mapTargets>
                  <!--GENERATED BY ORACLE XSL MAPPER 12.1.2.0.0-->
            </oracle-xsl-mapper:schema>
  • The global parameter declaration section:
    <xsl:param name="sList" xml:id="id_28"/>
            <xsl:param name="self" xml:id="id_29"/>
            <xsl:param name="tracking_var_1" xml:id="id_30"/>
            <xsl:param name="tracking_var_2" xml:id="id_31"/>
            <xsl:param name="tracking_var_3" xml:id="id_32"/>
            <xsl:param name="var_assignment_1" xml:id="id_33"/>

Toolbar Options

The toolbar above your XSLT code provides a series of shortcuts for navigating through and editing XSLT code.

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. Click Next Search for next occurrence icon and Previous Search for previous occurrence icon 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 code line icon Enter the line number in your XSLT code to access.

Edit the XSLT Code

The following section of your XSLT code is where the changes you make in the graphical designer are reflected. You can also edit the XSLT code in this section and see your changes reflected in the designer.
<xsl:template match="/" xml:id="id_11">
            <nstrgmpr:executeResponse xml:id="id_12">
                  <nstrgdfl:response-wrapper xml:id="id_16">
                        <nstrgdfl:Message xml:id="id_17">
                              <xsl:value-of select="/nstrgmpr:execute/nstrgmpr:TemplateParameters/nsmpr0:message" xml:id="id_18"/>
                        </nstrgdfl:Message>
                        <nstrgdfl:Welcome xml:id="id_19">"Welcome to OIC!!!  Echo was successful."</nstrgdfl:Welcome>
                  </nstrgdfl:response-wrapper>
            </nstrgmpr:executeResponse>
      </xsl:template>
For example, assume you have the following XSLT code that you want to replace:
<nstrgdfl:Welcome 
             <nstrgdfl:Welcome xml:id="id_19">"Welcome to OIC!!! Echo was successful."
</nstrgdfl:Welcome>

This code is currently visible in the mapper as literal text:


The TemplateParameters element in the source section is mapped to the Message element in the target section. Below is the Expression Builder section with a string value of Welcome to OIC.

  1. Replace the literal value of "Welcome to OIC" with the variable $tracking_var_3:
    <nstrgdfl:Welcome xml:id="id_19">
                 <xsl:value-of select="$tracking_var_3" xml:id="id_18"/>
    </nstrgdfl:Welcome>
    
  2. Click Designer Designer mode icon.

    The designer is updated to reflect your changes:


    The Tracking Variable 3 source element is mapped to the Welcome target element. Below is the Expression Builder section with a value of Tracking Variable 3. At the far right are two icons.

    Note:

    If you make changes that the mapper does not recognize and attempt to click Designer, the tab is disabled and a message is displayed indicating that the change is not supported. You must resolve those issues before you can return to the designer.
  3. Click Validate or Close (which also performs validation) to exit the mapper, then click Apply to save your changes when prompted.

Code Validation

As you make updates to the XSLT code, your changes are validated. Validation safeguards prevent you from returning to the designer if there are errors. For example:

  • Typographical errors:
    1. Assume you make a typographical error such as forgetting the f at the end of xsl:value o.
      The code shows an error ("f" is missing at the end): xsl:value o

    2. Click Designer. An error message is displayed in the banner and you are prevented from returning to the designer until you fix the error.
      Unknown: xsl:value-o
    3. Correct the error and click Designer to return to the designer.
  • XML syntax errors:
    1. Assume you make an XML syntax error such as forgetting to enter a closing bracket (>) after Welcome in the following code. The subsequent code is highlighted in red to indicate an error.
      The Welcome icon is missing a closing bracket, which causes the code below to appear in red, indicating an error.

    2. Click Designer Designer mode icon. An error message is displayed in the banner and you are prevented from returning to the designer or accessing other tabs such as Test Test mappings icon until you fix the error.
      There are syntax errors in the edited code. Please fix them before navigating away from the tab
    3. Correct the error and click Designer Designer mode icon to return to the designer.
  • Unsupported constructs in the mapper (for example, you import XSLT code into the mapper that includes unsupported functions):
    1. Open the mapper in the integration canvas.
      The Code Mapper code icon tab opens by default with the following message.
      This map cannot be loaded in graphical view.
    2. Expand the number to the left of the error for details.

      These are coding patterns and constructors that are not supported in the designer. The designer does not know how to render or manage them. When the XSTL code includes unsupported patterns or constructors, you cannot navigate to the designer.