diff --git a/specifications/xquery-40/src/expressions.xml b/specifications/xquery-40/src/expressions.xml index ca9a5cde2..11b12388e 100644 --- a/specifications/xquery-40/src/expressions.xml +++ b/specifications/xquery-40/src/expressions.xml @@ -3848,7 +3848,7 @@ the schema type named us:address.

xs:decimal value is expected, the value retains its type as xs:integer.

-

The definition of The definition of SequenceType matching relies on a pseudo-function named derives-from( AT, @@ -3910,7 +3910,7 @@ the schema type named us:address.

- + -->

The rules for SequenceType @@ -3970,6 +3970,36 @@ the schema type named us:address.

value that is an empty sequence.

+ + Schema Type Relationships + +

Some item types are defined in terms + of schema types, and the matching + rules for such item types depend on the rules defining relationships between + schema types in the XSD specification.

+ +

A + S1 is said to derive from + S2 if any of the following + conditions is true:

+ + +

S1 is the same type as S2.

+

S2 is the base type of S1.

+

S2 is a + of which S1 is a member type.

+

There is a M such that + S1 M + and M S2.

+
+

+ +

The XML Schema specification does not completely specify the circumstances + under which S1 and S2 are considered to be the same + type. For example, if both are anonymous union types with the same member types, + but defined in different places in the schema, then schema processors have + discretion whether to treat them as the same type.

+
Item Types @@ -4137,7 +4167,7 @@ the schema type named us:address.

An atomic item A matches the GAT if the type annotation of A - (call it T) satisfies the condition derives-from(T, GAT).

+ GAT.

Example: The ItemType xs:decimal matches any value of type @@ -4645,10 +4675,9 @@ declare variable $orange-fruit as my:fruit := "orange";

NT is an EQName equal to N.

-

If ET includes a TypeName, +

If ET includes a TypeName T, then the of the element node E - is either the schema type identified by that type name, or a type derived from that - type by restriction.

+ T.

If E has the nilled property, then ET either includes no TypeName, or includes a TypeName followed by the symbol ?.

@@ -4814,11 +4843,11 @@ matches any nilled or non-nilled element node whose type annotation is

Either:

-

The name N of the candidate node matches the specified The name N of the candidate node matches the specified ElementName, or

-

The name N of the candidate node matches the name of an element declaration that is a member of the actual substitution group headed by the declaration of element The name N of the candidate node matches the name of an element declaration that is a member of the actual substitution group headed by the declaration of element ElementName.

@@ -4827,21 +4856,31 @@ matches any nilled or non-nilled element node whose type annotation is

The term “actual substitution group” is defined in . The actual substitution group of an element declaration H includes those element declarations P that are declared to have H as their direct or indirect substitution group head, provided that P is not declared as abstract, and that P is validly substitutable for H, which means that there must be no blocking constraints that prevent substitution.

+ />. The actual substitution group of an element declaration + H includes those element declarations + P that are declared to have H as their + direct or indirect substitution group head, provided that + P is not declared as abstract, and that P + is validly substitutable for H, which means that + there must be no blocking constraints that prevent substitution.

-

The schema element declaration named N is not abstract.

+

The schema element declaration named N is not abstract.

-

- derives-from( AT, ET ) is true, where AT is the type annotation of the candidate node and ET is the schema type declared in the schema element declaration named N.

+

AT ET, + where AT is the type annotation of the candidate node + and ET is the schema type declared in the schema element + declaration named N.

-

If the schema element declaration named N is not nillable, then the nilled property of the candidate node is false.

+

If the schema element declaration named N + is not nillable, then the nilled property of the candidate node + is false.

@@ -4868,7 +4907,7 @@ in the following two situations: considerations apply:

-

In applying the test derives-from( AT, ET ), +

In applying the test AT derives-from ET, note that AT will necessarily be present in X, but not necessarily in Y. However, ET will necessarily be present in both; and because the two schemas @@ -4954,10 +4993,9 @@ in the following two situations:

NT is an EQName equal to N.

-

If AT includes a TypeName, +

If AT includes a TypeName T, then the of the attribute node A - is either the schema type identified by that type name, or a type derived from that - type by restriction.

+ T.

Here are some examples of AttributeTests: @@ -5099,10 +5137,9 @@ name.

-

- derives-from( - AT, ET - ) is true, where AT is the type annotation of the candidate node and ET is the schema type declared for attribute AT ET, + where AT is the type annotation of the candidate node and + ET is the schema type declared for attribute AttributeName in the in-scope attribute declarations.

@@ -6206,8 +6243,7 @@ declare record Particle (

A and B are generalized atomic types, - and derives-from(A, B) returns true.

-

The derives-from relationship is defined in .

+ and A B.

Examples: @@ -6357,10 +6393,10 @@ declare record Particle (

All the following are true:

-

A is element(A/n, A/t)

-

B is element(B/n, B/t)

-

A/n B/n

-

derives-from(A/t, B/t).

+

A is element(A/n, A/t).

+

B is element(B/n, B/t).

+

A/n B/n.

+

A/t B/t.

Examples: @@ -6381,7 +6417,7 @@ declare record Particle ( element(A/n, A/t?)

B is element(B/n, B/t?)

A/n B/n

-

derives-from(A/t, B/t).

+

A/t B/t.

Examples: @@ -6394,25 +6430,7 @@ declare record Particle (
- -

All the following are true:

@@ -6490,8 +6508,7 @@ declare record Particle (

A is attribute(A/n, A/t)

B is attribute(B/n, B/t)

A/n B/n

- -

derives-from(A/t, B/t).

+

A/t B/t.

@@ -6507,15 +6524,7 @@ declare record Particle (
- +

All the following are true: