You can use the customized XSLT capability to extend the default integration. The system contains an internal XSLT file that maps all attributes. The merchant does not have access to this XSLT file; however, you can provide a path to the XSLT. The XSLT should contain the logic that customizes the Oracle Retail Order Management createOrder payload so that it includes dynamic properties or makes mapping changes.

This XSLT workflow is active only when the Oracle Retail Order Management integration is enabled. The merchant must upload the XSLT using Oracle Commerce Cloud’s file upload endpoints. If no customized XSLT file is uploaded, the system uses the default XSLT file to pass orders, ignoring any custom attributes.

When creating a custom XSLT file:

To use a customized XSLT file, do the following:

The following illustration defines the way that the merchant’s transformation is applied when the XSLT path is provided.

XSLT Example

The following is an example of an XSLT file:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
    xmlns:str="http://exslt.org/strings" xmlns:exsl="http://exslt.org/common"
    exclude-result-prefixes="str exsl">
  <xsl:output indent="yes" method="xml" omit-xml-declaration="yes" />
    <xsl:template match="/">
      <xsl:variable name="vOrder" select="request/atgResponse/order" />
      <Message>
        <xsl:copy-of select="request/Message/@*" />
        <Header>
          <xsl:copy-of select="request/Message/Header/@*" />
        <Payments>
          <xsl:for-each select="request/Message/Header/Payments/Payment">
            <Payment>
              <xsl:copy-of select="@*" />
            </Payment>
          </xsl:for-each>
        </Payments>
        <ShipTos>
          <xsl:for-each select="request/Message/Header/ShipTos/ShipTo">
            <ShipTo>
              <xsl:copy-of select="@*" />
                <Items>
                  <xsl:for-each select="Items/Item">
                    <Item>
                      <xsl:copy-of select="@*" />
<!-- **************************************************
      Updating an existing mapping
******************************************************** -->
<!-- To change the mapping of an existing OROMS attribute, comment the line
(<xsl:copy-of select="@*" />) and uncomment below line and replace
<oroms_attribute> with the attribute name required in output and <occ_attribute>
with attribute name in occ XML map an attribute in oroms XML to a different value,
comment the above line and uncomment below line and replace <oroms_attribute> with
the attribute name required in output and the <occ_attribute> with attribute name
in occ XML -->

<!-- <xsl:copy-of select="@*[name()!='<oroms_attribute>']" /> <xsl:attribute
name="tax_override"> <xsl:value-of select="//request/atgResponse/order/
<occ_attribute>" /> </xsl:attribute> -->

<!-- *********************************************************
Mapping a dynamic attribute of OCC to a new attribute in OROMS
*********************************************************** -->
<!-- To add a new attribute "category" at item level in oroms XML, which reads the
data from the dynamic attribute shopperCategory. Replace <occ_attribute> with the
dynamic attribute name in occ. -->

<!-- <xsl:attribute name="category"> <xsl:value-of select="//request/atgResponse/
order/<occ_attribute>" /> </xsl:attribute> -->

<!-- *******************************************************
Mapping a dynamic attribute of OCC with comma separated item level
data to a new attribute in OROMS
************************************************************** -->
<!-- To map a dynamic attribute in occ in format skuId1-value1,skuId2-value2.
Replace <occ_attribute> with the dynamic attribute name in occ and
<oroms_attribute> with oroms attribute name. -->

<!-- <xsl:variable name="vOromsAttribute" select="@short_sku_number"/>

<xsl:for-each select="str:tokenize($vOrder/<occ_attribute>,',')">
<xsl:variable name="temp" select="str:tokenize(.,'-')"/>
<xsl:if test="$temp[1]=$vOromsAttribute">
<xsl:attribute name="<oroms_attribute>"> <xsl:value-of select="$temp[2]" />
</xsl:attribute>
</xsl:if>

</xsl:for-each> -->

<!-- *******************************************************************
Mapping a dynamic attribute of OCC in JSON with a new attribute in OROMS
******************************************************************** -->
<!-- To map a dynamic attribute in occ in json format (sample json format is given
below ). Replace <occ_attribute> with the dynamic attribute name in occ,
<oroms_attribute> with oroms attribute name and <dynamicAttributeFieldName> with
specific field name in the dynamic attribute json -->

