# Changes to Functions and Operators

All namespace URIs starting with `http://www.w3.org/2003/11` have been updated to `http://www.w3.org/2004/07`, as defined in the July 2004 working drafts.

The rules for comparing an xs:dateTime or xs:time with a timezone to one without a timezone have been changed to use the implicit timezone rather than UTC. Corresponding change for xs:date not yet made.

The XSLT `key()` function now takes an optional third argument: this is a node identifying the document to be searched.

The `concat()` function now accepts any atomic value as an argument, and implicitly casts the supplied value to a string.

The `format-dateTime()` and `format-time()` functions have been changed to handle the 12-hour clock using the convention of numbering the hour starting at noon or midnight as 12 rather than 0, and treating midnight as a.m. and noon as p.m.

The six functions for extracting the components of a duration are now named `years-from-duration()`, `months-from-duration()`, `days-from-duration()` `hours-from-duration()`, `minutes-from-duration()`, `seconds-from-duration()`. The new names have been added; previous names are retained as synonyms for the time being. The functionality is unchanged.

The `sum()` function can now total a sequence of durations, and accepts an optional second argument to indicate the value to be returned when the sequence is empty. This defaults to the integer zero.

The `avg()` function can now average a sequence of durations.

The `min()` and `max()` functions, given a set of untypedAtomic values as input, now return the `xs:double` value after converting the value to a number, not the original untypedAtomic value. For example, given an untyped input document, `min(//item/@val)` will now typically return an `xs:double`.

The implementation of the XSLT `function-available()` function has been extended so it now recognizes all the functions in the static context, including system functions, Saxon-specific extension functions, Java extension functions, constructor functions (including those corresponding to user-defined atomic types in the schema-aware product), stylesheet functions, and imported XQuery functions. This applies whether the function-name is supplied as a string literal (the usual case) or whether it is known only at run-time (a pathological case encountered only in conformance tests).

The function `namespace-uri-from-QName()` now returns a zero-length string rather than an empty sequence if the QName is in the null namespace.

The two-argument form of the `idref()` function is implemented (this was introduced since the November 2003 working drafts).

The `base-uri()` with no arguments now returns the base URI of the context node. The base URI of the static context (that is, the base URI of the stylesheet or query module) is now obtained using the new function `static-base-uri()`. (This change was agreed by the Working Groups on 24 Aug 2004.)

The ability to cast from an `xs:time` to an `xs:dateTime` has been removed. This was the only remaining cast whose result was context-dependent, so the WGs have removed the functionality. The functionality has been replaced with a new function `dateTime` that takes a date and time as its two arguments.

The function `QName` is introduced as a replacement for `expanded-QName`. For the time being, the old name is retained as a synonym.

Conversion of `QName` to `string` is now supported. A QName value always retains the prefix that was specified when the QName was constructed, and although this plays no part in comparing QName values, the original prefix is used when the QName is converted to a string.

Next