Skip to content

Commit 8ba2db8

Browse files
committed
Proofreading
1 parent 379c786 commit 8ba2db8

File tree

1 file changed

+45
-34
lines changed

1 file changed

+45
-34
lines changed

specifications/xquery-40/src/expressions.xml

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15853,7 +15853,8 @@ encountered in finding the effective boolean value of its operand,
1585315853
<prodrecap ref="NodeConstructor"/>
1585415854
</scrap>
1585515855

15856-
<p>Constructors are provided for element, attribute, document, text, comment, and processing instruction nodes.
15856+
<p>Constructors are provided for element, attribute, document, text, comment,
15857+
processing instruction, and namespace nodes.
1585715858
<phrase role="xquery">Two kinds of constructors are provided: <term>direct constructors</term>,
1585815859
which use an XML-like notation that can incorporate enclosed expressions,
1585915860
and <term>computed constructors</term>, which use a notation based on enclosed expressions.</phrase> </p>
@@ -15913,7 +15914,7 @@ encountered in finding the effective boolean value of its operand,
1591315914

1591415915
<item>
1591515916
<p>The <code>type-name</code>, <code>nilled</code>, <code>string-value</code>, <code>typed-value</code>,
15916-
<code>is-id</code>, <code>is-idrefs</code> properties of the copied nodes are preserved.</p>
15917+
<code>is-id</code>, and <code>is-idrefs</code> properties of the copied nodes are preserved.</p>
1591715918
</item>
1591815919

1591915920
<item>
@@ -15931,7 +15932,7 @@ encountered in finding the effective boolean value of its operand,
1593115932
</item>
1593215933

1593315934
<item>
15934-
<p>When an attribute nodes are copied but its parent element node is not
15935+
<p>When an attribute node is copied but its parent element node is not
1593515936
copied, type error <errorref class="TY" code="0086"/>
1593615937
is raised if the <termref def="dt-typed-value">typed value</termref>
1593715938
of the copied attribute node is
@@ -17010,9 +17011,8 @@ be created: <code>element</code>, <code>attribute</code>,
1701017011
<p>For those kinds of nodes that have names (element, attribute,
1701117012
processing instruction, and namespace nodes), the keyword that specifies the node
1701217013
kind is followed by the name of the node to be created. This name may
17013-
be specified either as an literal or as an expression enclosed in
17014-
braces. <termdef term="name expression" id="dt-name-expression"
17015-
>When
17014+
be specified either as a literal or as an expression enclosed in
17015+
braces. <termdef term="name expression" id="dt-name-expression">When
1701617016
an expression is used to specify the name of a constructed node, that
1701717017
expression is called the <term>name expression</term> of the
1701817018
constructor.</termdef>
@@ -17033,14 +17033,14 @@ same result as the first example in <specref
1703317033
}
1703417034
}]]></eg>
1703517035

17036-
<note><p>In the above examples, <code>#book</code>,<code>#title</code>, and so on
17036+
<note><p>In the above example, the element names <code>#book</code>,<code>#title</code>, and so on
1703717037
are <nt def="QNameLiteral">QNameLiteral</nt>s, which are expanded using the
1703817038
<termref def="dt-constructed-element-namespace-rule"/>.
17039-
The attribute name <code>#isdn</code>, by contrast, is expanded using the
17039+
The attribute name <code>#isbn</code>, by contrast, is expanded using the
1704017040
<termref def="dt-no-namespace-rule"/>.</p></note>
1704117041

