@@ -15842,7 +15842,9 @@ encountered in finding the effective boolean value of its operand,
1584215842 <div2 id="id-constructors">
1584315843 <head>Node Constructors</head>
1584415844 <changes>
15845- <change issue="2427">Computed node constructors are now available in XPath as well as XQuery.</change>
15845+ <change issue="2427" PR="2446" date="2026-02-07">
15846+ Computed node constructors are now available in XPath as well as XQuery.
15847+ </change>
1584615848 </changes>
1584715849
1584815850 <p>&language; provides node constructors that can create XML nodes within a query.</p>
@@ -15863,7 +15865,8 @@ encountered in finding the effective boolean value of its operand,
1586315865 <head>Constructing Complex Content</head>
1586415866 <p>The rules in this section are invoked when constructing document and element nodes.</p>
1586515867 <p>The result of evaluating the content expression of a computed document or
15866- element constructor (called the <term>content sequence</term>) is processed as follows: </p>
15868+ element constructor (called the <term>content sequence</term>) is processed by applying the following
15869+ steps, in order: </p>
1586715870
1586815871 <olist>
1586915872 <item>
@@ -15872,20 +15875,22 @@ encountered in finding the effective boolean value of its operand,
1587215875 </item>
1587315876
1587415877 <item>
15875- <p>If the content sequence contains a <termref def="dt-function-item"/>, a type error is raised <errorref
15878+ <p>If the content sequence contains a <termref def="dt-function-item"/>
15879+ (including a <termref def="dt-map"/>), a type error is raised <errorref
1587615880 class="TY" code="0105"/>.</p>
1587715881 </item>
1587815882
1587915883 <item>
15880- <p>For eachsequence of one or more adjacent atomic items in the content sequence,
15884+ <p>For each sequence of one or more adjacent <termref def="dt-atomic-item">atomic items</termref>
15885+ in the content sequence,
1588115886 a new text node is constructed, containing the result of casting each atomic item to a
1588215887 string, with a single <char>U+0020</char> character inserted between adjacent values.</p>
1588315888 <note>
1588415889 <p>The insertion of space characters between adjacent values applies even if one
1588515890 or both of the values is a zero-length string.</p>
1588615891 </note>
1588715892 </item>
15888-
15893+
1588915894 <item>
1589015895 <p>For each node in the content sequence, a new copy is made of the
1589115896 given node and all nodes that have the given node as an ancestor,
@@ -15901,20 +15906,27 @@ encountered in finding the effective boolean value of its operand,
1590115906 <item>
1590215907 <p>The <code>parent</code>, <code>children</code>, and <code>attributes</code>
1590315908 properties of the copied nodes are set so as to preserve their inter-node
15904- relationships. For the topmost node (the node directly returned by the
15905- enclosed expression), the <code>parent</code> property is set to
15909+ relationships. For the topmost node (the node directly present in the content sequence),
15910+ the <code>parent</code> property is set to
1590615911 the node being constructed by this constructor.</p>
1590715912 </item>
1590815913
1590915914 <item>
1591015915 <p>The <code>type-name</code>, <code>nilled</code>, <code>string-value</code>, <code>typed-value</code>,
15911- <code>is-id</code>, and <code>is-idrefs</code> properties of the copied nodes are preserved.</p>
15916+ <code>is-id</code>, <code>is-idrefs</code> properties of the copied nodes are preserved.</p>
1591215917 </item>
1591315918
1591415919 <item>
15915- <p>The copied node inherits all the <termref def="dt-in-scope-namespaces"/> of the constructed node,
15916- augmented and overridden by the in-scope namespaces of the original element
15917- that were preserved by the preceding rule.</p>
15920+
15921+ <p>The <termref def="dt-in-scope-namespaces"/> of a copied element node consist of:</p>
15922+
15923+ <olist>
15924+ <item><p>The <termref def="dt-in-scope-namespaces"/> of the element node being copied, plus</p></item>
15925+ <item><p>Inherited copies of the <termref def="dt-in-scope-namespaces"/> of the element node being constructed,
15926+ as defined in <specref ref="id-ns-nodes-on-elements"/>, except where a namespace binding
15927+ has been overridden in the element being copied or in one of its ancestors.</p></item>
15928+ </olist>
15929+
1591815930
1591915931 </item>
1592015932
@@ -15939,11 +15951,10 @@ encountered in finding the effective boolean value of its operand,
1593915951 the <code>base-uri</code> property of the new parent node.</p>
1594015952 </item>
1594115953
15942- <item>
15943- <p>All other properties of the copied nodes are preserved.</p>
15944- </item>
1594515954 </olist>
1594615955 </item>
15956+
15957+
1594715958 </olist>
1594815959
1594915960 <note>
@@ -18355,45 +18366,38 @@ creating a default namespace for that element using a computed namespace constru
1835518366For instance, the following computed constructor raises an error because the element’s name is not in a namespace,
1835618367but a default namespace is defined.</p>
1835718368
18358- <eg role="parse-test"><![CDATA[element #e { namespace { '' } { 'u' } }]]></eg>
18369+ <eg role="parse-test"><![CDATA[element #Q{} e { namespace { '' } { 'u' } }]]></eg>
1835918370
18360- <p>The following query illustrates the <termref def="dt-in-scope-namespaces"/> of a constructed element:</p>
18371+ <p>The following example illustrates the <termref def="dt-in-scope-namespaces"/> of a constructed element:</p>
1836118372
18362- <eg role="xquery parse-test ">declare namespace p = "http://example.com/ns/p";
18373+ <eg role="xquery">declare namespace p = "http://example.com/ns/p";
1836318374declare namespace q = "http://example.com/ns/q";
1836418375declare namespace f = "http://example.com/ns/f";
18365-
1836618376<p:a q:b="{ f:func(2) }" xmlns:r="http://example.com/ns/r"/>
1836718377</eg>
18368- <p role="xquery">The <termref def="dt-in-scope-namespaces"/> of the resulting <code>p:a</code> element comprise
18378+
18379+
18380+ <p role="xquery">Or equivalently, with a computed constructor:</p>
18381+
18382+ <eg>declare namespace p = "http://example.com/ns/p";
18383+ declare namespace q = "http://example.com/ns/q";
18384+ declare namespace f = "http://example.com/ns/f";
18385+ element #p:a {
18386+ attribute #q:b { f:func(2) }
18387+ namespace #r {"http://example.com/ns/r"}
18388+ }
18389+ </eg>
18390+
18391+ <p>the <termref def="dt-in-scope-namespaces"/> of the resulting <code>p:a</code> element comprise
1836918392 the following <termref def="dt-namespace-binding">namespace bindings</termref>:</p>
18370- <ulist role="xquery">
18371-
18372- <item>
18373- <p>
18374- <code>p = "http://example.com/ns/p"</code>
18375- </p>
18376- </item>
18377-
18378- <item>
18379- <p>
18380- <code>q = "http://example.com/ns/q"</code>
18381- </p>
18382- </item>
18383-
18384- <item>
18385- <p>
18386- <code>r = "http://example.com/ns/r"</code>
18387- </p>
18388- </item>
18389-
18390-
18391- <item>
18392- <p>
18393- <code>xml = "http://www.w3.org/XML/1998/namespace"</code>
18394- </p>
18395- </item>
18396- </ulist>
18393+
18394+ <slist>
18395+ <sitem><code>p = "http://example.com/ns/p"</code></sitem>
18396+ <sitem><code>q = "http://example.com/ns/q"</code></sitem>
18397+ <sitem><code>r = "http://example.com/ns/r"</code></sitem>
18398+ <sitem><code>xml = "http://www.w3.org/XML/1998/namespace"</code></sitem>
18399+ </slist>
18400+
1839718401
1839818402 <p role="xquery">The <termref def="dt-namespace-binding">namespace bindings</termref> for <code>p</code> and <code>q</code>
1839918403 are added to the result element because their respective namespaces
0 commit comments