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:

121 functions
Function name Description
fn.abs Returns the absolute value of $arg.
fn.adjustDateTimeToTimezone Adjusts an xs:dateTime value to a specific timezone, or to no timezone at all.
fn.adjustDateToTimezone Adjusts an xs:date value to a specific timezone, or to no timezone at all.
fn.adjustTimeToTimezone Adjusts an xs:time value to a specific timezone, or to no timezone at all.
fn.analyzeString 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.baseUri 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.codepointEqual Returns true if the specified parameters are the same Unicode code point, otherwise returns false.
fn.codepointsToString 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.currentDate Returns xs:date(fn:current-dateTime()).
fn.currentDateTime Returns the current dateTime value (with timezone) from the dynamic context.
fn.currentTime Returns xs:time(fn:current-dateTime()).
fn.data Takes a sequence of items and returns a sequence of atomic values.
fn.dayFromDate Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $arg.
fn.dayFromDateTime Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $arg.
fn.daysFromDuration Returns an xs:integer representing the days component in the canonical lexical representation of the value of $arg.
fn.deepEqual This function assesses whether two sequences are deep-equal to each other.
fn.defaultCollation Returns the value of the default collation property from the static context.
fn.distinctValues 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.docAvailable 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.documentUri Returns the value of the document-uri property for the specified node.
fn.empty If the value of $arg is the empty sequence, the function returns true; otherwise, the function returns false.
fn.encodeForUri Invertible function that escapes characters required to be escaped inside path segments of URIs.
fn.endsWith 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.escapeHtmlUri %-escapes everything except printable ASCII characters.
fn.exactlyOne 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.false Returns the xs:boolean value false.
fn.floor Returns the largest (closest to positive infinity) number with no fractional part that is not greater than the value of $arg.
fn.formatDate Returns a formatted date value based on the picture argument.
fn.formatDateTime Returns a formatted dateTime value based on the picture argument.
fn.formatNumber Returns a formatted string representation of value argument based on the supplied picture.
fn.formatTime Returns a formatted time value based on the picture argument.
fn.functionAvailable 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.generateId Returns a string that uniquely identifies a given node.
fn.head Returns the first item in a sequence.
fn.hoursFromDateTime Returns an xs:integer between 0 and 23, both inclusive, representing the hours component in the localized value of $arg.
fn.hoursFromDuration Returns an xs:integer representing the hours component in the canonical lexical representation of the value of $arg.
fn.hoursFromTime 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.implicitTimezone Returns the value of the implicit timezone property from the dynamic context.
fn.indexOf Returns a sequence of positive integers giving the positions within the sequence $seqParam of items that are equal to $srchParam.
fn.inScopePrefixes Returns the prefixes of the in-scope namespaces for $element.
fn.insertBefore 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.iriToUri Idempotent function that escapes non-URI characters.
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.localName 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.localNameFromQName Returns an xs:NCName representing the local part of $arg.
fn.lowerCase Returns the specified string converting all of the characters to lower-case characters.
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.minutesFromDateTime Returns an xs:integer value between 0 and 59, both inclusive, representing the minute component in the localized value of $arg.
fn.minutesFromDuration Returns an xs:integer representing the minutes component in the canonical lexical representation of the value of $arg.
fn.minutesFromTime 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.monthFromDate Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $arg.
fn.monthFromDateTime Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $arg.
fn.monthsFromDuration 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.namespaceUri Returns the namespace URI of the xs:QName of the node specified by $arg.
fn.namespaceUriForPrefix Returns the namespace URI of one of the in-scope namespaces for $element, identified by its namespace prefix.
fn.namespaceUriFromQName 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.nodeName Returns an expanded-QName for node kinds that can have names.
fn.normalizeSpace 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.normalizeUnicode 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.oneOrMore Returns $arg if it contains one or more items.
fn.prefixFromQName Returns an xs:NCName representing the prefix of $arg.
fn.QName Returns an xs:QName with the namespace URI given in $paramURI.
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.resolveQName 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.resolveUri 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.roundHalfToEven 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.secondsFromDateTime 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.secondsFromDuration Returns an xs:decimal representing the seconds component in the canonical lexical representation of the value of $arg.
fn.secondsFromTime 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.startsWith Returns true if the first parameter starts with the string from the second parameter, otherwise returns false.
fn.staticBaseUri 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.stringJoin Returns an xs:string created by concatenating the members of the $parameter1 sequence using $parameter2 as a separator.
fn.stringLength Returns an integer representing the length of the specified string.
fn.stringToCodepoints 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.substringAfter Returns the substring created by taking all of the input characters that occur after the specified $after characters.
fn.substringBefore Returns the substring created by taking all of the input characters that occur before the specified $before characters.
fn.sum Returns a value obtained by adding together the values in $arg.
fn.tail Returns all but the first item in a sequence.
fn.timezoneFromDate Returns the timezone component of $arg if any.
fn.timezoneFromDateTime Returns the timezone component of $arg if any.
fn.timezoneFromTime 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.typeAvailable 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.unparsedText Reads a file stored in the database as either text or binary file and returns its contents as a string.
fn.unparsedTextAvailable Returns true if a call to unparsed-text would succeed with identical arguments.
fn.upperCase Returns the specified string converting all of the characters to upper-case characters.
fn.yearFromDate Returns an xs:integer representing the year component in the localized value of $arg.
fn.yearFromDateTime Returns an xs:integer representing the year component in the localized value of $arg.
fn.yearsFromDuration Returns an xs:integer representing the years component in the canonical lexical representation of the value of $arg.
fn.zeroOrOne Returns $arg if it contains zero or one items.