17042-
<note role="xquery"><p>XQuery 4.0 allows the node name to be written in quotation
17043-
marks (for example, <code>element "book" {}</code>, and at the same
17042+
<note role="xquery"><p>XQuery 4.0 allows the node name to be written as a QName literal
17043+
(for example, <code>element #book {}</code>, and at the same
1704417044
time it disallows the use of a defined set of language keywords
1704517045
without quotes: for example <code>element div {}</code> was allowed
1704617046
in XQuery 3.1 but must now be written <code>element #div {}</code> or
@@ -17826,7 +17826,9 @@ attribute {
1782617826
</item>
1782717827
</olist>
1782817828
<p>No validation is performed on the constructed document node. The <bibref ref="XML"
17829-
/> rules that govern the structure of an XML document (for example, the document node must have exactly one child that is an element node) are not enforced by the XQuery document node constructor.</p>
17829+
/> rules that govern the structure of an XML document (for example, the
17830+
document node must have exactly one child that is an element node)
17831+
are not enforced by the &language; document node constructor.</p>
1783017832
</div4>
1783117833
<div4 id="id-textConstructors">
1783217834
<head>Text Node Constructors</head>
@@ -17870,6 +17872,10 @@ attribute {
1787017872
</note>
1787117873
<p>The following example illustrates a text node constructor:</p>
1787217874
<eg role="parse-test"><![CDATA[text { "Hello" }]]></eg>
17875+
17876+
<note><p>It is possible to construct a text node whose string value is zero-length. The rules
17877+
for constructing element nodes, however, ensure that a zero-length text node will be discarded
17878+
if used while forming the content of an element.</p></note>
1787317879
</div4>
1787417880

1787517881
<div4 id="id-computed-pis">
@@ -18204,27 +18210,19 @@ return comment { concat($homebase, ", we have a problem.") }]]></eg>
1820418210
<item>
1820518211
<p>A computed namespace constructor with a prefix expression:</p>
1820618212
<eg role="parse-test"
18207-
><![CDATA[namespace { "a" } { "http://a.example.com" }]]></eg>
18213+
><![CDATA[namespace { "a" || $i } { "http://example.ns/a" || $i }]]></eg>
1820818214
</item>
1820918215

1821018216

1821118217
<item>
1821218218
<p>A computed namespace constructor with the empty prefix:</p>
1821318219
<eg role="parse-test"
18214-
><![CDATA[namespace {""} { "http://a.example.com" }]]></eg>
18220+
><![CDATA[namespace {""} { "http://example.ns/a0" }]]></eg>
1821518221
</item>
1821618222
</ulist>
1821718223

1821818224
<p>Computed namespace constructors are generally used to add to the
18219-
<termref def="dt-in-scope-namespaces"/> of elements created with element constructors:</p>
18220-
<eg role="xquery"><![CDATA[
18221-
<age xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> {
18222-
namespace #xs { "http://www.w3.org/2001/XMLSchema" },
18223-
attribute #xsi:type { "xs:integer" },
18224-
23
18225-
}</age>
18226-
]]></eg>
18227-
<p role="xquery">Or:</p>
18225+
<termref def="dt-in-scope-namespaces"/> of elements created using computed element constructors:</p>
1822818226

1822918227
<eg role="parse-test"><![CDATA[
1823018228
element #age {
@@ -18235,13 +18233,19 @@ element #age {
1823518233
}
1823618234
]]></eg>
1823718235

18238-
<p role="xquery">In the above example, note that the <code>xsi</code> <termref def="dt-namespace-binding"/>
18239-
is created for the element because it is used in an attribute name. The attribute’s
18240-
content is simply character data, and has no effect on namespace bindings.
18241-
The computed namespace constructor ensures that the <code>xs</code> binding is created.</p>
18242-
18243-
<p role="xquery">Computed namespace constructors have no effect on the <termref def="dt-static-namespaces"/>.
18244-
If the prefix a is not already defined in the <termref def="dt-static-namespaces"/>,
18236+
<p>In this example, the explicit construction of
18237+
the <code>xsi</code> <termref def="dt-namespace-binding"/>
18238+
is unnecessary; it would be created automatically, because the <code>xsi</code>
18239+
prefix is used in an attribute name. By contrast, the declaration of
18240+
the <code>xs</code> <termref def="dt-namespace-binding"/> is needed; the attribute’s
18241+
content is simply character data, and would not trigger automatic creation
18242+
of a namespace binding. This would be true even if the attribute is subsequently
18243+
validated against a schema that interprets <code>"xs:integer"</code> as a QName,
18244+
because such validation relies on the namespace binding already being present.</p>
18245+
18246+
<p role="xquery">Computed namespace constructors have no effect on the <termref def="dt-static-namespaces"/>
18247+
in the static context.
18248+
If the prefix <code>a</code> is not already defined in the <termref def="dt-static-namespaces"/>,
1824518249
the following expression results in a static error
1824618250
<errorref
1824718251
class="ST" code="0081"/>.</p>
@@ -18252,6 +18256,13 @@ element #age {
1825218256
}</a:form>
1825318257
]]></eg>
1825418258

