# Package net.sf.saxon.functions

This package provides implementations of all the core functions available for use in XPath expressions. This includes all the functions defined in the XPath 2.0 Functions and Operators specification, as well as the additional functions defined for use in XSLT. The package also includes Saxon extension functions. Most of these are in a single class `Extensions`, but some of the more complex functions are in their own classes, for example `Evaluate` implements `saxon:evaluate()`.

There is one class for group of closely-related functions. These all inherit from the class net.sf.saxon.expr.Function. The class `StandardFunction` is used to map a function name to its implementation; it contains tables of information describing the signature of each function, so that the type-checking code is completely generic.

The package also contains machinery for defining user extension functions. A collection of functions is represented by a `FunctionLibrary` object. There are several standard function libraries available, covering core functions, Saxon extension functions constructor functions, and user extension functions: each category is covered by a subclass of `FunctionLibrary`, and there is also a `FunctionLibraryList` that represents the total collection of functions in these individual libraries. The `JavaExtensionLibrary` contains the logic for binding Java extension functions given their name and arity and the types of their arguments. The class `ExtensionFunctionCall` contains the run-time logic for converting XPath values to the required Java types, and for converting the result back to an XPath value.

These classes, although public, will not normally be used directly by user-written Java applications. There are a few exceptions, such as `ResolveURI` which deliberately expose functionality equivalent to the XPath function in a static method.

- Interface Summary
  Interface | Description
  --- | ---
  Fold |
  FunctionLibrary | A FunctionLibrary handles the binding of function calls in XPath (or XQuery) expressions.
  PushableFunction | Interface implemented by functions that have a "push" implementation, whereby the result of the function is written incrementally to an `Outputter` rather than being returned as the result of a `call()` method.
  StatefulSystemFunction |

