How to convert a Delimited String into an Array using OIC.
👤 Audience: Oracle Integration Cloud (OIC) Developers and enthusiasts
📘 Topic: Working with payload-to-file use cases in OIC Gen3
In real-world integrations, it’s common to receive data in a compact form -often as a comma-separated (or otherwise delimited) string. While concise, this format isn’t always convenient for downstream processing, especially when your flow expects a structured array.
With Oracle Integration Cloud (OIC) Gen 3, there’s a neat way to solve this problem using an XSLT function called:
oraext:create-nodeset-from-delimited-string(ArrayName, SourceString, Delimiter)
Business Scenario
Let’s say your REST API receives the following Delimited String payload:
{
"EmailString":"email1@gmail.com,email2@gmail.com,email3@gmail.com"
}
We need to transform it into a structured array like this:
{
"ArrayOfemails": [
{
"Email": "email1@gmail.com"
},
{
"Email": "email2@gmail.com"
},
{
"Email": "email@gmail.com"
}
]
}
This allows downstream systems to process each email as a discrete element -ideal for looping, validations, or targeted transformations in the mapper.
Understanding the Function
The oraext:create-nodeset-from-delimited-string function takes three arguments:
oraext:create-nodeset-from-delimited-string(arg1, arg2, arg3)
arg1--> New Array Name we wanted to create
arg2--> Source Delimited String Input-
arg3--> Delimiter inside the Source String- Comma
📌 Important Note: This function must be used inside a for-each loop since it returns an array.
XSLT Mapper Implementation
Here’s how it looks in your OIC XSLT Mapper:
Recommended by LinkedIn
<xsl:template match="/" xml:id="id_11">
<nstrgmpr:executeResponse xml:id="id_12">
<ns16:response-wrapper>
<ns16:emails>
<xsl:for-each select="oraext:create-nodeset-from-delimited-string ("{}ArrayofEmails", /nstrgmpr:execute/ns16:request-wrapper/ns16:EmailString, "," )">
<ns16:Email>
<xsl:value-of select="."/>
</ns16:Email>
</xsl:for-each>
</ns16:emails>
</ns16:response-wrapper>
</nstrgmpr:executeResponse>
</xsl:template>
<xsl:for-each select="oraext:create-nodeset-from-delimited-string ("{}ArrayofEmails", /nstrgmpr:execute/ns16:request-wrapper/ns16:EmailString, "," )"> This is how we are looping the array returned from splitting the string
<ns16:Email><xsl:value-of select="."/> </ns16:Email> This maps the email address from the For each array loop
Sample Input
EmailString--->>"email1@gmail.com,email2@gmail.com,email3@gmail.com"
Expected Output
<ns16:response-wrapper>
<ns16:emails>
<ns16:Email>email1@gmail.com</ns16:Email>
<ns16:Email>email2@gmail.com</ns16:Email>
<ns16:Email>email3@gmail.com</ns16:Email>
</ns16:emails>
</ns16:response-wrapper>
Why This Matters
Use Case Demo:
Showing a different Example
Final Thoughts
This approach is a clean, reusable pattern in Oracle Integration Cloud Gen 3. If you frequently deal with delimited values in REST or file-based integrations, leveraging oraext:create-nodeset-from-delimited-string will save you time and keep your mapping logic elegant.
Have you used this function in your integrations?
Drop your experiences in the comments-I’d love to hear how others are applying it in real-world OIC projects. Do comment on your way of approach to this use case.
#OracleIntegration #OIC #XSLT #IntegrationPatterns #CloudIntegration #OracleCloud
Great sharing! Thanks for the insightful post.
Thanks for sharing, Shashikumar
great going, Shashikumar
Thanks for sharing, Shashikumar