18259+
<note>
18260+
<p>It is not possible to use a computed namespace constructor to
18261+
generate a namespace undeclaration such as <code>xmlns=""</code>
18262+
or (with XML Namespaces 1.1) <code>xmlns:p=""</code>. A namespace undeclaration in lexical XML
18263+
is represented in the XDM model by the absence of a <termref def="dt-namespace-binding"/> that
18264+
would otherwise be present.</p>
18265+
</note>
1825518266

1825618267
</div4>
1825718268

@@ -18388,7 +18399,7 @@ element #p:a {
1838818399
}
1838918400
</eg>
1839018401

18391-
<p>the <termref def="dt-in-scope-namespaces"/> of the resulting <code>p:a</code> element comprise
18402+
<p>The <termref def="dt-in-scope-namespaces"/> of the resulting <code>p:a</code> element comprise
1839218403
the following <termref def="dt-namespace-binding">namespace bindings</termref>:</p>
1839318404

1839418405
<slist>
@@ -18399,22 +18410,22 @@ element #p:a {
1839918410
</slist>
1840018411

1840118412

18402-
<p role="xquery">The <termref def="dt-namespace-binding">namespace bindings</termref> for <code>p</code> and <code>q</code>
18413+
<p>The <termref def="dt-namespace-binding">namespace bindings</termref> for <code>p</code> and <code>q</code>
1840318414
are added to the result element because their respective namespaces
1840418415
are used in the names of the element and its attributes. The namespace binding <code>r="http://example.com/ns/r"</code> is added to the in-scope namespaces of the constructed
1840518416
element because it is defined by a <termref
1840618417
def="dt-namespace-decl-attr"
1840718418
>namespace declaration attribute</termref>, even though it is not used in a name.</p>
1840818419

18409-
<p role="xquery">No <termref def="dt-namespace-binding"/> corresponding to <code>f="http://example.com/ns/f"</code> is created,
18420+
<p>No <termref def="dt-namespace-binding"/> corresponding to <code>f="http://example.com/ns/f"</code> is created,
1841018421
because the namespace prefix <code>f</code> appears only in the query prolog and is not used in an element
1841118422
or attribute name of the constructed node. This namespace binding does not appear in the query result,
1841218423
even though it is present in the <termref def="dt-static-namespaces"/> and is available for use
1841318424
during processing of the query.</p>
1841418425

1841518426
<p role="xquery">Note that the following constructed element, if nested within a <code>validate</code> expression, cannot be validated:
1841618427
</p>
18417-
<eg role="xquery parse-test">&lt;p xsi:type="xs:integer"&gt;3&lt;/p&gt;</eg>
18428+
<eg role="xquery">&lt;p xsi:type="xs:integer"&gt;3&lt;/p&gt;</eg>
1841818429

1841918430
<p role="xquery">The constructed element will have <termref def="dt-namespace-binding">namespace bindings</termref>
1842018431
for the prefixes <code>xsi</code>
@@ -18426,7 +18437,7 @@ element because it is defined by a <termref
1842618437
def="dt-namespace-decl-attr"
1842718438
>namespace declaration attribute</termref>, as in the following example:</p>
1842818439

18429-
<eg role="xquery parse-test">&lt;p xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:integer"&gt;3&lt;/p&gt;</eg>
18440+
<eg role="xquery">&lt;p xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:integer"&gt;3&lt;/p&gt;</eg>
1843018441
</div3>
1843118442
</div2>
1843218443

0 commit comments

Comments
 (0)