[Bug 2681] Functions taking "." as default argument


------- Additional Comments From mike@saxonica.com  2006-01-17 18:07 -------
Here is a full list of the affected functions. In each case the proposal is that
the call on the left should be equivalent to the call on the right even in error
cases (it is already equivalent in success cases).

base-uri() => base-uri(.)
id(x) => id(x, .)
idref(x) => idref(x, .)
lang(x) => lang(x, .)
local-name() => local-name(.)
name() => name(.)
number() => number(.)
namesapce-uri() => namesapce-uri(.)
root() => root(.)
string() => string(.)

The following cases are "almost equivalent" (but not quite - string-length(3) is
a type error, but string-length(.) where . is 3 is allowed). In these cases I
propose that we also use the same error code for the error cases, for
consistency with the list of functions above:

string-length() => string-length(string(.))
normalize-space() => normalize-space(string(.))

Example of changes in detail:

base-uri: delete "If $arg is not specified, returns the value of the base-uri
property of the context item (.) with the above semantics. If the context item
is not a node, an error is raised: [err:FOTY0011]. If the context item is
undefined, an error is raised: [err:FONC0001].". Instead say "If $arg is not
specified, the effect is the same as calling fn:base-uri(.), including possible
error cases when the context item is undefined or is not a node.".

Other functions: similarly, say at the start that the semantics when the
argument is omitted are the same as when "." is provided as the argument, and
thereafter avoid discussing this case further.

string-length() and normalize-space() need a little more care because this
equivalence doesn't hold: instead, it's probably best to simply change the error
codes for "context item not defined" to XPDY0002.

These changes remove all uses of FOTY0011, but FODC0001 remains in use for
position() and last().

Received on Tuesday, 17 January 2006 18:07:40 UTC