- Class Summary
  Class | Description
  --- | ---
  Abs | This class implements the fn:abs() function
  AbstractFunction | Abstract superclass (and factory class) for implementations of Function
  AccessorFn | This class supports the get_X_from_Y functions defined in XPath 2.0
  AccessorFn.DayFromDate |
  AccessorFn.DayFromDateTime |
  AccessorFn.DaysFromDuration |
  AccessorFn.HoursFromDateTime |
  AccessorFn.HoursFromDuration |
  AccessorFn.HoursFromTime |
  AccessorFn.LocalNameFromQName |
  AccessorFn.MinutesFromDateTime |
  AccessorFn.MinutesFromDuration |
  AccessorFn.MinutesFromTime |
  AccessorFn.MonthFromDate |
  AccessorFn.MonthFromDateTime |
  AccessorFn.MonthsFromDuration |
  AccessorFn.NamespaceUriFromQName |
  AccessorFn.PrefixFromQName |
  AccessorFn.SecondsFromDateTime |
  AccessorFn.SecondsFromDuration |
  AccessorFn.SecondsFromTime |
  AccessorFn.TimezoneFromDate |
  AccessorFn.TimezoneFromDateTime |
  AccessorFn.TimezoneFromTime |
  AccessorFn.YearFromDate |
  AccessorFn.YearFromDateTime |
  AccessorFn.YearsFromDuration |
  AccumulatorFn | Non-streaming implementation of accumulator-before() and accumulator-after()
  AccumulatorFn.AccumulatorAfter |
  AccumulatorFn.AccumulatorBefore |
  Adjust_1 | This class implements the XPath 2.0 functions adjust-date-to-timezone(), adjust-time-timezone(), and adjust-dateTime-timezone(), with a single argument
  Adjust_2 | This class implements the XPath 2.0 functions adjust-date-to-timezone(), adjust-time-timezone(), and adjust-dateTime-timezone(), with two arguments
  Aggregate | This abstract class provides functionality common to the sum(), avg(), count(), exists(), and empty() functions.
  AnalyzeStringFn | Implements the fn:analyze-string function defined in XPath 3.0.
  ApplyFn | This class implements the function fn:apply(), which is a standard function in XQuery 3.1.
  AvailableEnvironmentVariables |
  AvailableSystemProperties |
  Average | Implementation of the fn:avg function
  BaseUri_1 | This class implements the fn:base-uri() function in XPath 2.0
  BooleanFn | This class supports the XPath function boolean()
  CallableFunction | A function item that wraps a Callable
  Ceiling | This class supports the ceiling() function
  CodepointEqual | Implements the XPath 2.0 fn:codepoint-equal() function.
  CodepointsToString | This class implements the function fn:codepoints-to-string()
  CollatingFunctionFixed | Abstract superclass for functions that take an optional collation argument, in which the collation is not present as an explicit argument, either because it was defaulted in the original function call, or because it has been bound during static analysis.
  CollatingFunctionFree | Generic class for all functions that take an optional collation argument, where the collation argument is supplied and has not yet been resolved.
  CollationKeyFn | Implements the collation-key function defined in the XSLT 3.0 and XPath 3.1 specifications
  CollectionFn | Implement the fn:collection() function.
  Compare | This class implements the XPath 2.0 fn:compare() function
  Concat | Implementation of the fn:concat() function
  ConstantFunction | A ConstantFunction is a zero-argument function that always delivers the same result, supplied at the time the function is instantiated.
  ConstantFunction.False |
  ConstantFunction.True |
  Contains | Implements the fn:contains() function, with the collation already known
  ContainsToken | Implements the fn:contains-token() function with the collation already bound.
  ContextAccessorFunction | A ContextAccessorFunction is a function that is dependent on the dynamic context.
  ContextItemAccessorFunction | A ContextItemAccessorFunction is a function that takes no arguments, but operates implicitly on the context item.
  ContextItemAccessorFunction.Number_0 | Subclass of ContextItemAccessorFunction to handle number().
  ContextItemAccessorFunction.StringAccessor | Subclass of ContextItemAccessorFunction to handle string-length() and normalize-space().
  CopyOfFn | XSLT 3.0 function copy-of().
  Count | Implementation of the fn:count function
  Current | Implement the XSLT current() function
  CurrentGroup | Implements the XSLT function current-group()
  CurrentGroupCall | Implements the XSLT function current-group()
  CurrentGroupingKey | Implements the XSLT function current-grouping-key()
  CurrentGroupingKeyCall | Implements the XSLT function current-grouping-key()
  CurrentMergeGroup | Implements the XSLT 3.0 function current-merge-group()
  CurrentMergeKey | Implements the XSLT function current-grouping-key()
  CurrentOutputUri | This class implements the XSLT 3.0 function current-output-uri()
  Data_1 | Implement XPath function fn:data() with a single argument
  DateTimeConstructor | This class supports the dateTime($date, $time) function
  DeepEqual | XSLT 2.0 deep-equal() function, where the collation is already known.
  DistinctValues | The XPath 2.0 distinct-values() function, with the collation argument already known
  DistinctValues.DistinctIterator | Iterator class to return the distinct values in a sequence
  Doc | Implement the fn:doc() function - a simplified form of the Document function
  Doc_2 | Implement the saxon:doc() function - a variant of the fn:doc function with a second argument to supply option parameters.
  DocAvailable | Implement the fn:doc-available() function
  DocumentFn | Implements the XSLT document() function
  DocumentUri_1 | This class supports the document-uri() function
  DynamicContextAccessor | A DynamicContextAccessor is a function that takes no arguments, but operates implicitly on the dynamic context.
  DynamicContextAccessor.CurrentDate |
  DynamicContextAccessor.CurrentDateTime |
  DynamicContextAccessor.CurrentTime |
  DynamicContextAccessor.DefaultLanguage |
  DynamicContextAccessor.ImplicitTimezone |
  ElementAvailable | This class supports the XSLT element-available function.
  Empty | Implementation of the fn:empty function
  EncodeForUri | This class supports the function fn:encode-for-uri()
  EndsWith | Implements the fn:ends-with() function, with the collation already fixed
  EnvironmentVariable | Implement the XPath 3.0 fn:environment-variable() function
  Error | Implement XPath function fn:error()
  EscapeHtmlUri | This class supports the function fn:escape-html-uri()
  ExecutableFunctionLibrary | An ExecutableFunctionLibrary is a function library that contains definitions of functions for use at run-time.
  Exists | Implementation of the fn:exists function
  Floor | This class implements the fn:floor() function
  FoldingFunction | Implementation of aggregate functions such as sum() and avg() that supply a fold() function.
  FormatDate | Implement the format-date(), format-time(), and format-dateTime() functions in XSLT 2.0 and XQuery 1.1.
  FormatInteger |
  FormatNumber | Implementation of format-number() function.
  FunctionAvailable | This class implements the XSLT function-available functions.
  FunctionLibraryList | A FunctionLibraryList is a list of FunctionLibraries.
  GenerateId_1 | This class supports the generate-id() function with one argument
  HasChildren_1 | This class implements the function fn:has-children($node), which is a standard function in XPath 3.0
  HeadFn | This class implements the function fn:head(), which is a standard function in XPath 3.0
  Idref |
  IndexOf | The XPath 2.0 index-of() function, with the collation already known
  Innermost | This class implements the function fn:has-children(), which is a standard function in XPath 3.0
  InScopePrefixes | This class implements the XPath 2.0 function fn:in-scope-prefixes()
  InsertBefore | The XPath 2.0 insert-before() function
  InsertBefore.InsertIterator | Insertion iterator.
  IntegratedFunctionCall | Expression representing a call to a user-written extension function implemented as a subtype of `ExtensionFunctionCall`
  IntegratedFunctionCall.ConfigurationCheckingFunction | This class checks that NodeInfo objects returned by an extension function were created under the right Configuration
  IntegratedFunctionLibrary | A library of integrated function calls, that is, user-written extension functions implemented as instances of the class IntegratedFunction.
  IriToUri | This class supports the functions encode-for-uri() and iri-to-uri()
  IsIdRef | This class implements the saxon:is-idref() extension function, which is specially-recognized by the system because calls are generated by the optimizer.
  KeyFn |
  KeyFn.SubtreeFilter | Mapping class to filter nodes that have the origin node as an ancestor-or-self
  Lang |
  LocalName_1 | This class supports the local-name() function
  LowerCase | This class implements the fn:lower-case() function
  Matches | This class implements the 3-argument matches() function for regular expression matching
  MathFunctionSet | Abstract class providing functionality common to functions math:sin(), math:cos(), math:sqrt() etc; contains the concrete implementations of these functions as inner subclasses
  MathFunctionSet.AcosFn | Implement math:acos
  MathFunctionSet.AsinFn | Implement math:asin
  MathFunctionSet.Atan2Fn | Implement math:atan2
  MathFunctionSet.AtanFn | Implement math:atan
  MathFunctionSet.CosFn | Implement math:cos
  MathFunctionSet.Exp10Fn | Implement math:exp10
  MathFunctionSet.ExpFn | Implement math:exp
  MathFunctionSet.Log10Fn | Implement math:log10
  MathFunctionSet.LogFn | Implement math:log
  MathFunctionSet.PiFn | Implement math:pi
  MathFunctionSet.PowFn | Implement math:pow
  MathFunctionSet.SinFn | Implement math:sin
  MathFunctionSet.SqrtFn | Implement math:sqrt
  MathFunctionSet.TanFn | Implement math:tan
  Minimax | This class implements the min() and max() functions, with the collation argument already known.
  Minimax.Max | Concrete subclass to define the fn:max() function
  Minimax.Min | Concrete subclass to define the fn:min() function
  Name_1 | This class supports the name() function with one argument
  NamespaceForPrefix | This class supports the function namespace-uri-for-prefix()
  NamespaceUri_1 | This class supports the namespace-uri() function
  Nilled_1 | This class supports the nilled() function
  NodeName_1 | This class supports the node-name() function with a single argument
  NormalizeSpace_1 | Implement the XPath normalize-space() function
  NormalizeUnicode | Implement the XPath normalize-unicode() function (both the 1-argument and 2-argument versions)
  NotFn | This class supports the XPath functions boolean(), not(), true(), and false()
  Number_1 | Implements the XPath fn:number() function when called with one argument.
  OptionsParameter | This class implements the rules for options parameters, as used in functions such as parse-json, serialize, json-to-XML, map:merge.
  Outermost | This class implements the function fn:outermost(), which is a standard function in XPath 3.0
  ParseIetfDate | This class implements the function parse-ietf-date(), which is a standard function in XPath 3.1
  ParseXml |
  ParseXml.RetentiveErrorHandler |
  ParseXmlFragment |
  Path_1 | Implement the fn:path function with one argument
  PositionAndLast |
  PositionAndLast.Last |
  PositionAndLast.Position |
  Put | Implements the fn:put() function in XQuery Update 1.0.
  QNameFn | This class supports the fn:QName() function (previously named fn:expanded-QName())
  RegexFunction | This class implements any of the functions matches(), replace(), tokenize(), analyze-string(), in the version where a flags argument is present in the argument list
  RegexFunctionSansFlags | This class implements any of the functions matches(), replace(), tokenize(), analyze-string(), in which the final "flags" argument is omitted.
  RegexGroup |
  Remove | The XPath 2.0 remove() function
  Remove.RemoveIterator | An implementation of SequenceIterator that returns all items except the one at a specified position.
  Replace | This class implements the replace() function for replacing substrings that match a regular expression
  ResolveQName | This class supports the resolve-QName function in XPath 2.0
  ResolveURI | This class supports the resolve-uri() function in XPath 2.0
  Reverse | Implement XPath function fn:reverse()
  Root_1 | Implement the XPath 2.0 root() function with one argument
  Round | This class implements the fn:round() function
  RoundHalfToEven | This class supports the round-to-half-even() function
  ScalarSystemFunction | A Scalar system function is a pure function that accepts a single item as its operand, returns a single atomic value as its result, typically returns an empty sequence if the argument is an empty sequence, and has no context dependencies.
  Serialize | Implementation of fn:serialize() as defined in XPath 3.1
  SnapshotFn | XSLT 3.0 function snapshot().
  Sort_1 | This class implements the function fn:sort#1, which is a standard function in XPath 3.1
  Sort_1.ItemToBeSorted |
  Sort_2 | This class implements the function fn:sort#2, according to the new XPath 3.1 spec in bug 29792
  StartsWith | Implements the fn:starts-with() function, with the collation already known
  StaticBaseUri | Implement the XPath function static-base-uri()
  StaticContextAccessor | A StaticContextAccessor is a function that takes no arguments, but operates implicitly on the static context.
  StaticContextAccessor.DefaultCollation | Implement the XPath function default-collation()
  StreamAvailable | This class implements the XSLT 3.0 function stream-available()
  String_1 | Implement XPath function string() with a single argument
  StringJoin | fn:string-join(string* $sequence, string $separator)
  StringLength_1 | Implement the XPath string-length() function
  StringToCodepoints | This class supports the function string-to-codepoints()
  Subsequence_2 | Implements the XPath 2.0 subsequence() function with two arguments
  Subsequence_3 | Implements the XPath 2.0 subsequence() function with three arguments
  Substring | This class implements the XPath substring() function
  SubstringAfter | Implements the fn:substring-after() function with the collation already known
  SubstringBefore | Implements the fn:substring-before() function with the collation already known
  Sum | Implementation of the fn:sum function
  SuperId | The XPath id() or element-with-id() function XPath 2.0 version: accepts any sequence as the first parameter; each item in the sequence is taken as an IDREFS value, that is, a space-separated list of ID values.
  SuperId.ElementWithId |
  SuperId.Id |
  SystemFunction | Abstract superclass for calls to functions in the standard function library
  SystemProperty | Implementation of the XSLT system-property() function
  TailFn | This class implements the function fn:tail(), which is a standard function in XPath 3.0
  Tokenize_1 | This class implements the single-argument tokenize() function introduced in XPath 3.1
  Tokenize_3 | This class implements the 3-argument tokenize() function for regular expression matching.
  Trace | This class supports the XPath 2.0 function trace().
  TransformFn | This class implements the function transform(), which is a standard function in XPath 3.1
  Translate | Implement the XPath translate() function
  TreatFn | This class supports the XPath 2.0 functions exactly-one(), one-or-more(), zero-or-one().
  TreatFn.ExactlyOne |
  TreatFn.OneOrMore |
  TreatFn.ZeroOrOne |
  TypeAvailable | This class supports the XSLT fn:type-available() function.
  Unordered | XPath 2.0 unordered() function
  UnparsedEntity | Implements the unparsed-entity-uri() function defined in XSLT 1.0 and the unparsed-entity-public-id() function defined in XSLT 2.0
  UnparsedEntity.UnparsedEntityPublicId |
  UnparsedEntity.UnparsedEntityUri |
  UnparsedText | Implementation of fn:unparsed-text() - with one argument or two
  UnparsedTextAvailable |
  UnparsedTextFunction | Abstract superclass containing common code supporting the functions unparsed-text(), unparsed-text-lines(), and unparsed-text-available()
  UnparsedTextLines |
  UpperCase | This class implements the fn:upper-case() function
  UriCollection | Implement the fn:uri-collection() function (new in XQuery 3.0/XSLT 3.0).
  URIQueryParameters | A set of query parameters on a URI passed to the collection() or document() function
  URIQueryParameters.RegexFilter | A FilenameFilter that tests file names against a regular expression

- Enum Summary
  Enum | Description
  --- | ---
  AccessorFn.Component |
  AccumulatorFn.Phase |

- Exception Summary
  Exception | Description
  --- | ---
  Error.UserDefinedXPathException |