Friday, February 28, 2025

OIC - How to retrieve previous node value using preceding-sibling in OIC XSLT

Retrieving the Previous Node Value in OIC XSLT: Ensuring RT Records Have D1 as the Previous Record

Use Case: RT Record Validation in Oracle Integration Cloud (OIC)

In Oracle Integration Cloud (OIC), performing sequence-based validation in XML transformations is essential to maintain data integrity. One such scenario requires verifying that every RT record is immediately preceded by a D1 record.

Validation Rules:

  • If a record starts with "RT", the immediately preceding record must start with "D1".
  • If an "RT" record does not have a preceding "D1", a structure validation error will be thrown to ensure data correctness.

This validation helps enforce the required sequence before further processing, preventing incorrect or incomplete data from being processed in OIC.

Json used for writing a validation messages using stage:

{

    "Validation" : [{

        "Message" : "XXXXXXXXXXXX"

    }]

}

Solution steps:

  1. For each record
  2. Check if it is record starting with RT.  substring(ns:23FileData, 1,2) = 'RT'
  3. Check the preceding node not starting with D1,  substring ($ReadRawSourceFile/nsmpr0:Read Response/ns23:FileRowSet/ns23:FileRow[(ns23:FileData = current()/ns23:FileData)]/preceding-sibling::ns23:FileRow[1.0]/ns23:FileData, 1, 2) !="D1"
  4. validation error message: dvm:lookupValue("File_Validation", "key","V25","ValidarionMessage","Invalid File")

Detailed screenshots:





Similarly, to get next sibling node. We can use below xslt construct.

"following-sibling::*[1]"


No comments:

Post a Comment

Featured Post

OIC - Creating Folders in SharePoint Using Microsoft Graph API 1.0 in Oracle Integration Cloud

Use Case Many businesses need to automate folder creation in SharePoint based on dynamic inputs. A common requirement is to create folders ...