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. string()
Converts a value to a string.
Example:
<xsl:value-of select="string(123)"/>
2. concat()
Concatenates multiple strings together.
Example:
<xsl:value-of select="concat('Hello ', 'World')"/>
3. substring()
Extracts a substring from a string.
Example:
<xsl:value-of select="substring('Hello', 1, 3)"/>
4. contains()
Checks if a string contains a specified substring.
Example:
<xsl:value-of select="contains('Hello World', 'World')"/>
5. starts-with()
Checks if a string starts with a specified substring.
Example:
<xsl:value-of select="starts-with('Hello', 'Hel')"/>
6. normalize-space()
Removes leading and trailing whitespace and replaces sequences of whitespace characters with a single space.
Example:
<xsl:value-of select="normalize-space(' Hello World ')"/>
7. substring-before()
Returns the part of the string before the first occurrence of a specified substring.
Example:
<xsl:value-of select="substring-before('Hello World', ' ')"/>
8. substring-after()
Returns the part of the string after the first occurrence of a specified substring.
Example:
<xsl:value-of select="substring-after('Hello World', ' ')"/>
9. translate()
Replaces characters in a string according to a mapping.
Example:
<xsl:value-of select="translate('abcABC', 'abc', '123')"/>
10. number()
Converts a value to a number.
Example:
<xsl:value-of select="number('123')"/>
11. format-number()
Formats a number according to a specified pattern.
Example:
<xsl:value-of select="format-number(12345.678, '#,##0.00')"/>
12. string-length()
Usage: Returns the length of a string.
Example:
<xsl:value-of select="string-length('Hello World')"/>
13. upper-case() / lower-case()
Usage: Converts a string to uppercase or lowercase.
Example:
<xsl:value-of select="upper-case('hello')"/>
14. sum()
Usage: Returns the sum of numeric values in a node-set.
Example:
<xsl:value-of select="sum(/root/item/price)"/>
15. key()
Usage: Retrieves nodes from a key value pair, often used for fast lookups.
Example:
<xsl:value-of select="key('mykey', 'keyname')"/>
16. 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