Monday, December 30, 2024

OIC - Commonly Used XSLT Functions in Oracle Integration Cloud (OIC)

In Oracle Integration Cloud (OIC), the most commonly used XSLT functions are primarily focused on transforming, filtering, and manipulating XML data. Here's a list of the most widely used XSLT functions:

1. concat()

Usage: Concatenates multiple strings into a single string.

Example:

<xsl:value-of select="concat('Hello ', 'World')"/>

2. substring()

Usage: Extracts a part of a string.

Example:

<xsl:value-of select="substring('Hello World', 1, 5)"/>

3. normalize-space()

Usage: Removes leading and trailing whitespace and normalizes internal spaces.

Example:

<xsl:value-of select="normalize-space('  Hello    World  ')"/>

4. string-length()

Usage: Returns the length of a string.

Example:

<xsl:value-of select="string-length('Hello World')"/>

5. upper-case() / lower-case()

Usage: Converts a string to uppercase or lowercase.

Example:

<xsl:value-of select="upper-case('hello')"/>

6. if-then-else

Usage: Conditional logic to perform different actions based on a condition.

Example:

<xsl:choose>

<xsl:when test="$value = 'apple'">Apple</xsl:when>

  <xsl:otherwise>Not an apple</xsl:otherwise>

</xsl:choose>

7. for-each

Usage: Iterates over a node-set, allowing processing of each element.

Example:

<xsl:for-each select="/root/element">

  <xsl:value-of select="."/>

</xsl:for-each>

8. sum()

Usage: Returns the sum of numeric values in a node-set.

Example:

<xsl:value-of select="sum(/root/item/price)"/>

9. key()

Usage: Retrieves nodes from a key value pair, often used for fast lookups.

Example:

<xsl:value-of select="key('mykey', 'keyname')"/>

10. format-dateTime()

Usage: Formats a date-time value in a specified pattern.

Example:

<xsl:value-of select="format-dateTime(current-dateTime(), '[Y0001]-[M01]-[D01]')"/>

These functions are essential for transforming data in OIC, especially when handling XML data. They allow for dynamic manipulation of string, numeric, date, and node-set data, making XSLT a powerful tool in integration scenarios.


No comments:

Post a Comment

Featured Post

OIC - Can we use/call plsql in OIC xslt for complex logic processing?

No, we cannot directly call PL/SQL within XSLT or use it for complex logic processing in Oracle Integration Cloud (OIC). However, there are ...