diff --git a/specifications/xpath-functions-40/src/function-catalog.xml b/specifications/xpath-functions-40/src/function-catalog.xml index 19666dac7..241eecc83 100644 --- a/specifications/xpath-functions-40/src/function-catalog.xml +++ b/specifications/xpath-functions-40/src/function-catalog.xml @@ -13381,6 +13381,7 @@ else QName("", $value) + @@ -13393,64 +13394,130 @@ else QName("", $value) context-independent focus-independent + + deterministic + context-independent + focus-independent +

Returns a path expression that can be used to select the supplied node relative to the root of its containing document.

-

The behavior of the function if the argument is omitted is exactly the same as if the +

The behavior of the function if the $nodeargument is omitted is exactly the same as if the context value (.) had been passed as the argument.

If $node is the empty sequence, the function returns the empty sequence.

+ +

The $options argument, if present, defines additional parameters controlling + how the output is formatted. The option parameter conventions apply. The options available are as follows:

+ + + + A map from namespace prefixes to namespace URIs, such as might be returned + by the function fn:in-scope-namespaces. If a prefix is available + for a given URI, it is used in preference to using Q{uri}local notation. + + map((xs:NCName | enum('')), xs:anyURI)? + () + + + If true, the returned path includes the index positions of nodes. If + false, only the node names are included. + + xs:boolean + true + + +

If $node is a document node, the function returns the string "/".

+

Otherwise, the function returns a string that consists of a sequence of steps, one - for each ancestor-or-self of $node other than the root node. This string is - prefixed by "Q{http://www.w3.org/2005/xpath-functions}root()" if the root - node is not a document node. Each step consists of the character "/" + for each ancestor-or-self of $node other than the root node.

+ +

If the root node is not a document node then this string is preceded by + a string notionally representing a call to the fn:root function, + expressed as follows:

+ + +

If the namespaces option is present and defines a mapping from a + non empty prefix P + to the namespace URI http://www.w3.org/2005/xpath-functions, then + "P:root()"

+

If the namespaces option is present and defines a mapping from the empty string + to the namespace URI http://www.w3.org/2005/xpath-functions, then + "root()"

+

Otherwise, "Q{http://www.w3.org/2005/xpath-functions}root()".

+
+ +

Each step consists of the character "/" followed by a string whose form depends on the kind of node selected by that step, as follows:

-

For an element node, - Q{uri}local[position], - where uri is the namespace URI of the node name or the - empty string if the node is in no namespace, local is - the local part of the node name, and position is an - integer representing the position of the selected node among its like-named +

For an element node, then by default + Q{uri}local[position], + where uri is the namespace URI of the node name or the + empty string if the node is in no namespace, local is + the local part of the node name, and position is an + integer representing the one-based position of the selected node among its like-named siblings.

+

The suffix [position] is omitted if the indexes + option is present with the value false.

+

If the namespaces option is present, and if it includes a mapping + from a namespace prefix to the namespace URI of the element, or to the empty string + if the element is in no namespace, then:

+ +

If there is more than one such prefix, then one of them is chosen arbitrarily.

+

If the namespace prefix is the zero-length string, then the Q{uri} part of the step is + replaced by the empty string.

+

If the prefix is an NCName P, then the Q{uri} part of the step is + replaced by P:.

+

For an attribute node:

-

if the node is in no namespace, @local, where - local is the local part of the node name

+

If the node is in no namespace, @local, where + local is the local part of the node name.

-

otherwise, @Q{uri}local, where +

Otherwise, by default @Q{uri}local, where uri is the namespace URI of the node name, - and local is the local part of the node name

+ and local is the local part of the node name.

+

If the namespaces option is present , and if it includes a mapping + from a non-empty namespace prefix to the namespace URI of the attribute, then + the Q{uri} part of the step is replaced with a namespace + prefix in the same way as for element nodes, described above.

-

For a text node: text()[position] where - position is an integer representing the position - of the selected node among its text node siblings

+

For a text node: text()[position] where + position is an integer representing the position + of the selected node among its text node siblings.

