diff --git a/specifications/xpath-functions-40/src/fos.xsd b/specifications/xpath-functions-40/src/fos.xsd index 4f2608d0ea..dc2dce54f9 100644 --- a/specifications/xpath-functions-40/src/fos.xsd +++ b/specifications/xpath-functions-40/src/fos.xsd @@ -178,6 +178,7 @@ + diff --git a/specifications/xpath-functions-40/src/function-catalog.xml b/specifications/xpath-functions-40/src/function-catalog.xml index 45f2e37ab3..3e8f7a24de 100644 --- a/specifications/xpath-functions-40/src/function-catalog.xml +++ b/specifications/xpath-functions-40/src/function-catalog.xml @@ -7609,7 +7609,7 @@ some $t in $value ! tokenize(.) satisfies deterministic - context-dependent + context-dependent focus-independent @@ -7644,8 +7644,9 @@ some $t in $value ! tokenize(.) satisfies or is supplied as an empty sequence then:

-

If the static base URI in the static context is not absent, it is used as the effective - value of $base.

+

If the executable base URI + in the dynamic context is not absent, it is used as the effective + value of $base.

Otherwise, a dynamic error is raised:

The function computes the effective boolean value of a sequence, defined according to the following rules. See also .

+ spec="XP40" ref="id-ebv"/>.

If $input is the empty sequence, fn:boolean returns @@ -11062,7 +11063,7 @@ represented by the $value argument took place or will take place.

If either $arg1 or $arg2 do not contain an explicit timezone then, for the purpose of the operation, the implicit timezone provided by the dynamic context (See .) is assumed to be present as part of the value.

The function returns the elapsed time between the date/time instant arg2 @@ -11114,7 +11115,7 @@ represented by the $value argument took place or will take place.

If either $arg1 or $arg2 do not contain an explicit timezone then, for the purpose of the operation, the implicit timezone provided by the dynamic context (See .) is assumed to be present as part of the value.

The starting instant of an xs:date is the xs:dateTime at @@ -17879,6 +17880,7 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF] + @@ -17887,7 +17889,7 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF] deterministic - context-dependent + context-dependent focus-independent @@ -17897,9 +17899,10 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF]

If $source is the empty sequence, the result is an empty sequence.

If $source is a relative URI reference, it is resolved relative to the value - of the static base URI property from the static context. The resulting absolute URI is + of the executable base URI property + from the dynamic context of the caller. The resulting absolute URI is promoted to an xs:string.

-

If the available documents described in If the available documents described in provides a mapping from this string to a document node, the function returns that document node.

@@ -18038,7 +18041,7 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF] deterministic - context-dependent + context-dependent focus-independent @@ -18052,7 +18055,7 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF]

In all other cases this function returns false. This includes the case where an invalid URI is supplied, and also the case where a valid relative URI reference is supplied, and cannot be resolved, - for example because the static base URI is absent.

+ for example because the executable base URI is absent.

If this function returns true, then calling fn:doc($source) within the same deterministic - context-dependent + context-dependent focus-independent @@ -18081,16 +18084,18 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF] items obtained by interpreting $source as an xs:anyURI and resolving it according to the mapping specified in available collections described in .

+ spec="XP40" ref="id-xp-evaluation-context-components"/>.

If available collections provides a mapping from this string to a sequence of items, the function returns that sequence. If available collections maps the string to an empty sequence, then the function returns an empty sequence.

If $source is not specified, the function returns the sequence of items in the default collection in the dynamic context. See .

-

If $source is a relative xs:anyURI, it is resolved - against the value of the base-URI property from the static context.

+ spec="XP40" ref="id-xp-evaluation-context-components"/>.

+

If $source is a relative URI reference, it is resolved relative to the value + of the executable base URI property + from the dynamic context of the caller. The resulting absolute URI is + promoted to an xs:string.

If $source is the empty sequence, the function behaves as if it had been called without an argument. See above.

By default, this function is deterministic - context-dependent + context-dependent focus-independent @@ -18156,15 +18161,17 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF]

The zero-argument form of the function returns the URIs in the default URI collection described in .

-

