Platform Event Reference

This chapter explains the platform extended functions.

1. Overview

This chapter describes an overview of the platform extended functions.

1.1. Features and Usage

Appended to the XPath functions on the platform running VC. Used to describe a condition to apply VC template rule, an attribute value template, etc., like as in the XPath functions.

1.2. Namespace URI Reference

The namespace URI reference for the platform extended function is http://xmlns.xfytec.com/function. In the descriptions below, we use function: as the namespace prefix to describe every platform extended function.

Also, we use the following namespaces and their prefixes in the descriptions below.

  • VC Core
    We use xvcd: as the namespace prefix. For more information, see the VC Core Reference.

2. Platform Extend Functions

This section explains the features, arguments, and return value of each platform extended function by its functionality. Types of argument and return value are represented with the types described in specifications on XPath functions.

2.1. Input/Output Functions

The input/output functions are listed below.

function:base-name Function

Returns file name which excludes extension of the specified file by URL.

Syntax:
string function:base-name( url )
Argument:
string url

Specify the encoded URL of file name without extension you want to get.

Return value:
string

function:base-name() function returns file name without extension. The file name should be URL encoded.

If the file represented by the URL that is specified with the argument does not have an extension, the file name is returned. If the URL that is specified with the argument is a directory, the directory name is returned.

function:document Function

loads the specified document and returns it as a node set. The loading of a document is executed asynchronously.

Use function:synchronous-document() function if you want to load a document synchronously.

Syntax:
node-set function:document( url, reserved?, mimeType? )
Argument:
string url

Specify encoded URL for document to load.

string reserved

Now, unavailable. Reserved for possible compatibility with future XSLT document() function.

Optional, if you don't specify mimeType argument.

string mimeType

Specify the MIME type of the loading document. If this argument is specified, the document is forcibly loaded in specified MIME type. To specify this argument, you need to specify reserved.

If omitted, the document is loaded according to the MIME type specified to the document.

Return value:
node-set

The function returns the read document as a node set. If a return value is taken during loading a document, a null node set will be returned.

function:document-uri Function

Returns the URL of the specified node.

Syntax:
string function:document-uri( node-expression? )
Argument:
node-set node-expression

Specify the node whose URL you want to get.

If omitted, a context node is assumed to be specified.

Return value:
string

The function returns the encoded URL of the specified node. If an argument is not specified, the URL of the context node will be returned. If the specified node does not have a URL, a null string will be returned.

function:file-extension Function

Returns the extension of the file specified by URL.

Syntax:
string function:file-extension( url, option? )
Argument:
string url

Specify the encoded URL of extension you want to get.

boolean option

Using a true/false value, specify whether a period ( . ) is added to the extension you want to get. If true is specified, an extension with a period is returned. If false is specified, an extension without a period is returned.

If omitted, true is assumed to be specified.

Return value:
string

Returns a file extension.

function:file-name Function

Returns file name which includes the extension of the specified file by URL.

Syntax:
string function:file-name( url? )
Argument:
string url

Specify the encoded URL of file name you want to get.

If omitted, the file name of the document currently being edited is returned.

Return value:
string

function:base-name() function returns file name including extension. The file name should be URL encoded. If an argument is omitted and document being edited is not saved as a new document, a null string is returned.

function:generate-url Function

Generates an absolute URL from a reference URL and a relative path to a file.

Syntax:
string function:generate-url( baseUrl?, relativePath )
Argument:
string baseUrl

Specify the absolute URL for the reference URL of the URL to generate. Specify it by encoded URL.

If omitted, the URL of the document node including the context node is used.

string relativePath

Specify the file URL relative to reference URL. Specify it by encoded URL.

Return value:
string

Returns an absolute URL to a file. The URL is encoded.

function:mime-type Function

Returns the MIME type of a file.

Syntax:
string function:mime-type( url )
Argument:
string url

Specify the encoded URL of MIME type you want to get.

Return value:
string

Returns a MIME type string specified in url.

function:parent-directory Function

Returns the URL of the parent directory of the file specified by URL.

Syntax:
string function:parent-directory( url, option? )
Argument:
string url

Specify the encoded URL of parent directory you want to get.

boolean option

Using a true/false value, specify whether /(slash) is added to the end of the URL of the directory returned by this function. If true is specified, a URL with a slash is returned. If false is specified, a URL without a slash is returned.

If omitted, true is assumed to be specified.

Return value:
string

Returns the encoded URL of the parent directory of the file specified by url.

function:relative-url Function

Compares the reference URL represented by an absolute URL and another absolute URL, and returns the URL relative to reference URL.

Syntax:
string function:relative-url( baseUrl, url )
Argument:
string baseUrl

Specify the absolute URL to which the URL is relative. Specify it by encoded URL.

string url

Specify the absolute URL which you want to make relative to the reference URL. Specify it by encoded URL.

Return value:
string

Returns the relative URL to url which baseUrl is the reference. If relative URL cannot be converted to because of a different URL scheme, etc. or because URL may be specified incorrectly, a null string will be returned.

function:resource-exist Function

Checks whether the resource specified by URL exists.

Syntax:
boolean function:resource-exist( url )
Argument:
string url

Specify the absolute URL to the resource whose existence you want to check. Specify it by encoded URL.

Return value:
boolean

Returns whether the resource specified by url exists using a true/false value. If true is returned, the resource specified by URL exists. If false is returned, the specified resource does not exist.

function:synchronous-document Function

loads the specified document and returns it as a node set. The loading of a document is executed synchronously.

If the loading does need synchronizing, function:document() function is available.

Syntax:
node-set function:synchronous-document( url, reserved?, mimeType? )
Argument:
string url

Specify encoded URL for document to load.

string reserved

Reserved for possible compatibility with future XSLT document() function. Now, unavailable.

Optional, if you don't specify mimeType argument.

string mimeType

Specify the MIME type of the loading document. If this argument is specified, the document is forcibly loaded in specified MIME type. To specify this argument, you need to specify reserved.

If omitted, the document is loaded according to the MIME type specified to the document.

Return value:
node-set

The function returns the read document as a node set. Unlike the function:document() function, the loading is completed when function exits. If an error occurs during loading, a null node set will be returned.

function:url-decode Function

Converts the URL string with escape characters (for example: %20) in % hh format (h is a-f, A-F, 0-9) to URL string without escape characters. The text conversion is done based on UTF-8 coding scheme.

Syntax:
string function:url-decode( url )
Argument:
string url

Specify the URL string that may contain an escape character.

Return value:
string

Returns the URL string without escape characters.

function:url-encode Function

Converts the URL that may contain characters, such as whitespace characters, which need to be converted to escape characters to the URL string (encoded URL) which contains them converted to escape characters. The text conversion is done based on UTF-8 coding scheme.

The characters to be converted to escape characters are all characters except the following:

  • Alphabet (a-z, A-Z)
  • Numbers(0-9)
  • Characters included in the string specified by the second argument

If the second argument is omitted, the URL will be converted according to the following rules:

  • Alphabet (a-z, A-Z)and numbers (0-9) are not converted.
  • URL delimiter and symbols available for URL (-_.*/:;!?$#&+=~@[]) are not converted.
  • '%' is treated as follows:
    • Not converted if already encoded (for example: %20) and in % hh format (h is either a-f, A-F, or 0-9).
    • It is otherwise converted to %25.
  • Characters other than those described above are converted based on the UTF-8 coding scheme.
Syntax:
string function:url-encode( url, char? )
Argument:
string url

Specify the URL string that may contain characters which need to be converted to escape characters.

string char

Specify characters not converted to escape characters.

If omitted, the specification mentioned above determines.

Return value:
string

Returns the URL string in which required characters are converted to escape characters.

2.2. Number Functions

The numeric functions are listed below.

function:abs Function

Returns an absolute value.

Syntax:
number function:abs( number )
Argument:
number number

Specify the real number of the numeric whose absolute value you want.

Return value:
number

Returns an absolute value of the numeric value specified by the argument.

function:acos Function

Returns an arccosine.

Syntax:
number function:acos( number )
Argument:
number number

Specify the numeric expressed by a real number which is greater than or equal to -1 and less than or equal to 1.

Return value:
number

Returns arccosine angle in radians derived from the argument numeric. If an argument value is not a real number greater than or equal to -1 and less than or equal to 1, positive infinity (Infinity) or negative infinity (-Infinity) defined in XPath is returned.

function:acosh Function

Returns a hyperbolic arccosine.

Syntax:
number function:acosh( number )
Argument:
number number

This can be a real number value greater than 1.

Return value:
number

Returns a hyperbolic arccosine value derived from the argument numeric. If the argument value is a real number less than 1, NaN (Not a Number) defined in XPath is returned.

function:asin Function

Returns an arcsine.

Syntax:
number function:asin( number )
Argument:
number number

Specify the numeric expressed by a real number which is greater than or equal to -1 and less than or equal to 1.

Return value:
number

Returns arcsine angle value in radians derived from the argument numeric. If an argument value is not a real number greater than or equal to -1 and less than or equal to 1, positive infinity (Infinity) or negative infinity (-Infinity) defined in XPath is returned.

function:asinh Function

Returns a hyperbolic arcsine.

Syntax:
number function:asinh( number )
Argument:
number number

It can be a real number.

Return value:
number

Returns a hyperbolic arcsine value derived from the argument numeric.

function:atan Function

Returns an arctangent.

Syntax:
number function:atan( number )
Argument:
number number

It can be a real number.

Return value:
number

Returns the arctangent value derived from the argument numeric. An arctangent value can be an angle value in radians greater than or equal to -pi/2 and less than or equal to pi/2. If the argument is 0, NaN (Not a Number) defined in XPath is returned.

function:atan2 Function

Returns the arctangent derived from the difference between two coordinate values.

Syntax:
number function:atan2( number1, number2 )
Argument:
number number1

Specifies the real number for the first coordinate value.

number number2

Specifies the real number for the second coordinate value.

Return value:
number

Returns the arctangent derived from the difference between coordinate1 and coordinate2. An arctangent value can be an angle value in radians greater than or equal to -pi/2 and less than or equal to pi/2. If the difference between coordinate1 and coordinate2 is 0, NaN (Not a Number) defined in XPath is returned.

function:atanh Function

Returns a hyperbolic arctangent.

Syntax:
number function:atanh( number )
Argument:
number number

Specify the numeric expressed by a real number which is greater than or equal to -1 and less than or equal to 1.

Return value:
number

Returns the hyperbolic arctangent value derived from the argument numeric. If an argument value is not a real number greater than or equal to -1 and less than or equal to 1, positive infinity (Infinity) or negative infinity (-Infinity) defined in XPath is returned.

function:cos Function

Returns a cosine.

Syntax:
number function:cos( number )
Argument:
number number

Specify the angle in radians.

Return value:
number

Returns the cosine value derived from the angle specified by the argument.

function:cosh Function

Returns a hyperbolic cosine.

Syntax:
number function:cosh( number )
Argument:
number number

It can be a real number.

Return value:
number

Returns a hyperbolic cosine value derived from the argument numeric.

function:degrees Function

Converts the angle in radians to the angle in degrees.

Syntax:
number function:degrees( radian )
Argument:
number radian

Specify the angle in radians.

Return value:
number

Returns the angle value in degrees converted from specified value in radians.

function:even Function

Returns a minimum even integer greater than or equal to the specified number.

Syntax:
number function:even( number )
Argument:
number number

Specify any real number.

Return value:
number

Returns a minimum even integer, with original sign appended to it, greater than or equal to the absolute value of the specified number.

function:exp Function

Returns the power of the base of natural logarithm.

Syntax:
number function:exp( number )
Argument:
number number

Specify any real number.

Return value:
number

Returns the base of natural logarithm e raised to the power of the power number.

function:fact Function

Returns a factorial value.

Syntax:
number function:fact( number )
Argument:
number number

Specify any real number.

Return value:
number

Returns the factorial value derived from the integer to which the specified argument is rounded down. If the specified number in the argument is greater than 170, NaN (Not a Number) defined in XPath is returned.

function:fact-double Function

Returns a double factorial value.

Syntax:
number function:fact-double( number )
Argument:
number number

Specify any real number.

Return value:
number

Returns the factorial value derived from the integer to which the specified argument is rounded down. If the specified number in the argument is greater than 300, NaN (Not a Number) defined in XPath is returned.

function:int Function

Returns the integer part of a real number rounded toward zero.

Syntax:
integer function:int( number )
Argument:
number number

Specify any real number.

Return value:
integer

Returns the integer to which the specified argument is rounded down.

function:is-nan Function

Returns whether the specified value is NaN(Not a Number) or not.

Syntax:
boolean function:is-nan( number )
Argument:
number number

It can be any number.

Return value:
boolean

Returns whether the specified argument is NaN(Not a Number) or not by using a true/false value. Returns true if the argument is NaN. Otherwise , false is returned.

function:ln Function

Returns a natural logarithm.

Syntax:
number function:ln( number )
Argument:
number number

Specify any positive real number.

Return value:
number

Returns a natural logarithm value of the value specified by the argument. If the argument is inappropriate, the following value is returned respectively:

If the argument is NaN (Not a Number) or a negative number,
NaN is returned.
If the argument is positive infinity,
positive infinity (Infinity) is returned.
If the argument is 0,
negative infinity (-Infinity) is returned.

NaN (Not a Number), positive infinity (Infinity), and negative infinity (-Infinity) are special values defined in XPath.

function:log Function

Returns a logarithm to the specified base.

Syntax:
number function:log( number1, number2? )
Argument:
number number1

Specify any real number to compute a logarithm.

number number2

Specify the number for the base of logarithm. For the number, specify a positive real number other than 1.

If omitted, 10 is assumed to be specified.

Return value:
number

Returns the logarithm value of number1 with the base specified by number2. If either number1 or number2 is inappropriate, NaN (Not a Number) defined in XPath is returned.

function:log10 Function

Returns a common logarithm.

Syntax:
number function:log10( number )
Argument:
number number

Set any positive real number.

Return value:
number

Returns a common logarithm value of the value specified by the argument. If the argument is inappropriate, the following value is returned respectively:

If the argument is NaN (Not a Number) or a negative number,
NaN is returned.
If the argument is positive infinity,
positive infinity (Infinity) is returned.
If the argument is 0,
negative infinity (-Infinity) is returned.

NaN (Not a Number), positive infinity (Infinity), and negative infinity (-Infinity) are special values defined in XPath.

function:long-subtract Function

Returns the difference between the specified integer strings.

Syntax:
string function:long-subtract( string1, string2 )
Argument:
string string1

Specify the string for the subtracted integer.

string string2

Specify the string for the subtracting integer.

Return value:
string

Returns the result in integer string of subtracting integer string2 from integer string1. If the argument is not an integer string, an error occurs.

function:odd Function

Returns a minimum odd integer greater than or equal to the specified number.

Syntax:
number function:odd( number )
Argument:
number number

Specify any real number.

Return value:
number

Returns a minimum odd integer, with original sign appended to it, greater than or equal to the absolute value of the specified number.

function:pi Function

Returns the pi in number.

Syntax:
number function:pi( )
Argument:

No argument.

Return value:
number

Returns the pi value in number (3.1415926535898).

function:power Function

Returns the power value.

Syntax:
number function:power( number1, number2 )
Argument:
number number1

Specify any real number for the base of the power.

number number2

Specify any real number for the number of the power.

Return value:
number

Returns the base number of the power calculation raised to the power of the power number. If both arguments are 0, NaN (Not a Number) defined in XPath is returned.

function:product Function

Returns the product of numbers included in the specified node set.

Syntax:
number function:product( node-set )
Argument:
node-set node-set

Specify the node set to calculate the product.

Return value:
number

Returns the product within a node set. For example, returns 162 if the product within a node set is 3, 6, 9. If there exists a node within the node set which cannot be converted to a number, NaN(Not a Number) will be returned.

function:radians Function

Converts the angle in degrees to the value in radians.

Syntax:
number function:radians( angle )
Argument:
number angle

Sets the angle in degrees.

Return value:
number

Returns the value in radians converted from specified angle value in degrees.

function:rand Function

Returns a random number.

Syntax:
number function:rand( )
Argument:

No argument.

Return value:
number

Returns a random value greater than or equal to 0 and less than or equal to 1.

function:rand-between Function

Returns the random number within the specified range.

Syntax:
number function:rand-between( min, max )
Argument:
number min

Specify the lower limit integer of int type for the random numbers' range.

number max

Specify the upper limit integer of int type for the random numbers' range.

Return value:
number

Returns a random number greater than or equal to the beginning of the range (min) and less than or equal to the ending of the range (max). If the beginning value of the range is less than the ending value of the range, or if the argument is not an integer of int type, NaN (Not a Number) defined in XPath is returned.

function:sin Function

Returns a sine.

Syntax:
number function:sin( number )
Argument:
number number

Specify the angle in radians.

Return value:
number

Returns the sine value derived from the angle specified by the argument.

function:sinh Function

Returns a hyperbolic sine.

Syntax:
number function:sinh( number )
Argument:
number number

It can be a real number.

Return value:
number

Returns a hyperbolic value derived from the argument numeric.

function:sqrt Function

Returns a square root.

Syntax:
number function:sqrt( number )
Argument:
number number

It can be any number.

Return value:
number

Returns the square root derived from the argument number. If the argument is inappropriate, the following value is returned respectively:

If the argument is NaN (Not a Number) or a negative number,
NaN is returned.
If the argument is positive infinity,
positive infinity (Infinity) is returned.
If the argument is 0,
0 is returned.

NaN (Not a Number), positive infinity (Infinity), and negative infinity (-Infinity) are special values defined in XPath.

function:tan Function

Returns a tangent.

Syntax:
number function:tan( number )
Argument:
number number

Specify the angle in radians.

Return value:
number

Returns the tangent value derived from the angle specified by the argument. If the argument is either -pi/2 or pi/2, NaN (Not a Number) defined in XPath is returned.

function:tanh Function

Returns a hyperbolic tangent.

Syntax:
number function:tanh( number )
Argument:
number number

It can be a real number.

Return value:
number

Returns the hyperbolic tangent value derived from the argument numeric.

2.3. Statistics Functions

The statistics functions are listed below.

function:average Function

Returns the mathematical average value of the numeric value converted from the string included in each node within the node set.

Syntax:
number function:average( node-set )
Argument:
node-set node-set

Specify the node set to calculate the average value.

Return value:
number

Returns the average value of the numeric value converted from the string included in each node within the node set. If there exists a node within the node set which cannot be converted to a number, NaN (Not a Number) defined in XPath will be returned.

function:max Function

Returns the maximum value of the numeric value converted from the string included in each node within the node set.

Syntax:
number function:max( node-set )
Argument:
node-set node-set

Specify the node set to calculate the maximum value.

Return value:
number

Returns the maximum value of the numeric value converted from the string included in each node within the node set. If there exists a node within the node set which cannot be converted to a number, NaN (Not a Number) defined in XPath will be returned.

function:min Function

Returns the minimum value of the numeric value converted from the string included in each node within the node set.

Syntax:
number function:min( node-set )
Argument:
node-set node-set

Specify the node set to calculate the minimum value.

Return value:
number

Returns the minimum value of the numeric value converted from the string included in each node within the node set. If there exists a node within the node set which cannot be converted to a number, NaN (Not a Number) defined in XPath will be returned.

2.4. Date Functions

The date functions are listed below.

function:add-day Function

Returns the string which represents the integer string representing UTC time plus some number of days.

Syntax:
string function:add-day( utc, days )
Argument:
string utc

Specify the integer string representing UTC time.

string days

Specify the number of days to add.

Return value:
string

Returns the integer string in UTC time which represents the original time plus the number of specified days.

function:add-month Function

Returns the string which represents the integer string representing UTC time plus some number of months.

Syntax:
string function:add-month( utc, months )
Argument:
string utc

Specify the integer string representing UTC time.

string months

Specify the number of months to add.

Return value:
string

Returns the integer string in UTC time which represents the original time plus the number of specified months.

function:add-year Function

Returns the string which represents the integer string representing UTC time plus some number of years.

Syntax:
string function:add-year( utc, years )
Argument:
string utc

Specify the integer string representing UTC time.

string years

Specify the number of years to add.

Return value:
string

Returns the integer string in UTC time which represents the original time plus the number of specified years.

function:current-time-millis Function

Returns the current time in milliseconds.

Syntax:
number function:current-time-millis( )
Argument:

No argument.

Return value:
number

Returns UTC time from A.M. 0:00, January 1, 1970 to the current time in milliseconds.

function:date-value Function

Converts the specified date string to the integer string representing UTC time and returns it.

Syntax:
string function:date-value( date-string, format )
Argument:
string date-string

Specify the date string created in accordance with the date format of the second argument.

string format

Specify the date format used in the date string of the first argument. The date format conforms to Java's java.text.SimpleDateFormat.

Return value:
string

Analyzes the date string specified by date-string using the date format specified by format, and converts it to the integer string representing UTC time and returns it.

function:days-of-month Function

Returns the number of days of the month specified by the month and year.

Syntax:
number function:days-of-month( year, month )
Argument:
number year

Specify the year.

number month

Specify a number from 1 to 12 for the month.

Return value:
number

Returns the number of days of the month specified by the month and year.

function:format-datetime Function

Converts the integer string representing UTC time to the date string in the specified date format and returns it.

Syntax:
string function:format-datetime( utc, format )
Argument:
string utc

Specify the integer string representing UTC time.

string format

Specify the date format of the date string to convert. The date format conforms to Java's java.text.SimpleDateFormat.

Return value:
string

Converts the UTC time specified by the integer string utc to the date string using the date format specified by format and returns it.

function:now Function

Returns the current date string.

Syntax:
string function:now( format )
Argument:
string format

Set the string specifying a date format. The date format conforms to Java's java.text.SimpleDateFormat.

Return value:
string

Returns the date string conforming to the specified format.

function:weekday Function

Returns the day of the week specified by the date.

Syntax:
number function:weekday( year, month, day )
Argument:
number year

Specify the year of the date.

number month

Specify a number from 1 to 12 for the month of the date.

number day

Specify a number from 1 to the number of the last day of the month for the day of the date.

Return value:
number

Returns the day of the week of the specified date using the following value:

1 Sunday
2 Monday
3 Tuesday
4 Wednesday
5 Thursday
6 Friday
7 Saturday

2.5. String Manipulation Functions

The string manipulation functions are listed below.

function:ends-with Function

Checks whether a string ends in some combination of characters.

Syntax:
boolean function:ends-with( string1, string2 )
Argument:
string string1

Specify the string to check.

string string2

Specify the string for the combination of characters to check.

Return value:
boolean

Using a true/false value, returns whether string1 ends in the combination of characters specified by string2. If string1 ends the combination of characters specified by string2, true is returned. Otherwise, false is returned.

function:format-message Function

Provides subset of Java MessageFormat class features.

Syntax:
string function:format-message( pattern, arguments... )
Argument:
string pattern

Specify message format pattern string. The format conforms to Java's java.text.MessageFormat specification.

However, format type and format style settings are not supported. Use format-datetime function for date format, function:format-number function for numerical format respectively.

string arguments...

Specify the string to insert into format elements described in the pattern.

The number of arguments is variable. Each value of arguments is evaluated as a string, and is replaced by corresponding format elements described in the pattern.

function:format-message('A{2}{1}{0}E', 'D', 'C', 'B')
=> Vowels

The number of format elements in the pattern and the number of string specified by arguments should match.

Return value:
string

Each value of arguments is evaluated as a string, and returns a string replaced by corresponding format elements described in the pattern.

function:format-number Function

Formats values according to the specified format, and then returns it as a string.

Syntax:
string function:format-number( number, format )
Argument:
number number

Specify the number for the base of formatting.

string format

String specifying the format The format conforms to Java's java.text.DecimalFormat.

Return value:
string

Returns the formatted numeric string.

function:generate-id Function

Assigns ID automatically to the node specified by the argument.

Syntax:
string function:generate-id( node-expression? )
Argument:
node-set node-expression

It can be any node.

If omitted, returns the ID of the context node.

Return value:
string

Returns the ID string assigned to the node specified by the argument.

function:lower Function

Converts all alphabetic letters within a string to lowercase letters.

Syntax:
string function:lower( string )
Argument:
string string

This can be any string.

Return value:
string

Converts all alphabetic letters within the string specified by the argument to lowercase letters and returns the string. Letters other than alphabetic letters will not be changed. If the letter is a single-byte alphabetic letter, it is converted to a single-byte lowercase alphabetic letter. If the letter is also a double-byte alphabetic letter, it is converted to a double-byte lowercase alphabetic letter.

function:regexp-match Function

Checks whether a string contains the part conforming to the pattern specified by regular expression.

Syntax:
boolean function:regexp-match( string, pattern )
Argument:
string string

Specify the string to check.

string pattern

Specify the string for regular expression pattern.

Return value:
boolean

Using a true/false value, returns whether string contains the part conforming to the pattern specified by string2. true is returned, if string contains the part conforming to the pattern specified by pattern. Otherwise, false is returned.

function:substring-before-last Function

Returns the sub-strings from some string to the string before the last appeared delimiter.

Syntax:
string function:substring-before-last( string, delimiter )
Argument:
string string

Specify the string from which sub-strings are retrieved.

string delimiter

Specify the delimiter string.

Return value:
string

delimiter returns string's sub-strings before the last appeared delimiter string specified. When retrieving sub-strings from string, only the string part which exactly matches delimiter is treated as the delimiter string. If string's part that exactly matches the delimiter string does not exists, a null string will be returned.

function:substring-after-last Function

Returns the sub-strings from some string to the string after the last appeared delimiter.

Syntax:
string function:substring-after-last( string, delimiter )
Argument:
string string

Specify the string from which sub-strings are retrieved.

string delimiter

Specify the delimiter string.

Return value:
string

delimiter returns string's sub-strings after the last appeared delimiter string specified. When retrieving sub-strings from string, only the string part which exactly matches delimiter is treated as the delimiter string. If string's part that exactly matches the delimiter string does not exists, a null string will be returned.

function:upper Function

Converts all alphabetic letters within a string to capital letters.

Syntax:
string function:upper( string )
Argument:
string string

This can be any string.

Return value:
string

Converts all alphabetic letters within the string specified by the argument to capital letters and returns the string. Letters other than alphabetic letters will not be changed. If the letter is a single-byte alphabetic letter, it is converted to a single-byte capital alphabetic letter. If the letter is also a double-byte alphabetic letter, it is converted to a double-byte capital alphabetic letter.

2.6. Logical Functions

The logical functions are listed below.

function:if Function

Evaluates the specified condition and returns one of the two nodes according to the result's true/false value.

Syntax:
node-set function:if( condition, node-expression1, node-expression2 )
Argument:
boolean condition

Specify the condition to evaluate. The condition evaluates to a true/false value.

node-set node-expression1

Specify the node to return when the condition specified in the first argument evaluates to true.

node-set node-expression2

Specify the node to return when the condition specified in the first argument evaluates to false.

Return value:
node-set

Returns a node according to condition's evaluation. If the result of condition evaluation is true, node-expression1 will be returned. If the condition evaluates to false, the node specified by node-expression2 is returned.

2.7. Tool Functions

The tool functions are listed below.

function:current Function

Returns the current node as a node set. That is, it returns the context node at the beginning of evaluation to XPath expression.

Syntax:
node-set function:current( )
Argument:

No argument.

Return value:
node-set

Returns the current node as a node set.

function:declare-namespace Function

Returns the list of the namespace declared by the specified node.

Syntax:
node-set function:declare-namespace( node-expression? )
Argument:
node-set node-expression

Specifies the nodes you want to get the list of the declared namespace node.

If omitted, a context node is assumed to be specified.

Return value:
node-set

Returns the list of the namespace node declared by the specified node.

function:document-property Function

Retrieves the property's value.

Syntax:
string function:document-property( key, node-expression? )
Argument:
string key

Specify the key name of document property. Specify one of the following key names:

overwrite
Indicates using a true/false value whether a document can be saved into the same document. If it can, true is specified, but if it cannot, false is specified.
encode
Represents the character encoding for the document.
file name
Indicates URL file name of document (URL absolute path without host name and scheme from, etc.).
load url
Indicates the encoded URL for loading a document file. The same value as function:document-uri() function is returned.
mime type
Indicates the mime type of a document file.
save url
Indicates the encoded URL to which the document file is saved. According to the content of XVCD, the saving URL may differ from the loaded URL. Null string will be returned until the document file is saved.
node-set node-expression

Specify the node within a document. It can be a document node.

If omitted, a context node is assumed to be specified.

Return value:
string

If the system property specified by a key name does not exist, a null string will be returned.

function:is-dirty Function

Evaluates whether the document is edited or not.

Syntax:
boolean function:is-dirty( node-expression? )
Argument:
node-set node-expression

Specify the node within the document for checking whether it is edited or not.

A context node is assumed to be specified.

Return value:
boolean

Returns whether the document is edited or not. It can be true if the document is edited, or false if not.

function:media-type Function

Returns the media type to which the current canvas outputs.

Syntax:
string function:media-type( )
Argument:

No argument.

Return value:
string

Returns the media type to which the current canvas outputs. Returns the following media type.

screen
The media type for a normal display.
print
The media type for print or print preview.

function:message Function

Evaluates Xpath expression given by the argument and outputs the result. Used for development and debugging.

Syntax:
node-set function:message( node-expression )
Argument:
node-set node-expression

Specify the XPath expression to evaluate.

Return value:
node-set

Returns the evaluated node set.

function:system-property Function

Retrieves the property's value.

Syntax:
string function:system-property( key )
Argument:
string key

Specify the key name of system property.

Return value:
string

Returns the system property's value corresponding to the key name specified by an argument. If the system property specified by a key name does not exist, a null string will be returned.