Oracle® Enterprise Service Bus Developer's Guide 10g (10.1.3.3.0) Part Number E10295-01 |
|
|
View PDF |
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:
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:
dateTime as string
– The dateTime
to which the function adds the duration, in string format.
duration as string
– The duration to add to the dateTime
, or subtract if the duration is negative, in string format.
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
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:
variableName
– The source variable for the data
propertyName
– The qualified name (QName) of the property
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
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:
inputString as string
– The input string
CompareString as string – The string to compare against the input string
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
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:
nodeSet
– The node set to be converted into a deliminated string
delimiter
– The character that separates the items in the output string; for example, a comma or a semicolon.
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
This function returns the current date in ISO format YYYY-MM-DD
.
Signature:
xp20:current-date(object)
Arguments:
object
- The time in standard format
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
This function returns the current datetime-value in ISO format CCYY-MM-DDThh:mm:ssTZD
.
Signature:
xp20:current-dateTime(object)
Arguments:
object
– The time in standard format
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
This function returns the current time in ISO format. The format is hh:mm:ssTZD
.
Signature:
xp20:current-time(object)
Arguments:
object
– The time in standard format
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
This function returns the day from dateTime
. The default day is 1
.
Signature:
xp20:day-from-dateTime(object)
Arguments:
object
– The time in standard format
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
This function returns the content of an XML file.
Signature:
ora:doc('fileName','xpath'?)
Arguments:
fileName
– The name of the XML file
xpath
– path to the XML file
Property IDs:
namespace-uri
: http://schemas.oracle.com/xpath/extension
namespace-prefix
: ora
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:
inputString
– The string of data to be searched
searchString
– The string for which the function searches
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
This function returns the formatted string of dateTime
using the format provided.
Signature:
xp20:format-dateTime(dateTime as string, format as string)
Arguments:
dateTime
– The dateTime
to be formatted
format
– The format for the output
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
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:
string
– One of the strings to be used in the formatted output
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
This function generates a unique GUID.
Signature:
orcl:generate-guid()
Arguments:
none
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
This function returns the XML representation of the input element.
Signature:
orcl:get-content-as-string(element as node-set)
Arguments:
element as node-set
– The input element that the function returns as an XML representation
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
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:
resourceURL
– The URL of the resource
resourceLocation
– The subdirectory location of the resource
resourceBundleName
– The name of the zip file containing the resource bundle
language
– The language of the localized output
country
– The country of the localized output
variant
– The language variant of the localized output
messageKey
– The message key in the resource bundle
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
This function gets a string value from inbound response header.
Signature:
ehdr:getInboundResponseHeader(headerXPath, namespaceDeclarations)
Arguments:
headerXPath
is the xpath into the header document
namespaceDeclarations
used in the headerXPath as prefix=Namespace-URI
Property IDs:
http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.ESBHeaderFunctions
namespace-prefix
: ehdr
This function gets a string value from request message header.
Signature:
ehdr:getRequestHeader(headerXPath, namespaceDeclarations)
Arguments:
headerXPath
is the xpath into the header document
namespaceDeclarations
used in the headerXPath as prefix=Namespace-URI
Property IDs:
http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.ESBHeaderFunctions
namespace-prefix
: ehdr
This function returns the hour from dateTime
. The default hour is 0
.
Signature:
xp20:hours-from-dateTime(dateTime as string)
Arguments:
dateTime as string
– The dateTime
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
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:
object
– The time in standard format
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
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:
inputString
– The string to be searched
searchString – The string for which the function searches in the inputString
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
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:
inputString
– The string to be searched
searchString – The string for which the function searches in the inputString
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
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:
inputString
– The string to be left-trimmed
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
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:
dvmName
sourceColumnName
sourceValue
targetColumnName
defaultValue
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
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:
table
– The table from which to draw the data
inputColumn
– The column within the table
key
– The key
outputColumn
– The column to output the data
datasource
– The source of the data
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
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:
docURL
– The XML file
parentXPath
– The parent XPath
keyXPath
– The key XPath
lookupXPath
– The lookup XPath
key
– The key value
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
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:
inputString
– The input string
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
This function returns the minute from dateTime
. The default minute is 0
.
Signature:
xp20:minutes-from-dateTime(dateTime)
Arguments:
dateTime
– The dateTime
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
This function returns the month from dateTime
. The default month is 1
(January).
Signature:
xp20:month-from-dateTime(dateTime)
Arguments:
dateTime
– The dateTime
to be formatted
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
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:
sqlquery
– The SQL query to perform
rowset
– Indicates if the rows should be enclosed in a <rowset>
element
row
– Indicates if each row should be enclosed in a <row>
element
datasource
– Either a JDBC connect string (jdbc:oracle:thin:
username
/
password
@
host
:
port
:
sid
) or a JNDI name for the database
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
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:
inputString
– The input string to be right-trimmed
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
This function returns the second from dateTime
. The default second is 0
.
Signature:
xp20:seconds-from-dateTime(dateTime as string)
Arguments:
dateTime
– The dateTime
as a string
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
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:
sequence
– name of the sequence in the database
datasource
– a JDBC connect string or data source JNDI identifier
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
This function sets an outbound message header value.
Signature:
ehdr:set-outbound-header(headerXPath, value, namespaceDeclarations)
Arguments:
headerXPath
is the xpath into the outbound header document
value
is the value to set on outbound message header
namespaceDeclarations
used in the headerXPath as prefix=Namespace-URI
Property IDs:
http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.ESBHeaderFunctions
namespace-prefix
: ehdr
This function sets a response message header value.
Signature:
ehdr:set-response-header(headerXPath, value, namespaceDeclarations)
Arguments:
headerXPath
is the xpath into the response header document
value
is the value to set on response message header
namespaceDeclarations
used in the headerXPath as prefix=Namespace-URI
Property IDs:
http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.ESBHeaderFunctions
namespace-prefix
: ehdr
This function returns the square root of inputNumber
.
Example:
orcl:square-root(25)
returns 5
Signature:
orcl:square-root(inputNumber as number)
Arguments:
inputNumber
– The input number for which the function calculates the square root
Property IDs:
namespace-uri:
http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
namespace-prefix
: orcl
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:
dateTime as string
– The dateTime
from which the function subtracts the duration, in string format.
duration as string
– The duration to subtract to the dateTime
, or add if the duration is negative, in string format.
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
This function returns the timezone from dateTime
. The default timezone is GMT+00:00
.
Signature:
xp20:timezone-from-dateTime(dateTime as string)
Arguments:
dateTime as string
– The dateTime
for which this function returns a time zone
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20
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:
inputString
– The input string
Property IDs:
namespace-uri
: http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20
namespace-prefix
: xp20