diff --git a/specifications/xpath-functions-40/src/function-catalog.xml b/specifications/xpath-functions-40/src/function-catalog.xml index 65d93e7db..9a86413a2 100644 --- a/specifications/xpath-functions-40/src/function-catalog.xml +++ b/specifications/xpath-functions-40/src/function-catalog.xml @@ -25523,6 +25523,14 @@ return json-to-xml($json, $options)]]> "record", "sequence", "mixed", "xml")) map{} + + A list of layouts that will not be used for elements unless they are + selected explicitly. (Note that mixed and xml + layout cannot be disabled.) + enum("empty", "empty-plus", "simple", "simple-plus", "list", "list-plus", + "record", "sequence")* + () + diff --git a/specifications/xpath-functions-40/src/xpath-functions.xml b/specifications/xpath-functions-40/src/xpath-functions.xml index b30a992b6..61db7a862 100644 --- a/specifications/xpath-functions-40/src/xpath-functions.xml +++ b/specifications/xpath-functions-40/src/xpath-functions.xml @@ -7842,12 +7842,13 @@ return

If the uniform option is set to true, then the same layout will be used for all elements with a given name. This means that all elements need to be - examined before any element is converted. The layout chosen is the first one (in the order of - presentation in the following sections) whose match predicate matches every element with - the relevant name.

+ examined before any element is converted.

+

It is possible to disable some of the layouts so they will never be chosen by the automatic rules, + but only when explicitly selected.

+

The advantage of using schema information is that it gives a consistent representation for all elements of a particular type, even if they vary in content: for example if an element type allows optional attributes, the JSON representation will be consistent between those elements that have attributes and those @@ -7870,15 +7871,7 @@ return

on the layout chosen for its parent element..

The fn:elements-to-maps function produces maps as its result, but it is convenient to illustrate the form of the map by showing the effect of serializing the map as JSON.

- +

Mapping rules: The rules for mapping the XML element to an XDM map representation.

Mapping for nilled elements: special rules that apply to an @@ -8678,13 +8671,20 @@ return

If an explicit layout is given for the element name of $E in the options argument of the fn:elements-to-maps function call, then that layout is used.

+

Let $elements be the value of the first argument to the fn:elements-to-maps function call.

+ +

A layout is said to be disabled if its name is listed in the disable-layouts + option.

+

If the uniform option is true, then let $EE be the set of all elements with the same name as $E, specifically $elements/descendant-or-self::*[node-name(.) eq node-name($E)].

If the uniform option is false, then let $EE be $E.

+

Let T be the type identified by the type annotation of $E.

+

If T is xs:untyped or xs:anyType, then:

@@ -8692,16 +8692,20 @@ return
are no child elements or text nodes) then:

If empty($EE/@*) (that is, if there - are no attributes) then empty: see .

-

Otherwise empty-plus: see .

+ are no attributes) and if empty layout is not disabled, + then empty: see .

+

Otherwise, if empty-plus layout is not disabled, + then empty-plus: see .

If empty($EE/*) (that is, if there are no child elements) then:

If empty($EE/@*) (that is, if there - are no attributes) then simple: see .

-

Otherwise simple-plus: see .

+ are no attributes), and if simple layout is not disabled, + then simple: see .

+

Otherwise, if simple-plus layout is not disabled, + then simple-plus: see .

@@ -8714,22 +8718,26 @@ return
elements), then:

If empty($EE/@*) (that is, if there - are no attributes) then list: see .

-

Otherwise list-plus: see .

+ are no attributes), and if list layout is not disabled, + then list: see .

+

Otherwise, if list-plus layout is not disabled, + then list-plus: see .

If every $e in $EE satisfies all-different($e/*/node-name()) (that is, the child elements are uniquely named among their siblings), + and if record layout is not disabled, then record: see .

-

Otherwise, sequence: : see .

+

Otherwise, if sequence layout is not disabled, + then sequence: see .

-

Otherwise, mixed: : see .

+

Otherwise, mixed: see .

@@ -8767,10 +8775,12 @@ return

If T is a simple type:

-

If zeroLength(T), then empty: see .

+

If zeroLength(T), and if empty layout is + not disabled, then empty: see .

-

Otherwise, simple: see .

+

Otherwise, if simple layout is not disabled, then + simple: see .

@@ -8785,8 +8795,10 @@ return

If T.{content type}.{variety} = empty, then:

-

If $noAttributes then empty: see .

-

Otherwise, empty-plus: see .

+

If $noAttributes and if empty layout is not disabled, + then empty: see .

+

Otherwise, if empty-plus layout is not disabled, + then empty-plus: see .

@@ -8799,15 +8811,19 @@ return

If zeroLength(ST), then:

-

If $noAttributes then empty: see .

-

Otherwise, empty-plus: see .

+

If $noAttributes and if empty layout is + not disabled, then empty: see .

+

Otherwise, if empty-plus layout is not disabled, + then empty-plus: see .

Otherwise:

-

If $noAttributes then simple: see .

-

Otherwise, simple-plus: see .

+

If $noAttributes and if simple layout + is not disabled, then simple: see .

+

Otherwise, if simple-plus layout is not disabled, + then simple-plus: see .

@@ -8831,21 +8847,26 @@ return

If $noWildcards is true, and if $childCardinalities contains a single entry, and that entry has a cardinality greater than one, then:

-

If $noAttributes, then list: see .

-

Otherwise, list-plus: see .

+

If $noAttributes, and if list layout + is not disabled, then list: see .

+

Otherwise, if list-plus layout is not disabled, + then list-plus: see .

If $noWildcards is true, and if every entry in $childCardinalities - has a cardinality of one, then record: see .

+ has a cardinality of one, and if record layout is not disabled, + then record: see .

-

Otherwise, sequence: see .

+

Otherwise, if sequence layout is not disabled, + then sequence: see .

-

Otherwise (when T.{content type}.{variety} = mixed), then mixed: see .

+

Otherwise (that is, when T.{content type}.{variety} = mixed, or when all other + applicable layouts have been disabled), then mixed: see .