<!--  Sample JSON:
  [
    {
      "giftwraplineId":"gift-wrap-item-gwprod1001-834215",
      "giftWrapSkuId":"gwprod1001",
      "giftWrapSkuDescription":"Gift Wrap Product",
      "giftWrapSkuPrice":5,
      "skuId":"834215",
      "skuDescription":"Opal Innocence Silver 8\" Salad Plate",
      "quantity":1
    },
    {
      "giftwraplineId":"gift-wrap-item-gwprod1001-845353",
      "giftWrapSkuId":"gwprod1001",
      "giftWrapSkuDescription":"Gift Wrap Product",
      "giftWrapSkuPrice":5,
      "skuId":"845353",
      "skuDescription":"Bald Eagle Figurine",
      "quantity":1
    }
  ]
 -->

<!-- <xsl:variable name="vOromsAttribute" select="@short_sku_number" />
<xsl:attribute name="<oroms_attribute>">
  <xsl:call-template name="readCustomProperty">
    <xsl:with-param name="json" select="$vOrder/<occ_attribute>" />
    <xsl:with-param name="skuId" select="$vOromsAttribute" />
    <xsl:with-param name="dynamicAttributeName" select="
        <dynamicAttributeFieldName>" />
  </xsl:call-template>
</xsl:attribute>
 -->
                    </Item>
                  </xsl:for-each>
                </Items>
              </ShipTo>
            </xsl:for-each>
        </ShipTos>
        </Header>
      </Message>
    </xsl:template>

    <xsl:variable name="quot" select="'&quot;'" />
    <xsl:variable name="skuIdWithQuots" select="concat('skuId\', $quot, ':\'
        $quot)" />

    <xsl:template name="readCustomProperty">
      <xsl:param name="json" />
      <xsl:param name="skuId" />
      <xsl:param name="dynamicAttributeName" />

      <xsl:variable name="temp" select="normalize-space
          (substring-after($json,'{'))" />
      <xsl:variable name="fullSkuJson" select="normalize-space
          (substring-before($temp,'}'))" />
      <xsl:variable name="remainingJson" select="normalize-space
          (substring-after($temp,'}'))" />

      <xsl:call-template name="readCustomPropertyBySkuId">
        <xsl:with-param name="fullSkuJson" select="$fullSkuJson" />
        <xsl:with-param name="remainingJson" select="$remainingJson" />
        <xsl:with-param name="skuId" select="$skuId" />
        <xsl:with-param name="dynamicAttributeName" select=
          "$dynamicAttributeName" />
      </xsl:call-template>
    </xsl:template>

    <xsl:template name="readCustomPropertyBySkuId">
      <xsl:param name="fullSkuJson" />
      <xsl:param name="remainingJson" />
      <xsl:param name="dynamicAttributeName" />
      <xsl:param name="skuId" />
      <xsl:variable name="temp" select="normalize-space
          (substring-after($fullSkuJson,$skuIdWithQuots))" />
      <xsl:variable name="skuIdValue" select="normalize-space
        (substring-before($temp,'\'))" />

      <xsl:if test='$remainingJson'>
        <xsl:variable name="temp1" select="normalize-space
          (substring-after($remainingJson,'{'))" />
        <xsl:variable name="fullSkuJson1" select="normalize-space
          (substring-before($temp1,'}'))" />
        <xsl:variable name="remainingJson1" select="normalize-space
          (substring-after($temp1,'}'))" />
        <xsl:call-template name="readCustomPropertyBySkuId">
          <xsl:with-param name="fullSkuJson" select="$fullSkuJson1" />
          <xsl:with-param name="remainingJson" select="$remainingJson1" />
          <xsl:with-param name="skuId" select="$skuId" />
          <xsl:with-param name="dynamicAttributeName"
            select="$dynamicAttributeName" />
        </xsl:call-template>
      </xsl:if>

      <xsl:if test='$skuId = $skuIdValue'>
        <xsl:variable name="attributeNameWithQuots"
            select="concat($dynamicAttributeName, '\', $quot, ':\' , $quot)" />
        <xsl:variable name="temp2" select="normalize-space
            (substring-after($fullSkuJson,$attributeNameWithQuots))" />
        <xsl:variable name="attributeValue" select="normalize-space
            (substring-before($temp2,'\'))" />
        <xsl:value-of select="$attributeValue" />
      </xsl:if>
  </xsl:template>
</xsl:stylesheet>

Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices