Loading TOC...

fn functions

The table below lists all the fn built-in functions (in this namespace: http://www.w3.org/2005/xpath-functions).

You can also view these functions broken down by category:

147 functions
Function name Description
fn:abs Returns the absolute value of $arg.
fn:adjust-date-to-timezone Adjusts an xs:date value to a specific timezone, or to no timezone at all.
fn:adjust-dateTime-to-timezone Adjusts an xs:dateTime value to a specific timezone, or to no timezone at all.
fn:adjust-time-to-timezone Adjusts an xs:time value to a specific timezone, or to no timezone at all.
fn:analyze-string The result of the function is a new element node whose string value is the original string, but which contains markup to show which parts of the input match the regular expression.
fn:avg Returns the average of the values in the input sequence $arg, that is, the sum of the values divided by the number of values.
fn:base-uri Returns the value of the base-uri property for the specified node.
fn:boolean Computes the effective boolean value of the sequence $arg.
fn:ceiling Returns the smallest (closest to negative infinity) number with no fractional part that is not less than the value of $arg.
fn:codepoint-equal Returns true if the specified parameters are the same Unicode code point, otherwise returns false.
fn:codepoints-to-string Creates an xs:string from a sequence of Unicode code points.
fn:collection Returns all of the documents that belong to the specified collection(s).
fn:compare Returns -1, 0, or 1, depending on whether the value of the $comparand1 is respectively less than, equal to, or greater than the value of $comparand2, according to the rules of the collation that is used.
fn:concat Returns the xs:string that is the concatenation of the values of the specified parameters.
fn:contains Returns true if the first parameter contains the string from the second parameter, otherwise returns false.
fn:count Returns the number of items in the value of $arg.
fn:current Returns the item that was the context item at the point where the expression was invoked from the XSLT stylesheet.
fn:current-date Returns xs:date(fn:current-dateTime()).
fn:current-dateTime Returns the current dateTime value (with timezone) from the dynamic context.
fn:current-group Returns the current regex group.
fn:current-grouping-key Returns the current regex grouping key.
fn:current-time Returns xs:time(fn:current-dateTime()).
fn:data Takes a sequence of items and returns a sequence of atomic values.
fn:day-from-date Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $arg.
fn:day-from-dateTime Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $arg.
fn:days-from-duration Returns an xs:integer representing the days component in the canonical lexical representation of the value of $arg.
fn:deep-equal This function assesses whether two sequences are deep-equal to each other.
fn:default-collation Returns the value of the default collation property from the static context.
fn:distinct-nodes [0.9-ml only] Returns the sequence resulting from removing from the input sequence all but one of a set of nodes that have the same identity as one another.
fn:distinct-values Returns the sequence that results from removing from $arg all but one of a set of values that are eq to one other.
fn:doc Returns the document(s) stored in the database at the specified URI(s).
fn:doc-available If fn:doc($uri) returns a document node, this function returns true.
fn:document Returns the document(s) stored in the database at the specified URI(s).
fn:document-uri Returns the value of the document-uri property for the specified node.
fn:element-available Returns true if and only if the name of an XSLT instruction is passed in.
fn:empty If the value of $arg is the empty sequence, the function returns true; otherwise, the function returns false.
fn:encode-for-uri Invertible function that escapes characters required to be escaped inside path segments of URIs.
fn:ends-with Returns true if the first parameter ends with the string from the second parameter, otherwise returns false.
fn:error [1.0 and 1.0-ml only, 0.9-ml has a different signature] Throw the given error.
fn:escape-html-uri %-escapes everything except printable ASCII characters.
fn:escape-uri This is a May 2003 function, and is only available in compatibility mode (XQuery 0.9-ML)--it has been replaced with fn:encode-for-uri, fn:iri-to-uri, and fn:escape-html-uri.
fn:exactly-one Returns $arg if it contains exactly one item.
fn:exists If the value of $arg is not the empty sequence, the function returns true; otherwise, the function returns false.
fn:expanded-QName [0.9-ml only, use fn:QName instead] Returns an xs:QName with the namespace URI given in $paramURI and the local name in $paramLocal.
fn:false Returns the xs:boolean value false.
fn:filter Returns those items from the sequence $seq for which the supplied function $function returns true.
fn:floor Returns the largest (closest to positive infinity) number with no fractional part that is not greater than the value of $arg.
fn:fold-left Processes the supplied sequence from left to right, applying the supplied function repeatedly to each item in turn, together with an accumulated result value.
fn:fold-right Processes the supplied sequence from right to left, applying the supplied function repeatedly to each item in turn, together with an accumulated result value.
fn:format-date Returns a formatted date value based on the picture argument.
fn:format-dateTime Returns a formatted dateTime value based on the picture argument.
fn:format-number Returns a formatted string representation of value argument based on the supplied picture.
fn:format-time Returns a formatted time value based on the picture argument.
fn:function-arity Returns the arity of the function(s) that the argument refers to.
fn:function-available Returns true if and only if there is an XQuery or XSLT function whose name and optionally arity matches the value of the $function-name and the optional $arity arguments.
fn:function-lookup Returns a function with the given name and arity, or the empty sequence if none exists.
fn:function-name Returns the QName of the function(s) that the argument refers to.
fn:generate-id Returns a string that uniquely identifies a given node.
fn:head Returns the first item in a sequence.
fn:hours-from-dateTime Returns an xs:integer between 0 and 23, both inclusive, representing the hours component in the localized value of $arg.
fn:hours-from-duration Returns an xs:integer representing the hours component in the canonical lexical representation of the value of $arg.
fn:hours-from-time Returns an xs:integer between 0 and 23, both inclusive, representing the value of the hours component in the localized value of $arg.
fn:id Returns the sequence of element nodes that have an ID value matching the value of one or more of the IDREF values supplied in $arg.
fn:idref Returns the sequence of element or attribute nodes that have an IDREF value matching the value of one or more of the ID values supplied in $arg.
fn:implicit-timezone Returns the value of the implicit timezone property from the dynamic context.
fn:in-scope-prefixes Returns the prefixes of the in-scope namespaces for $element.
fn:index-of Returns a sequence of positive integers giving the positions within the sequence $seqParam of items that are equal to $srchParam.
fn:insert-before Returns a new sequence constructed from the value of $target with the value of $inserts inserted at the position specified by the value of $position.
fn:iri-to-uri Idempotent function that escapes non-URI characters.
fn:key The key function does for keys what the id function does for IDs.
fn:lang This function tests whether the language of $node, or the context node if the second argument is omitted, as specified by xml:lang attributes is the same as, or is a sublanguage of, the language specified by $testlang.
fn:last Returns the context size from the dynamic context.
fn:local-name Returns the local part of the name of $arg as an xs:string that will either be the zero-length string or will have the lexical form of an xs:NCName.
fn:local-name-from-QName Returns an xs:NCName representing the local part of $arg.
fn:lower-case Returns the specified string converting all of the characters to lower-case characters.
fn:map Applies the function item $function to every item from the sequence $seq in turn, returning the concatenation of the resulting sequences in order.
fn:map-pairs Applies the function item $function to successive pairs of items taken one from $seq1 and one from $seq2, returning the concatenation of the resulting sequences in order.
fn:matches Returns true if the specified $input matches the specified $pattern, otherwise returns false.
fn:max Selects an item from the input sequence $arg whose value is greater than or equal to the value of every other item in the input sequence.
fn:min Selects an item from the input sequence $arg whose value is less than or equal to the value of every other item in the input sequence.
fn:minutes-from-dateTime Returns an xs:integer value between 0 and 59, both inclusive, representing the minute component in the localized value of $arg.
fn:minutes-from-duration Returns an xs:integer representing the minutes component in the canonical lexical representation of the value of $arg.
fn:minutes-from-time Returns an xs:integer value between 0 to 59, both inclusive, representing the value of the minutes component in the localized value of $arg.
fn:month-from-date Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $arg.
fn:month-from-dateTime Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $arg.
fn:months-from-duration Returns an xs:integer representing the months component in the canonical lexical representation of the value of $arg.
fn:name Returns the name of a node, as an xs:string that is either the zero-length string, or has the lexical form of an xs:QName.
fn:namespace-uri Returns the namespace URI of the xs:QName of the node specified by $arg.
fn:namespace-uri-for-prefix Returns the namespace URI of one of the in-scope namespaces for $element, identified by its namespace prefix.
fn:namespace-uri-from-QName Returns the namespace URI for $arg as an xs:string.
fn:nilled Summary: Returns an xs:boolean indicating whether the argument node is "nilled".
fn:node-kind [0.9-ml only, use xdmp:node-kind in 1.0 and 1.0-ml] Returns an xs:string representing the node's kind: either "document", "element", "attribute", "text", "namespace", "processing-instruction", "binary", or "comment".
fn:node-name Returns an expanded-QName for node kinds that can have names.
fn:normalize-space Returns the specified string with normalized whitespace, which strips off any leading or trailing whitespace and replaces any other sequences of more than one whitespace characters with a single space character (#x20).
fn:normalize-unicode Return the argument normalized according to the normalization criteria for a normalization form identified by the value of $normalizationForm.
fn:not Returns true if the effective boolean value is false, and false if the effective boolean value is true.
fn:number Returns the value indicated by $arg or, if $arg is not specified, the context item after atomization, converted to an xs:double.
fn:one-or-more Returns $arg if it contains one or more items.
fn:position Returns the context position from the dynamic context.
fn:prefix-from-QName Returns an xs:NCName representing the prefix of $arg.
fn:QName Returns an xs:QName with the namespace URI given in $paramURI.
fn:regex-group While the xsl:matching-substring instruction is active, a set of current captured substrings is available, corresponding to the parenthesized sub-expressions of the regular expression.
fn:remove Returns a new sequence constructed from the value of $target with the item at the position specified by the value of $position removed.
fn:replace Returns a string constructed by replacing the specified $pattern on the $input string with the specified $replacement string.
fn:resolve-QName Returns an xs:QName value (that is, an expanded QName) by taking an xs:string that has the lexical form of an xs:QName (a string in the form "prefix:local-name" or "local-name") and resolving it using the in-scope namespaces for a given element.
fn:resolve-uri Resolves a relative URI against an absolute URI.
fn:reverse Reverses the order of items in a sequence.
fn:root Returns the root of the tree to which $arg belongs.
fn:round Returns the number with no fractional part that is closest to the argument.
fn:round-half-to-even The value returned is the nearest (that is, numerically closest) numeric to $arg that is a multiple of ten to the power of minus $precision.
fn:seconds-from-dateTime Returns an xs:decimal value between 0 and 60.999..., both inclusive representing the seconds and fractional seconds in the localized value of $arg.
fn:seconds-from-duration Returns an xs:decimal representing the seconds component in the canonical lexical representation of the value of $arg.
fn:seconds-from-time Returns an xs:decimal value between 0 and 60.999..., both inclusive, representing the seconds and fractional seconds in the localized value of $arg.
fn:starts-with Returns true if the first parameter starts with the string from the second parameter, otherwise returns false.
fn:static-base-uri Returns the value of the base-uri property from the static context.
fn:string Returns the value of $arg represented as an xs:string.
fn:string-join Returns an xs:string created by concatenating the members of the $parameter1 sequence using $parameter2 as a separator.
fn:string-length Returns an integer representing the length of the specified string.
fn:string-pad [0.9-ml only] Returns a string representing the $padString concatenated with itself the number of times specifed in $padCount.
fn:string-to-codepoints Returns the sequence of Unicode code points that constitute an xs:string.
fn:subsequence Returns the contiguous sequence of items in the value of $sourceSeq beginning at the position indicated by the value of $startingLoc and continuing for the number of items indicated by the value of $length.
fn:substring Returns a substring starting from the $startingLoc and continuing for $length characters.
fn:substring-after Returns the substring created by taking all of the input characters that occur after the specified $after characters.
fn:substring-before Returns the substring created by taking all of the input characters that occur before the specified $before characters.
fn:subtract-dateTimes-yielding-dayTimeDuration [0.9-ml only, use the minus operator ( - ) instead] Returns the xdt:dayTimeDuration that corresponds to the difference between the normalized value of $srcval1 and the normalized value of $srcval2.
fn:subtract-dateTimes-yielding-yearMonthDuration [0.9-ml only, use the minus operator ( - ) instead] Returns the xdt:yearMonthDuration that corresponds to the difference between the normalized value of $srcval1 and the normalized value of $srcval2.
fn:sum Returns a value obtained by adding together the values in $arg.
fn:system-property Returns a string representing the value of the system property identified by the name.
fn:tail Returns all but the first item in a sequence.
fn:timezone-from-date Returns the timezone component of $arg if any.
fn:timezone-from-dateTime Returns the timezone component of $arg if any.
fn:timezone-from-time Returns the timezone component of $arg if any.
fn:tokenize Returns a sequence of strings contructed by breaking the specified input into substrings separated by the specified $pattern.
fn:trace Return the input $value unchanged and, if $label is the name of an enabled server event, log event to the App Server log file <install_dir>/Logs/<port>_ErrorLog.txt; where <install_dir> is the MarkLogic install directory, and <port> is the port number of the current App Server or "TaskServer" if the current request is running on the Task Server.
fn:translate Returns a string where every character in $src that occurs in some position in the $mapString is translated into the $transString character in the corresponding location of the $mapString character.
fn:true Returns the xs:boolean value true.
fn:type-available Returns true if and only if there is a type whose name matches the value of the $type-name argument is present in the static context.
fn:unordered Returns the items of $sourceSeq in an implementation dependent order.
fn:unparsed-entity-public-id Returns the public identifier of the unparsed entity specified by the $entity-name parameter.
fn:unparsed-entity-uri Always returns the zero length string.
fn:unparsed-text Reads a file stored in the database as either text or binary file and returns its contents as a string.
fn:unparsed-text-available Returns true if a call to unparsed-text would succeed with identical arguments.
fn:upper-case Returns the specified string converting all of the characters to upper-case characters.
fn:year-from-date Returns an xs:integer representing the year component in the localized value of $arg.
fn:year-from-dateTime Returns an xs:integer representing the year component in the localized value of $arg.
fn:years-from-duration Returns an xs:integer representing the years component in the canonical lexical representation of the value of $arg.
fn:zero-or-one Returns $arg if it contains zero or one items.