+

The suffix [position] is omitted if the indexes + option is present with the value false.

-

For a comment node: comment()[position] where +

For a comment node: comment()[position] where position is an integer representing the position - of the selected node among its comment node siblings

+ of the selected node among its comment node siblings.

+

The suffix [position] is omitted if the indexes + option is present with the value false.

For a processing-instruction node: - processing-instruction(local)[position] + processing-instruction(local)[position] where local is the name of the processing instruction node and position is an integer representing the position of the selected node among its like-named processing-instruction node - siblings

+ siblings.

+

The suffix [position] is omitted if the indexes + option is present with the value false.

For a namespace node:

@@ -13462,14 +13529,16 @@ else QName("", $value) namespace node (which represents the namespace prefix).

-

If the namespace node has no name (that is, it represents the default +

If the namespace node has no name (that is, if it represents the default namespace): - namespace::*[Q{http://www.w3.org/2005/xpath-functions}local-name() = ""]

+ namespace::*[Ulocal-name() = ""]

+

Here Ulocal-name() represents a call on the function + fn:local-name and is formatted using the same + conventions as the call on fn:root described earlier.

-

The following errors may be raised when $node is omitted:

@@ -13486,6 +13555,16 @@ else QName("", $value)
+ + +

Using the namespaces option to shorten the generated path is often convenient, + but the resulting path may be unusable if the input tree contains multiple bindings for the same prefix.

+ +

A map returned by fn:in-scope-namespaces will never contain an entry that maps any prefix + to the zero-length URI. Such an entry can, however, be added manually, and can be used to control how + no-namespace names are represented in the output (including the option of giving them a non-empty prefix).

+
+ @@ -13497,25 +13576,45 @@ Himmlische, dein Heiligtum. - path($e) + path($e) '/' - path($e/*:p) + path($e/*:p) '/Q{http://example.com/one}p[1]' - path($e/*:p/@xml:lang) + path($e/*:p, {'namespaces': in-scope-namespaces($e/*)}) + '/p[1]' + + + path($e/*:p, {'indexes': false()}) + '/Q{http://example.com/one}p' + + + path($e/*:p/@xml:lang) '/Q{http://example.com/one}p[1]/@Q{http://www.w3.org/XML/1998/namespace}lang' - path($e/*:p/@author) + path($e//@xml:lang, + {'namespaces': in-scope-namespaces($e/*)}) + '/p[1]/@xml:lang' + + + path($e/*:p/@author) '/Q{http://example.com/one}p[1]/@author' - path($e/*:p/*:br[2]) + path($e/*:p/*:br[2]) '/Q{http://example.com/one}p[1]/Q{http://example.com/one}br[2]' + + path($e/*:p/*:br[2], + {'namespaces': { 'N': 'http://example.com/one' }, + 'indexes': false() + }) + '/N:p/N:br' + path( $e//text()[ @@ -13534,19 +13633,31 @@ Himmlische, dein Heiligtum. - path($emp) + path($emp) 'Q{http://www.w3.org/2005/xpath-functions}root()' - path($emp/@xml:id) + path($emp/@xml:id) 'Q{http://www.w3.org/2005/xpath-functions}root()/@Q{http://www.w3.org/XML/1998/namespace}id' - path($emp/empnr) + path($emp/empnr) 'Q{http://www.w3.org/2005/xpath-functions}root()/Q{}empnr[1]' + + path($emp/empnr, + { 'namespaces': { 'fn': 'http://www.w3.org/2005/xpath-functions', + '': '' } + }) + 'fn:root()/empnr[1]' + + + +

Options are added to customize the form of the output.

+
+
@@ -16048,7 +16159,7 @@ else error(parse-QName('Q{http://www.w3.org/2005/xqt-errors}FORG0005'))

The $options argument, if present, defines additional parameters controlling - how the comparison is done. If it is supplied as a map, then he option parameter conventions apply.

For backwards compatibility reasons, the $options argument can also be set to a string containing a collation name. Supplying a string $S for this argument is equivalent