If $source is a relative xs:anyURI, it is resolved - against the value of the base-URI property from the static context.

+ spec="XP40" ref="id-xp-evaluation-context-components"/>.

+

If $source is a relative URI reference, it is resolved relative to the value + of the executable base URI property + from the dynamic context of the caller. The resulting absolute URI is + promoted to an xs:string.

If $source is the empty sequence, the function behaves as if it had been called without an argument. See above.

The single-argument form of the function returns the sequence of URIs corresponding to the supplied URI in the available URI collections described in .

+ spec="XP40" ref="id-xp-evaluation-context-components"/>.

By default, this function is deterministic. This means that repeated calls on the function with the same argument will return the same @@ -18206,11 +18213,7 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF] items that do not have any URI; or a URI collection might contain URIs that cannot be dereferenced to return any resource.

- -

Thus, some implementations might ensure that calling fn:uri-collection and then - applying fn:doc to each of the returned URIs delivers the same result as - calling fn:collection with the same argument; however, this is not - guaranteed.

+

In the case where fn:uri-collection returns the URIs of resources that could also be retrieved directly using fn:collection, there are several reasons why it @@ -18272,7 +18275,7 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF] deterministic - context-dependent + context-dependent focus-independent @@ -18283,8 +18286,12 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF]

The $source argument must be a string in the form of a URI reference, which must contain no fragment identifier, and must identify a resource for which a string representation is - available. If the URI is a relative URI reference, then it is resolved relative to the - static base URI property from the static context.

+ available.

+

If $source is a relative URI reference, it is resolved relative to the value + of the executable base URI property + from the dynamic context of the caller. The resulting absolute URI is + promoted to an xs:string.

+

The $options argument, for backwards compatibility reasons, may be supplied either as a map, or as a string. Supplying a value $S that is not a map is equivalent to supplying the map { "encoding": $S }. @@ -18317,7 +18324,7 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF]

The mapping of URIs to the string representation of a resource is the mapping defined in the available text resources component of the dynamic context.

If the $source argument is an empty sequence, the function @@ -18385,7 +18392,8 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF] -

If it is appropriate to use a base URI other than the dynamic base URI (for example, +

If it is appropriate to use a base URI other than the + executable base URI (for example, when resolving a relative URI reference read from a source document) then it is advisable to resolve the relative URI reference using the fn:resolve-uri function before passing it to the fn:unparsed-text function.

@@ -18413,6 +18421,10 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF]

The handling of media types is implementation-defined.

+ +

Implementations may provide user options that relax the requirement for the function + to return deterministic results.

+

Implementations may provide user-defined error handling options that allow @@ -18420,11 +18432,7 @@ return tokenize(normalize-space($s), ' ')[. castable as xs:IDREF] its content. When errors have been handled in this way, the function may return a fallback document provided by the error handler.

- -

For backwards compatibility reasons, implementations may provide - configuration options that alter the default for the deterministic - option.

-
+

The rules for determining the encoding are chosen for consistency with deterministic - context-dependent + context-dependent focus-independent @@ -18548,6 +18556,7 @@ return $lines[not(position() = last() and . = '')] + @@ -18557,7 +18566,7 @@ return $lines[not(position() = last() and . = '')] deterministic - context-dependent + context-dependent focus-independent @@ -18617,6 +18626,176 @@ return $lines[not(position() = last() and . = '')] + + + + + + + + + + deterministic + context-dependent + focus-independent + + +

The fn:binary-resource function reads an external resource (for example, a + file) and returns its contents in binary.

+
+ +

The $source argument must be a string in the form of a URI + reference, which must contain no fragment identifier, and + must identify a resource for which a binary representation is + available.

+ +

If $source is a relative URI reference, it is resolved relative to the value + of the executable base URI property + from the dynamic context of the caller. The resulting absolute URI is + promoted to an xs:string.

+ + + + + +

The mapping of URIs to the string representation of a resource is the mapping defined in + the available text + resources component of the dynamic context.

+

If the $source argument is an empty sequence, the function + returns an empty sequence.

+ +

The result of the function is an atomic item of type xs:base64Binary + containing the binary representation of the + resource retrieved using the URI.

+ + + +
+ +

A dynamic error is raised if the $source argument + contains a fragment identifier, or if it cannot be resolved + to an absolute URI (for example, because the base-URI property in the static context is absent), + or if it cannot be used to retrieve the binary + representation of a resource.

+ +
+ + +

If it is appropriate to use a base URI other than the + executable base URI (for example, + when resolving a relative URI reference read from a source document) then it is + advisable to resolve the relative URI reference using the fn:resolve-uri + function before passing it to the fn:unparsed-text function.

+

There is no essential relationship between the sets of URIs accepted by the + function fn:binary-resource and other functions such as + fn:doc and fn:unparsed-text (a URI accepted by one + may or may not be accepted by the others), and if a URI is accepted by more than + one of these functions then there is no + essential relationship between the results (different resource representations are + permitted by the architecture of the web).

+

There are no constraints on the MIME type of the resource.

+ + +

The fact that the resolution of URIs is defined by a mapping in the dynamic context + means that in effect, various aspects of the behavior of this function are implementation-defined. Implementations may provide external configuration + options that allow any aspect of the processing to be controlled by the user. In + particular:

+ + +

The set of URI schemes that the implementation recognizes is + implementation-defined. Implementations may allow the mapping of URIs to resources + to be configured by the user, using mechanisms such as catalogs or user-written + URI handlers.

+
+ +

The handling of media types is implementation-defined.

+
+ +

Implementations may provide user options that relax the requirement for the function + to return deterministic results.

+
+ + +

Implementations may provide user-defined error handling options that allow + processing to continue following an error in retrieving a resource, or in reading + its content. When errors have been handled in this way, the function may return a + fallback document provided by the error handler.

+
+ +
+ +

The rules for determining the encoding are chosen for consistency with . Files with an XML media type are treated specially because there + are use cases for this function where the retrieved text is to be included as unparsed + XML within a CDATA section of a containing document, and because processors are likely + to be able to reuse the code that performs encoding detection for XML external + entities.

+

If the text file contains characters such as < and &, + these will typically be output as &lt; and &amp; if + the string is serialized as XML or HTML. If these characters actually represent markup + (for example, if the text file contains HTML), then an XSLT stylesheet can attempt to + write them as markup to the output file using the disable-output-escaping + attribute of the xsl:value-of instruction. Note, however, that XSLT + implementations are not required to support this feature.

+

There is no function (analogous to fn:doc-available or fn:unparsed-text-available) + to determine whether a suitable resource is available. In XQuery and XSLT, try/catch + constructs are available to catch the error.

+

The choice of xs:base64Binary rather than xs:hexBinary for the + result is arbitrary. The two types have the same value space and are interchangeable for nearly + all purposes, the notable exception being conversion to xs:string.

+

A comprehensive set of functions for manipulating binary data is available in the + EXPath binary module: see . In addition, the EXPath file module + provides a function file:read-binary with similar functionality to + fn:binary-resource, the notable differences being (a) that it takes + a file name rather than a URI, and (b) that it is defined to be nondeterministic. +

+
+ + + + + + + +

The following XQuery, adapted from an example in the EXPath binary module , + reads a JPEG image and determines its size in pixels:

+ + + +

The example assumes that the functions in the EXPath binary module are available.

+
+
+ + +

New in 4.0

+
+
+ + + + @@ -18632,7 +18811,7 @@ return $lines[not(position() = last() and . = '')]

Returns the value of a system environment variable, if it exists.

-

The set of available The set of available environment variables is a set of (name, value) pairs forming part of the dynamic context, in which the name is unique within the set of pairs. The name and value are @@ -18883,7 +19062,7 @@ return $lines[not(position() = last() and . = '')] nondeterministic - context-dependent + context-dependent focus-independent @@ -19035,7 +19214,7 @@ return $lines[not(position() = last() and . = '')] nondeterministic - context-dependent + context-dependent focus-independent @@ -19943,7 +20122,7 @@ serialize(

Returns the context position from the dynamic context.

-

Returns the context position from the dynamic context. (See Returns the context position from the dynamic context. (See .)

@@ -19967,7 +20146,7 @@ serialize(

Returns the context size from the dynamic context.

-

Returns the context size from the dynamic context. (See Returns the context size from the dynamic context. (See .)

@@ -20003,7 +20182,7 @@ serialize(

Returns the current dateTime (with timezone) from the dynamic context. (See .) This is an xs:dateTime that is current at some time during the evaluation of a query or transformation in which fn:current-dateTime is executed.

@@ -20111,7 +20290,7 @@ serialize(

Returns the value of the implicit timezone property from the dynamic context. Components of the dynamic context are described in .

+ spec="XP40" ref="id-xp-evaluation-context-components"/>.

@@ -20160,7 +20339,7 @@ serialize(

Returns the value of the default language property from the dynamic context. Components of the dynamic context are described in .

+ spec="XP40" ref="eval_context"/>.

The default language property can never be absent. The functions fn:format-integer, @@ -20175,7 +20354,7 @@ serialize( deterministic - context-dependent + context-dependent focus-independent @@ -24715,7 +24894,7 @@ return $M(collation-key("a", $C)) nondeterministic - context-dependent + context-dependent focus-independent @@ -24943,7 +25122,8 @@ return $M(collation-key("a", $C)) >implementation-dependent whether the same node is returned on both occasions.

-

The base URI of the returned document node is taken from the static base URI of the +

The base URI of the returned document node is taken from the + executable base URI of the function call.

The choice of namespace prefix (or absence of a prefix) in the names of constructed @@ -26301,7 +26481,7 @@ return csv-to-arrays( deterministic - context-dependent + context-dependent focus-independent @@ -27032,7 +27212,7 @@ return { deterministic - context-dependent + context-dependent focus-independent @@ -29509,7 +29689,8 @@ declare function array:flatten( The content of the query module as a string. When this option is used, the location-hints option is ignored. The static base URI of the dynamically loaded - module is the same as the static base URI of the caller. + module is the same as the executable base URI + of the caller. xs:string? Empty sequence @@ -29982,7 +30163,9 @@ return $variables(QName("http://example.com/dyn", "value"))1.0, 2.0, 3.0 The URI of the principal result document; also used as the base URI for resolving relative URIs of secondary result documents. If the value is a relative - reference, it is resolved against the static base URI of the fn:transform + reference, it is resolved against the + executable base URI + of the fn:transform function call. xs:string @@ -30249,14 +30432,16 @@ return $variables(QName("http://example.com/dyn", "value"))implementation-defined whether this parameter has any effect. If the value is a relative reference, it is resolved against - the static base URI of the fn:transform function call. + the executable base URI + of the fn:transform function call. xs:string n/a 1.0, 2.0, 3.0 URI that can be used to locate the principal stylesheet module. If relative, it - is resolved against the static base URI of the fn:transform function call. + is resolved against the executable base URI + of the fn:transform function call. The value also acts as the default for stylesheet-base-uri. xs:string n/a diff --git a/specifications/xpath-functions-40/src/xpath-functions.xml b/specifications/xpath-functions-40/src/xpath-functions.xml index 73e77229c2..0caef1c61a 100644 --- a/specifications/xpath-functions-40/src/xpath-functions.xml +++ b/specifications/xpath-functions-40/src/xpath-functions.xml @@ -5737,6 +5737,9 @@ correctly in all browsers, depending on the system configuration.

--> + + + diff --git a/specifications/xquery-40/src/expressions.xml b/specifications/xquery-40/src/expressions.xml index 64c0141948..662cfe8c20 100644 --- a/specifications/xquery-40/src/expressions.xml +++ b/specifications/xquery-40/src/expressions.xml @@ -1646,6 +1646,16 @@ comparison or arithmetic operation. The implicit timezone is an fn:unparsed-text function when applied to that URI. The set of available text resources may be empty.

+ + +

+ + Available binary resources. + This is a mapping of strings to binary resources. Each string + represents the absolute URI of a resource. The resource is returned + by the fn:binary-resource function when applied to that + URI. The set of available binary resources may be empty.

+