diff --git a/specifications/grammar-40/xpath-grammar.xml b/specifications/grammar-40/xpath-grammar.xml index a44c2aa95..59b1c9e89 100644 --- a/specifications/grammar-40/xpath-grammar.xml +++ b/specifications/grammar-40/xpath-grammar.xml @@ -596,7 +596,7 @@ VersionDecl ::= "xquery" (("encoding" StringLiteral) | ("version" StringLiteral - + @@ -762,12 +762,12 @@ VersionDecl ::= "xquery" (("encoding" StringLiteral) | ("version" StringLiteral - + record diff --git a/specifications/xquery-40/src/errors.xml b/specifications/xquery-40/src/errors.xml index 50230945f..74ae82734 100644 --- a/specifications/xquery-40/src/errors.xml +++ b/specifications/xquery-40/src/errors.xml @@ -420,8 +420,8 @@

It is a static error if an used as an in a is not defined - in the either as a - in the , + in the either as a + in the , or as a in the .

diff --git a/specifications/xquery-40/src/expressions.xml b/specifications/xquery-40/src/expressions.xml index ca9a5cde2..b4c0c8b38 100644 --- a/specifications/xquery-40/src/expressions.xml +++ b/specifications/xquery-40/src/expressions.xml @@ -765,30 +765,32 @@ inferred by static type inference as discussed in +

- - In-scope named item types. This is a mapping from + + In-scope named record types. This is a mapping from expanded QName to - named item types.

-

A named item type - is an ItemType identified by an . + record types.

+

A named record type + is a RecordType identified by an .

-

Named item types serve two purposes:

+

Named record types serve two purposes:

-

They allow frequently used item types, especially complex item types such as - record types, to be given simple names, to avoid repeating the definition +

They allow frequently used record types + to be given simple names, to avoid repeating the definition every time it is used.

They allow the definition of recursive types, which are useful for describing recursive data structures such as lists and trees. For details see .

-

In XQuery, named item types can be declared in the Query Prolog.

-

Named item types can be defined in a host language +

In XQuery, named record types can be declared in the Query Prolog.

+

Named record types can be defined in a host language such as XQuery 4.0 and in XSLT 4.0, but not in XPath 4.0 itself. They are available in XPath only if the host language provides the ability to define them.

+

Certain named record types defined in + are always present in the static context.

@@ -4032,9 +4034,9 @@ the schema type named us:address.

in the . If the name is an unprefixed NCName, then it is expanded according to the .

-

If the name matches a in the , - then it is taken as a reference to the corresponding item type. The rules that - apply are the rules for the expanded item type definition.

+

If the name matches a in the , + then it is taken as a reference to the corresponding record type. The rules that + apply are the rules for the expanded record type definition.

Otherwise, it must match the name of a type in the in-scope schema types in the : specifically, an or a . @@ -4126,8 +4128,8 @@ the schema type named us:address.

Using the QName of a type in the that is an or a .

-

Using a QName that identifies a that resolves - to a .

+

Using a ChoiceItemType where every alternative is itself a .

@@ -4433,7 +4435,7 @@ declare variable $orange-fruit as my:fruit := "orange"; QName must identify a type in the . This can be any : either a simple type, or (except in the case of attributes) a complex type. If it is a simple type then it can be an atomic, union, or list type. It can be a built-in type (such as xs:integer) or a user-defined type. It must however - be the name of a type defined in a schema; it cannot be a .

+ be the name of a type defined in a schema; it cannot be a .

Simple Node Tests @@ -5128,7 +5130,7 @@ name.

of .

- Function Type + Function Types The keyword fn is allowed as a synonym for function in function types, to align with changes to inline function declarations. @@ -5279,7 +5281,7 @@ name.

- Map Type + Map Types @@ -5456,7 +5458,7 @@ name.

- Record Type + Record Types @@ -5470,17 +5472,28 @@ name.

The syntax record() is allowed; the only thing it matches is an empty map.
+ +

A record type is an + that places constraints on the entries that may appear in a + . Specifically, it may constrain the key values that can appear + in a map, and the types of the values associated with those keys.

+ +

A may be defined using the following syntax:

+ - - + +

The RecordType syntax shown here is not the only way + of designating a . For example, XSLT and XQuery provide additional + ways of designating record types; and some record types are supplied as built-in type definitions + in .

A RecordType matches maps that meet specific criteria.

@@ -5506,7 +5519,7 @@ name.

map(*): that is, it allows any map.

-

A record type can constrain only those entries whose keys are strings, but when the record +

A can constrain only those entries whose keys are strings, but when the record type is marked as extensible, then other entries may be present in the map with either string or non-string keys. Entries whose key is a string can be expressed using an (unquoted) NCName if the key conforms to NCName syntax, or using a (quoted) string literal otherwise.

@@ -5537,7 +5550,8 @@ name.

documentary value.

-

The names of the fields in a record type must be distinct .

+

The names of the fields in a + must be distinct .

@@ -5551,7 +5565,7 @@ name.

execution.

If a variable $rec is known to conform to a particular - record type, then when a lookup expression $rec?field is used, (a) the processor + , then when a lookup expression $rec?field is used, (a) the processor can report a type error if $rec cannot contain an entry with name field (see ), and (b) the processor can make static type inferences about the type of value returned by @@ -5563,8 +5577,10 @@ name.

this is a useful technique where the information to be supplied across the interface is highly variable. However, the type signature for such functions typically declares the argument type as map(*), which gives very little information (and places very few constraints) - on the values that are actually passed across. Using record types offers the possibility of - improving this: for example, the options argument of fn:parse-json, previously + + on the values that are actually passed across. Using + record types offers the possibility of + improving this: for example, the options argument of fn:parse-json, previously given as map(*), can now be expressed as record(liberal? as xs:boolean, duplicates? as xs:string, escape? as xs:boolean, fallback as fn(xs:string) as xs:string, *). In principle the xs:string type used to describe the duplicates @@ -5572,7 +5588,7 @@ name.

of xs:string that enumerates the permitted values ("reject", "use-first", "use-last").

-

The use of a record type in the signature of such a function causes the +

The use of a in the signature of such a function causes the coercion rules to be invoked. So, for example, if the function expects an entry in the map to be an xs:double value, it becomes possible to supply a map in which the corresponding entry has type xs:integer.

@@ -5582,7 +5598,8 @@ name.

-

One of the motivations for introducing record types is to enable better pattern matching +

One of the motivations for introducing record types + is to enable better pattern matching in XSLT when processing JSON input. With XML input, patterns are often based around XML element names. JSON has no direct equivalent of XML’s element names; matching a JSON object such as {longitude: 130.2, latitude: 53.4} relies instead on recognizing the property @@ -5591,7 +5608,7 @@ name.

match="record(longitude, latitude)"

-

Rules defining whether one record type is a of another +

Rules defining whether one is a of another are given in .

@@ -5599,7 +5616,7 @@ name.

Recursive Record Types -

A named record type N is said to be recursive if its +

A named N is said to be recursive if its definition includes a direct or indirect reference to N.

@@ -5618,13 +5635,14 @@ name.

-

Instances of recursive record types can be constructed and interrogated in the normal way. +

Instances of recursive record types + can be constructed and interrogated in the normal way. For example a list of length 3 can be constructed as:

{ "value": 1, "next": { "value": 2, "next": { "value": 3 } } }

and the third value in the map can be retrieved as $list?next?next?value. In practice, recursive data structures are usually manipulated using recursive functions.

-

It is possible to define a recursive record type that cannot be instantiated, because it +

It is possible to define a recursive that cannot be instantiated, because it has no finite instances: for example (in XQuery) declare record X (next as X);. Such a record declaration is , so the processor may treat it as an error , but it is not obliged to do so.

@@ -5633,7 +5651,7 @@ name.

specification of the function fn:random-number-generator.

Recursive type definitions need to be handled specially by the subtyping rules; - a naïve approach of simply replacing each reference to a named item type + a naïve approach of simply replacing each reference to a named record type with its definition would make the assessment of the subtype relationship non-terminating. For details see .

@@ -6128,17 +6146,14 @@ declare record Particle (

The rules in this section apply to item types, not to item type designators. - For example, if the name STR has been defined in the - static context as a referring to the type xs:string, - then anything said here about the type xs:string applies equally - whether it is designated as xs:string or as STR, - or indeed as the parenthesized forms (xs:string) or - (STR).

+ For example, the parenthesized name (xs:string) designates the + same type as xs:string, and anything said here about one form + applies equally to the other.

-

References to named item types - are handled as described in .

+

The relationship A ⊆ B is true if and only if at least one of the conditions listed in the following subsections applies:

@@ -6760,7 +6775,7 @@ declare record Particle (

All of the following are true:

-

A is a record type.

+

A is a .

B is map(*) or record(*).

@@ -6774,7 +6789,7 @@ declare record Particle (

All of the following are true:

-

A is a non-extensible record type

+

A is a non-extensible

B is map(K, V)

K is either xs:string or xs:anyAtomicType

For every field F in A, @@ -6793,8 +6808,8 @@ declare record Particle (

All of the following are true:

-

A is a non-extensible record type.

-

B is a non-extensible record type.

+

A is a non-extensible .

+

B is a non-extensible .

Every field in A is also declared in B.

Every mandatory field in B is also declared as mandatory in A.

For every field that is declared in both A and B, @@ -6814,8 +6829,8 @@ declare record Particle (

All of the following are true:

-

A is an extensible record type

-

B is an extensible record type

+

A is an extensible .

+

B is an extensible .

Every mandatory field in B is also declared as mandatory in A.

For every field that is declared in both A and B, where the declared type in A is T @@ -6839,8 +6854,8 @@ declare record Particle (

All of the following are true:

-

A is a non-extensible record type.

-

B is an extensible record type.

+

A is a non-extensible .

+

B is an extensible .

Every mandatory field in B is also declared as mandatory in A.

@@ -6862,18 +6877,16 @@ declare record Particle (
- Named Item Types -

This section describes how references to named item types + Named Record Types +

This section describes how references to named record types are handled when evaluating the subtype relationship.

-

Named item types can be classified as recursive or non-recursive. - A recursive type is one that references itself, directly or indirectly. Only named record - types are allowed to be recursive.

-

In the case of references to non-recursive named item types, the reference - is fully expanded as the first step in evaluating the subtype relationship. For example - this means that if U is a named item type with the expansion - (xs:integer | xs:double), - then xs:integer ⊆ U is true, because - xs:integer ⊆ (xs:integer | xs:double) is true.

+

Named record types can be classified as recursive or non-recursive. + A recursive type is one that references itself, directly or indirectly.

+

In the case of references to non-recursive named record types, the reference + can be fully expanded as the first step in evaluating the subtype relationship. For example + this means that if U is a named record type with the expansion + record(first as xs:string, *), + then record(first as xs:string, last as xs:string) ⊆ U is true.

Recursive record types are considered to be, in the terminology of the computer science literature, iso-recursive (rather than equi-recursive). This means that a recursive type name is not @@ -6889,13 +6902,13 @@ declare record Particle ( AB is true if and only if A and B are references to the same named record type.

-

If A is a reference to a recursive named item type, then +

If A is a reference to a recursive record type, then AB is true if either:

A and B are references to the same named record type.

record(*) ⊆ B.

-

This is because only record types are allowed to be recursive.

+
@@ -21639,9 +21652,9 @@ atomized value of the input expression is called the input type. The target type must be a . In practice this means it may be any of:

-

The name of an named item type +

The name of a type defined in the in-scope schema types, which must be a simple type (of variety atomic, list or union) . In addition, the target type cannot be xs:NOTATION, xs:anySimpleType, @@ -21821,11 +21834,8 @@ else $x cast as xs:string]]> and can be found in .

-

There is also a constructor function for every - in the - that expands either to a - or to - a RecordType.

+

There is also a constructor function for every + in the .

All such constructor functions are classified as system functions.

@@ -21896,14 +21906,14 @@ expression .

- + -

If my:location is a named item type that expands +

If my:location is a named record type that expands to record(latitude as xs:double, longitude as xs:double), then the result of my:location(50.52, -3.02) is the map { 'latitude': 50.52e0, 'longitude': -3.02e0 }.

diff --git a/specifications/xquery-40/src/query-prolog.xml b/specifications/xquery-40/src/query-prolog.xml index d1f69d230..006e352a4 100644 --- a/specifications/xquery-40/src/query-prolog.xml +++ b/specifications/xquery-40/src/query-prolog.xml @@ -698,11 +698,11 @@ return (

A module import imports the public variable declarations, public function declarations, - and public item type declarations from one or more from one or more library modules into the , in-scope variables, - or of the importing of the importing module. Each module import names a target namespace and imports an implementation-defined set of modules that share @@ -711,23 +711,31 @@ return ( namespaces, and it may provide optional hints for locating the modules to be imported.

-

If a module A imports module B, the static context of module +

If a module A imports module B, then:

+ + +

The static context of module A will contain the , in-scope variables, - or of - module B, and the dynamic context of module A will contain the - public variable values and of module B. It will - not contain:

- - -

Private functions, variables, and item types declared in B.

+ def="dt-in-scope-variables">in-scope variables
, + and of + module B (including constructor functions associated with + )

+

The static context of A will not contain:

+ +

Private functions, variables, and record types declared in B.

Functions, variables, and item types not declared directly in B, but imported from some other library module.

Other components such as in-scope schema definitions or statically known namespaces declared in B.

+ +
+

The dynamic context of module A will contain the + public variable values and of module B.

+ +

The following example illustrates a module import:

@@ -774,8 +782,15 @@ return ( module A does not have access to the functions and variables declared in module C.

- - +

A module may import public variable and function declarations that are defined using named record types + which are not themselves imported, either because the type definitions are private, or because they are defined + in a module that is not itself imported. In such a case the importing module may reference the variable + or function in question, but it cannot reference the named record type used in the declaration of the + variable or function.

+ +

Similarly, a module may import public variable and function declarations that are defined using + schema types that are not themselves imported.

+ Schema Information and Module Import @@ -848,8 +863,8 @@ $triangle

If one module contains an import module declaration with the target namespace M, then all public variables and public functions in the contexts of modules whose target namespace is M must be accessible in the importing module, - regardless whether the participation of the imported module was directly due to this "import - module" declaration.

+ regardless whether the participation of the imported module was directly due to this import + module declaration.

@@ -857,7 +872,7 @@ $triangle Location URIs -

The term “location URIs” refers to the URIs in the at clause of an +

The term location URIs refers to the URIs in the at clause of an import module declaration.

Products should (by default or at user option) take account of all the location URIs in an @@ -1937,7 +1952,7 @@ local:depth(doc("partlist.xml")) - + Named Record Types -

Although item type declarations, as described in , can be - used to give names to record types as well as any other item type, named record types as described - in this section provide a more concise syntax, plus additional functionality. In particular:

+

A record type declaration defines a name representing a . + Defining a name for a record type + allows it to be referenced by name rather than repeating + the in full.

+ +

Named record types also introduce additional capability beyond anonymous record types:

Named record types can be recursive.

@@ -2056,12 +2074,11 @@ local:depth(doc("partlist.xml")) -

A named record declaration serves as both a and as a - , and - it therefore inherits rules from both these roles. In particular:

+

The name appearing in a record declaration serves as both an item type and as a + function name, and it therefore inherits rules from both these roles. In particular:

-

Its name must not be the same as the name of any other named item type, or any +

Its name must not be the same as the name of any other , or any generalized atomic type, that is present in the same static context .

If the declaration appears within a then its name must be in the of the library module . @@ -2088,13 +2105,14 @@ local:depth(doc("partlist.xml")) Named Records as Item Types -

As a named item type declaration, the construct:

+

Given the record type declaration:

declare record cx:complex(r as xs:double, i as xs:double := 0); -

is equivalent to:

+

it becomes possible to use the name cx:complex effectively as a synonym for the + item type:

- declare type cx:complex as record(r as xs:double, i as xs:double); + record(r as xs:double, i as xs:double)

Any initializing expressions for fields are ignored for this purpose.

@@ -2103,14 +2121,14 @@ local:depth(doc("partlist.xml")) of the type, and it does not affect the result of retrieval operations such as the lookup operator.

-

There is however one significant difference: the name of a named record declaration is available throughout the static +

The name of a named record declaration is available throughout the static context of the module in which it is declared, including within the record declaration itself. This means that named record declarations can be self-recursive or mutually recursive.

-

Unlike a named item type declared using declare type, a reference to a named record type - cannot (in general) be directly replaced by the corresponding record definition during parsing. This is not only - because forwards references are allowed; it is also because a recursive record type cannot be expressed using - the usual syntax.

+

A reference to a named record type + cannot (in general) be directly replaced by the corresponding record definition during parsing. This is + because forwards references and self-references are allowed; replacing the name by the + definition is a process that might not terminate.

A recursive record type will only be instantiable if every field whose value may contain instances of the record type (directly or indirectly) is optional or emptiable. Specifically, it must either be an optional field, or its type diff --git a/specifications/xslt-40/src/element-catalog.xml b/specifications/xslt-40/src/element-catalog.xml index d3cb696cd..167f91556 100644 --- a/specifications/xslt-40/src/element-catalog.xml +++ b/specifications/xslt-40/src/element-catalog.xml @@ -94,7 +94,7 @@ - + @@ -120,7 +120,7 @@ - + @@ -835,25 +835,43 @@ - + - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/specifications/xslt-40/src/xslt.xml b/specifications/xslt-40/src/xslt.xml index bc7681d6e..7ac52856d 100644 --- a/specifications/xslt-40/src/xslt.xml +++ b/specifications/xslt-40/src/xslt.xml @@ -134,7 +134,7 @@ published on 8 June 2017. Changes are presented in .

XSLT 4.0 is designed to be used in conjunction with XPath 4.0, which is defined in . XSLT shares the same data model as XPath 4.0, which is - defined in , and it uses the library of functions and + defined in , and it uses the library of functions and operators defined in . XPath 4.0 and the underlying function library introduce a number of enhancements, for example the availability of union and record types.

@@ -178,7 +178,7 @@ HTML, XHTML, or SVG. However, XSLT is used for a wide range of transformation tasks, not exclusively for formatting and presentation applications.

A transformation expressed in XSLT describes rules for transforming input data into output data. The inputs and outputs - will all be instances of the XDM data model, described in . In the simplest and most common case, the input is + will all be instances of the XDM data model, described in . In the simplest and most common case, the input is an XML document referred to as the source document or source tree, and the output is an XML document referred to as the result tree. It is also possible to process multiple source documents, to generate multiple result documents, and to handle formats other than @@ -275,7 +275,7 @@ performs the functions of an XSLT processor is referred to as an implementation.

- The term tree is used (as in ) to refer to the aggregate consisting of a + The term tree is used (as in ) to refer to the aggregate consisting of a parentless node together with all its descendant nodes, plus all their attributes and namespaces.

@@ -294,14 +294,14 @@

A principal - result: this can be any sequence of items (as defined in ). The principal result is the value + result: this can be any sequence of items (as defined in ). The principal result is the value returned by the function or template in the stylesheet that is nominated as the entry point, as described in .

Zero or more secondary results: each secondary result can be any sequence - of items (as defined in ). A + of items (as defined in ). A secondary result is the value returned by evaluating the body of an xsl:result-document instruction.

@@ -396,7 +396,8 @@ that allow the user to influence the behavior.

A paragraph labeled as a Note or described as an example is non-normative.

-

Many terms used in this document are defined in the XPath specification or the XDM specification . +

Many terms used in this document are defined in the XPath specification + or the XDM specification . Particular attention is drawn to the following:

@@ -405,7 +406,7 @@ is defined in . It is a process that takes as input a sequence of items, and returns a sequence of atomic items, in which the nodes are replaced by their typed values as - defined in . + defined in . If the XPath 3.1 feature is implemented, then Arrays (see ) are atomized by atomizing their members, recursively. For some items (for example, elements with element-only @@ -3659,7 +3660,9 @@

The components which can be declared in one package and referenced in another are: functions, named templates, attribute sets, - modes, and global variables and parameters.

+ modes, global variables + and parameters, + and named record types

In addition, keys and accumulators are classified as named components because they can contain references to @@ -3721,7 +3724,9 @@

A component defined in one package can be overridden by a component in - another package, provided the signatures are type-compatible.

+ another package, provided the signatures are type-compatible. + This does not apply to named record types, + which cannot be overridden.

The author of a package can declare whether the components in the package @@ -3747,7 +3752,13 @@

The term component is used to refer to any of the following: a stylesheet function, a named - template, a mode, an accumulator, an attribute set, a key, global variable, or a mode.

+ template
, a mode, + an accumulator, + an attribute set, + a key, + a global variable, + a , + or a mode.

The symbolic identifier of a component is a @@ -4075,7 +4086,7 @@

The visibility of a named template, function, variable, attribute set, mode, - or named item type + or named record type declared within a package is the first of the following that applies, subject to consistency constraints which are defined below:

@@ -4198,6 +4209,14 @@ explicitly by name in an xsl:expose declaration.)

+ +

+ +

It is a static error if the + explicit exposed visibility of a + component is anything other than private or final.

+ +

@@ -4378,6 +4397,15 @@ (meaning all component kinds) and the names attribute is not a wildcard.

+ +

+ +

It is a static error if an + xsl:accept declaration attempts to set the + visibility of a + to anything other than final, private, or hidden.

+ +

In the absence of a matching xsl:override element (see @@ -4836,10 +4864,10 @@ -

Except where recursive types are involved, a named item type - (declared in an xsl:item-type declaration) is considered +

Except where recursive types are involved, a named record type + (declared in an xsl:record-type declaration) is considered identical to its expansion. With recursive types, the same type names must - be used. By implication, the named type must itself be declared or exposed + be used. By implication, the named record type must itself be declared or exposed with visibility="final".

@@ -5809,7 +5837,12 @@ Worked Example of a Library Package - + +

XSLT 4.0 provides built-in functions for parsing CSV files (for example + the functions parse-csv and csv-to-xml + that should not be confused with the functionality defined by this example. The + example pre-dates the XSLT 4.0 capabilities.

+
@@ -6527,9 +6560,6 @@ and version="1.0" otherwise.

xsl:include - - xsl:item-type - xsl:key @@ -6548,6 +6578,9 @@ and version="1.0" otherwise.

xsl:preserve-space + + xsl:record-type + xsl:strip-space @@ -10546,12 +10579,15 @@ and version="1.0" otherwise.

contains entries with keys "first" and "last".

-

type(complex) matches any value that is an instance of the item type declared in an xsl:item-type - declaration with name "complex"

+

type(my:complex) matches any value that is an instance of the + declared in an xsl:record-type + declaration with name my:complex

-

type(complex)[?i eq 0] matches any value that is an instance of the item type declared in an xsl:item-type - declaration with name "complex" and that is a map with an entry having key i and value zero.

+

type(my:complex)[?i eq 0] matches any value that is an instance of the + declared in an xsl:record-type + declaration with name my:complex and that is a map + with an entry having key i and value zero.

@@ -11118,26 +11154,30 @@ and version="1.0" otherwise.

- - Defining Named Item Types + + Defining Named Record Types - - Named item types can be declared using the new xsl:item-type - element. This is designed to avoid repeating lengthy type definitions (for example - function types and record types) every time they are used. [This feature was - present in the editor's draft presented to the WG when it started work.] + + Named record types can be declared using the new xsl:record-type + element. This is designed to avoid repeating lengthy type definitions; it also + allows recursive record types to be defined. - + + -

An xsl:item-type declaration associates a name with an item type, and allows the type - to be referenced by name throughout the stylesheet package.

+

An xsl:record-type declaration associates a name with a + , and allows the + record type to be referenced by name throughout the stylesheet package.

-

The following example declares a named item type for complex numbers, and uses it in a variable +

The following example declares a named record type for complex numbers, and uses it in a variable declaration and a function declaration.

- + + + + @@ -11147,48 +11187,75 @@ and version="1.0" otherwise.

]]>
-

Note how the item type declaration has implicitly declared a constructor function - cx:complex that can be used to create instances of the item type; +

Note how the record type declaration has implicitly declared a constructor function + cx:complex that can be used to create instances of the record type; details of this mechanism are at .

-

Using named item types makes the stylesheet more readable, and improves potential for change: a change + +

An xsl:record-type + declaration defines a named record type that may be referenced within any + SequenceType or ItemType within the containing stylesheet package, + for example in the as attributes of the declarations of functions, templates, + and global variables..

+ +

It is a + if the names of the fields in an xsl:record-type + declaration are not distinct.

+ +

In addition, the xsl:record-type declaration defines a constructor function + of the same name that is added to the static context. This imposes additional requirements:

+ + +

The name of the record type must be in a namespace.

+

The name of each field of the record type must be an xs:NCName.

+
+ +

Using named record types makes the stylesheet more readable, and improves potential for change: a change to the way complex numbers are implemented in this example is less likely to affect users of the function - library. However, named item types do not provide true encapsulation or information hiding; users of the + library. However, named record types do not provide true encapsulation or information hiding; users of the function library can still treat complex numbers as raw maps if they wish.

-

The xsl:item-type declaration adds an entry to the - + +

The xsl:record-type declaration adds an entry to the + component of the static context for XPath expressions, and also becomes available for use wherever XSLT allows an ItemType to appear.

-

The scope of a named item type is the in which it is declared. If it + +

The scope of a named record type is the in which it is declared. If it is declared with visibility="final" then it also becomes available for use in using - packages. Named item types cannot be overridden in a using package, so the only permitted values for + packages. Named record types cannot be overridden in a using package, so the only permitted values for visibility are private and final.

-

The name of the item type is the expanded name formed by resolving the name attribute. + +

The name of the record type is the expanded name formed by resolving the name attribute. A lexical QName with no prefix is treated as a no-namespace name.

-

If two xsl:item-type declarations in a have the same + +

If two xsl:record-type declarations in a have the same name, then the one with higher is used.

It is a static error if a package contains two - xsl:item-type + xsl:record-type declarations having the same import precedence, unless there is another definition of the same - item type with higher import precedence.

+ record type with higher import precedence.

-

An item type declaration may refer directly or indirectly to itself if - it satisfies the conditions defined in . + +

A record type declaration may refer directly or indirectly to itself. This allows types to be declared that match recursive data structures such as linked lists and trees.

-

+ +

A named record type with visibility private may be used in the definition of + a component (such as a variable, a function, a template, or another named record type) that is itself + public. Another package may reference such a component even though it cannot reference + the types used in its definition.

+ + +
+ Defining a Decimal Format @@ -12690,11 +12757,15 @@ and version="1.0" otherwise.

]

The following template rules are used. The setting expand-text="yes" is assumed:

+ + + + + - +

Christmas Book Selection

@@ -12710,7 +12781,7 @@ and version="1.0" otherwise.

- + {?Title} {?Authors?* => string-join(", ")} @@ -17730,7 +17801,7 @@ and version="1.0" otherwise.

Absent - In-scope named item types + In-scope named record types None