Skip Headers
Oracle® Enterprise Service Bus Developer's Guide
10g (10.1.3.3.0)

Part Number E10295-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

A XPath Extension Functions

Oracle provides XPath extension functions that use built-in ESB capabilities and XPath standards. This chapter describes the XPath extension functions, along with their descriptions, signature, argument descriptions, and property ID information

This appendix contains the following topics:

A.1 add-dayTimeDuration-to-dateTime

This function returns a new date time value adding dateTime to the given duration.

If the duration value is negative, then the resulting value precedes dateTime.

Signature:

xp20:add-dayTimeDuration-from-dateTime(dateTime as string, duration as string)

Arguments:

Property IDs:

A.2 compare

This function returns the lexicographical difference between inputString and compareString comparing the unicode value of each character of both the strings.

This function returns -1 if inputString lexicographically precedes the compareString.

This function returns 0 if both inputString and compareString are equal.

This function returns 1 if inputString lexicographically follows the compareString.

Example:

xp20:compare('Audi', 'BMW') returns -1

Signature:

xp20:compare(inputString as string, compareString as string)

Arguments:

Property IDs:

A.3 compare-ignore-case

This function returns the lexicographical difference between inputString and compareString while ignoring case and comparing the unicode value of each character of both the strings.

This function returns -1 if inputString lexicographically precedes the compareString.

This function returns 0 if both inputString and compareString are equal.

This function returns 1 if inputString lexicographically follows the compareString.

Example:

xp20:compare-ignore-case('Audi','bmw') returns -1

Signature:

orcl:compare-ignore-case(inputString as string, compareString as string)

Arguments:

Property IDs:

A.4 create-delimited-string

This function returns a delimited string created from nodeSet delimited by delimiter.

Signature:

orcl:create-delimited-string(nodeSet as node-set, delimiter as string)

Arguments:

Property IDs:

A.5 current-date

This function returns the current date in ISO format YYYY-MM-DD.

Signature:

xp20:current-date(object)

Arguments:

Property IDs:

A.6 current-dateTime

This function returns the current datetime-value in ISO format CCYY-MM-DDThh:mm:ssTZD.

Signature:

xp20:current-dateTime(object)

Arguments:

Property IDs:

A.7 current-time

This function returns the current time in ISO format. The format is hh:mm:ssTZD.

Signature:

xp20:current-time(object)

Arguments:

Property IDs:

A.8 day-from-dateTime

This function returns the day from dateTime. The default day is 1.

Signature:

xp20:day-from-dateTime(object)

Arguments:

Property IDs:

A.9 doc

This function returns the content of an XML file.

Signature:

ora:doc('fileName','xpath'?)

Arguments:

Property IDs:

A.10 ends-with

This function returns true if inputString ends with searchString.

Example:

xp20:ends-with('XSL Map','Map') returns true

Signature:

xp20:ends-with(inputString as string, searchString as string)

Arguments:

Property IDs:

A.11 format-dateTime

This function returns the formatted string of dateTime using the format provided.

Signature:

xp20:format-dateTime(dateTime as string, format as string)

Arguments:

Property IDs:

A.12 format-string

This function returns the message formatted with the arguments passed. At least one argument is required and supports up to a maximum of 10 arguments.

Example:

orcl:format-string('{0} + {1} = {2}','2','2','4') returns '2 + 2 = 4'

Signature:

orcl:format-string(string,string,string...)

Arguments:

Property IDs:

A.13 generate-guid

This function generates a unique GUID.

Signature:

orcl:generate-guid()

Arguments:

Property IDs:

A.14 get-content-as-string

This function returns the XML representation of the input element.

Signature:

orcl:get-content-as-string(element as node-set)

Arguments:

Property IDs:

A.15 get-localized-string

This function returns the locale-specific string for key. This function uses language, country, variant, and resource bundle to identify the correct resource bundle.

The resource bundle in obtained by resolving resourceLocation against the resourceBaseURL. The URL is assumed to be a directory only if it ends with /.

Usage:

orcl:get-localized-string(resourceBaseURL as string, resourceLocation as string, resource bundle as string, language as string, country as string, variant as string, key as string)

Example: orcl:get-localized-string('file:/c:/','','MyResourceBundle','en','US','','MSG_KEY') returns a locale-specific string from a resource bundle 'MyResourceBundle' in the C:\ directory

Signature:

orcl:get-localized-string(resourceURL,resourceLocation,resourceBundleName,language,country,variant,messageKey)

Arguments:

Property IDs:

A.16 getInboundResponseHeader

This function gets a string value from inbound response header.

Signature:

ehdr:getInboundResponseHeader(headerXPath, namespaceDeclarations)

Arguments:

Property IDs:

A.17 getRequestHeader

This function gets a string value from request message header.

Signature:

ehdr:getRequestHeader(headerXPath, namespaceDeclarations)

Arguments:

Property IDs:

A.18 hours-from-dateTime

This function returns the hour from dateTime. The default hour is 0.

Signature:

xp20:hours-from-dateTime(dateTime as string)

Arguments:

Property IDs:

A.19 implicit-timezone

This function returns the current time zone in ISO format +/- hh:mm, indicating a deviation from UTC (Coordinated Universal Timezone).

Signature:

xp20:implicit-timezone(object)

Arguments:

Property IDs:

A.20 index-within-string

This function returns the zero-based index of the first occurrence of searchString within the inputString.

This function returns -1 if searchString is not found.

Example:

orcl:index-within-string('ABCABC, 'B') returns 1

Signature:

orcl:index-within-string(inputString as string, searchString as string)

Arguments:

Property IDs:

A.21 last-index-within-string

This function returns the zero-based index of the last occurrence of searchString within inputString.

This function returns -1 if searchString is not found.

Example:

orcl:last-index-within-string('ABCABC', 'B') returns 4

Signature:

orcl:last-index-within-string(inputString as string, searchString as string)

Arguments:

Property IDs:

A.22 left-trim

This function returns the value of inputString after removing all the leading white spaces.

Example:

orcl:left-trim(' account ') returns 'account '

Signature:

orcl:left-trim(inputString)

Arguments:

Property IDs:

A.23 lookup-dvm

This function returns a string by looking up the value for target column in the DVM where the value for source column is equal to the source value. The source value is an xpath expression bound to the source document of the XSLT transformation. The expression will be evaluated during the transformation and the result value will be passed as the source value for lookup. This function takes 5 parameters.

Example:

orcl:lookup-dvm ('StateCodes','Long',/inp1:Customer/Profile/AccountRep/Address/State,'Short',"")

Signature:

orcl:lookup-dvm (dvmName as string, sourceColumn as string, sourceValue as xpath expression, targetColumnName as string, defaultValue as string)

Arguments:

Property IDs:

A.24 lookup-table

This function returns a string based on the SQL query generated from the parameters.

The string is obtained by executing:

SELECT outputColumn FROM table WHERE inputColumn = key

against the data source that can be either a JDBC connect string (jdbc:oracle:thin:username/password@host:port:sid) or a data source JNDI identifier. Only Oracle Thin Driver is supported if the JDBC connect string is used.

Example:

orcl:lookup-table('employee','id','1234','last_name','jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')

Signature:

orcl:lookup-table(table, inputColumn, key, outputColumn, datasource)

Arguments:

Property IDs:

A.25 lookup-xml

This function returns the string value of an element defined by lookupXPath in an XML file (docURL) given its parent XPath (parentXPath), the key XPath (keyXPath), and the value of the key (key).

Example:

orcl:lookup-xml('file:/d:/country_data.xml', '/Countries/Country', 'Abbreviation', 'FullName', 'UK') returns the value of the element FullName child of /Countries/Country where Abbreviation = 'UK' is in the file D:\country_data.xml.

Signature:

orcl:lookup-xml(docURL, parentXPath, keyXPath, lookupXPath, key)

Arguments:

Property IDs:

A.26 lower-case

This function returns the value of inputString after translating every character to its lower-case correspondent.

Example:

xp20:lower-case('ABc!D') returns 'abc!d'

Signature:

xp20:lower-case(inputString)

Arguments:

Property IDs:

A.27 minutes-from-dateTime

This function returns the minute from dateTime. The default minute is 0.

Signature:

xp20:minutes-from-dateTime(dateTime)

Arguments:

Property IDs:

A.28 month-from-dateTime

This function returns the month from dateTime. The default month is 1 (January).

Signature:

xp20:month-from-dateTime(dateTime)

Arguments:

Property IDs:

A.29 query-database

This function returns a node-set by executing the SQL query against the specified database.

Signature:

orcl:query-database(sqlquery as string, rowset as boolean, row as boolean, datasource as string)

Arguments:

Property IDs:

A.30 right-trim

This function returns the value inputString after removing all the trailing white spaces.

Example:

orcl:right-trim(' account ') returns ' account'

Signature:

orcl:right-trim(inputString as string)

Arguments:

Property IDs:

A.31 seconds-from-dateTime

This function returns the second from dateTime. The default second is 0.

Signature:

xp20:seconds-from-dateTime(dateTime as string)

Arguments:

Property IDs:

A.32 sequence-next-val

Return the next value of an Oracle sequence.

The next value is obtained by executing

SELECT sequence.nextval FROM dual

against data source that can be either a JDBC connect string (jdbc:oracle:thin:username/password@host:port:sid) or a data source JNDI identifier. Only Oracle Thin Driver is supported if a JDBC connect string is used.

Example:

orcl:sequence-next-val('employee_id_sequence','jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')

Signature:

orcl:sequence-next-val(sequence as string, datasource as string)

Arguments:

Property IDs:

A.33 setOutboundHeader

This function sets an outbound message header value.

Signature:

ehdr:set-outbound-header(headerXPath, value, namespaceDeclarations)

Arguments:

Property IDs:

A.34 setResponseHeader

This function sets a response message header value.

Signature:

ehdr:set-response-header(headerXPath, value, namespaceDeclarations)

Arguments:

Property IDs:

A.35 square-root

This function returns the square root of inputNumber.

Example:

orcl:square-root(25) returns 5

Signature:

orcl:square-root(inputNumber as number)

Arguments:

Property IDs:

A.36 subtract-dayTimeDuration-from-dateTime

This function returns a new dateTime value after subtracting duration from dateTime.

If the duration value is negative, then the resultant dateTime value follows input-dateTime value.

Signature:

xp20:subtract-dayTimeDuration-from-dateTime(dateTime as string, duration as string)

Arguments:

Property IDs:

A.37 timezone-from-dateTime

This function returns the timezone from dateTime. The default timezone is GMT+00:00.

Signature:

xp20:timezone-from-dateTime(dateTime as string)

Arguments:

Property IDs:

A.38 upper-case

This function returns the value of inputString after translating every character to its upper-case correspondent.

Example:

xp20:upper-case('abCd0') returns 'ABCD0'

Signature:

xp20:upper-case(inputString as string)

Arguments:

Property IDs:

A.39 year-from-dateTime

This function returns the year from dateTime.

Signature:

xp20:year-from-dateTime(dateTime as string)

Arguments:

Property IDs: