Skip to content

Commit 23b523f

Browse files
committed
Add computed constructors to XPath
1 parent 0d9df59 commit 23b523f

File tree

4 files changed

+336
-153
lines changed

4 files changed

+336
-153
lines changed

specifications/grammar-40/xpath-grammar.xml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,7 +2159,7 @@ VersionDecl ::= "xquery" (("encoding" StringLiteral) | ("version" StringLiteral
21592159
<g:ref name="FunctionCall" lookahead="2" if="xpath40 xquery40 xslt40-patterns"/>
21602160
<g:ref name="OrderedExpr" if=" xquery40" lookahead="2"/>
21612161
<g:ref name="UnorderedExpr" if=" xquery40" lookahead="2"/>
2162-
<g:ref name="NodeConstructor" if="xquery40" lookahead="2"/>
2162+
<g:ref name="NodeConstructor" if="xpath40 xquery40" lookahead="2"/>
21632163
<g:ref name="FunctionItemExpr" if="xpath40 xquery40 xslt40-patterns"/>
21642164
<g:ref name="MapConstructor" if="xpath40 xquery40 xslt40-patterns"/>
21652165
<g:ref name="ArrayConstructor" if="xpath40 xquery40 xslt40-patterns"/>
@@ -2192,7 +2192,7 @@ VersionDecl ::= "xquery" (("encoding" StringLiteral) | ("version" StringLiteral
21922192
<g:ref name="EQName"/>
21932193
</g:production>
21942194

2195-
<g:production name="MarkedNCName" if="xquery40">
2195+
<g:production name="MarkedNCName" if="xpath40 xquery40">
21962196
<g:string>#</g:string>
21972197
<g:ref name="NCName"/>
21982198
</g:production>
@@ -2244,9 +2244,9 @@ VersionDecl ::= "xquery" (("encoding" StringLiteral) | ("version" StringLiteral
22442244
<!-- [ start Constructor -->
22452245

22462246

2247-
<g:production name="NodeConstructor" if="xquery40">
2247+
<g:production name="NodeConstructor" if="xpath40 xquery40">
22482248
<g:choice break="true">
2249-
<g:ref name="DirectConstructor"/>
2249+
<g:ref name="DirectConstructor" if="xquery40"/>
22502250
<g:ref name="ComputedConstructor"/>
22512251
</g:choice>
22522252
</g:production>
@@ -2401,33 +2401,33 @@ VersionDecl ::= "xquery" (("encoding" StringLiteral) | ("version" StringLiteral
24012401
</g:zeroOrMore>
24022402
</g:production>
24032403

2404-
<g:production name="ComputedConstructor" if=" xquery40" >
2404+
<g:production name="ComputedConstructor" if="xpath40 xquery40" >
24052405
<g:choice break="true" name="ComputedConstructorChoice">
24062406
<g:ref name="CompDocConstructor"/>
24072407
<g:ref name="CompElemConstructor"/>
24082408
<g:ref name="CompAttrConstructor"/>
2409-
<g:ref name="CompNamespaceConstructor" if="xquery40"/>
2409+
<g:ref name="CompNamespaceConstructor"/>
24102410
<g:ref name="CompTextConstructor"/>
24112411
<g:ref name="CompCommentConstructor"/>
24122412
<g:ref name="CompPIConstructor"/>
24132413
</g:choice>
24142414
</g:production>
24152415

2416-
<g:production name="CompDocConstructor" if=" xquery40">
2416+
<g:production name="CompDocConstructor" if="xpath40 xquery40">
24172417
<g:string>document</g:string>
24182418
<g:ref name="EnclosedExpr"/>
24192419
</g:production>
24202420

2421-
<g:production name="CompElemConstructor" if=" xquery40">
2421+
<g:production name="CompElemConstructor" if="xpath40 xquery40">
24222422
<g:string>element</g:string>
24232423
<g:ref name="CompNodeName"/>
24242424
<g:ref name="EnclosedContentExpr"/>
24252425
</g:production>
24262426

2427-
<g:production name="CompNodeName" if="xquery40">
2427+
<g:production name="CompNodeName" if="xpath40 xquery40">
24282428
<g:choice name="CompElemConstructorSpec">
24292429
<g:ref name="QNameLiteral"/>
2430-
<g:ref name="UnreservedName"/>
2430+
<g:ref name="UnreservedName" if="xquery40"/>
24312431
<g:sequence>
24322432
<g:string>{</g:string>
24332433
<g:ref name="Expr"/>
@@ -2436,10 +2436,10 @@ VersionDecl ::= "xquery" (("encoding" StringLiteral) | ("version" StringLiteral
24362436
</g:choice>
24372437
</g:production>
24382438

2439-
<g:production name="CompNodeNCName" if="xquery40">
2439+
<g:production name="CompNodeNCName" if="xpath40 xquery40">
24402440
<g:choice>
24412441
<g:ref name="MarkedNCName"/>
2442-
<g:ref name="UnreservedNCName"/>
2442+
<g:ref name="UnreservedNCName" if="xquery40"/>
24432443
<g:sequence>
24442444
<g:string>{</g:string>
24452445
<g:ref name="Expr"/>
@@ -2456,33 +2456,33 @@ VersionDecl ::= "xquery" (("encoding" StringLiteral) | ("version" StringLiteral
24562456
<g:ref name="NCName"/>
24572457
</g:production>
24582458

2459-
<g:production name="EnclosedContentExpr" if="xquery40">
2459+
<g:production name="EnclosedContentExpr" if="xpath40 xquery40">
24602460
<g:ref name="EnclosedExpr"/>
24612461
</g:production>
24622462

2463-
<g:production name="CompAttrConstructor" if=" xquery40">
2463+
<g:production name="CompAttrConstructor" if="xpath40 xquery40">
24642464
<g:string>attribute</g:string>
24652465
<g:ref name="CompNodeName"/>
24662466
<g:ref name="EnclosedExpr"/>
24672467
</g:production>
24682468

2469-
<g:production name="CompNamespaceConstructor" if="xquery40">
2469+
<g:production name="CompNamespaceConstructor" if="xpath40 xquery40">
24702470
<g:string>namespace</g:string>
24712471
<g:ref name="CompNodeNCName"/>
24722472
<g:ref name="EnclosedExpr"/>
24732473
</g:production>
24742474

2475-
<g:production name="CompTextConstructor" if=" xquery40">
2475+
<g:production name="CompTextConstructor" if="xpath40 xquery40">
24762476
<g:string>text</g:string>
24772477
<g:ref name="EnclosedExpr"/>
24782478
</g:production>
24792479

2480-
<g:production name="CompCommentConstructor" if=" xquery40">
2480+
<g:production name="CompCommentConstructor" if="xpath40 xquery40">
24812481
<g:string>comment</g:string>
24822482
<g:ref name="EnclosedExpr"/>
24832483
</g:production>
24842484

2485-
<g:production name="CompPIConstructor" if=" xquery40">
2485+
<g:production name="CompPIConstructor" if="xpath40 xquery40">
24862486
<g:string>processing-instruction</g:string>
24872487
<g:ref name="CompNodeNCName"/>
24882488
<g:ref name="EnclosedExpr"/>

specifications/xquery-40/src/errors.xml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -161,19 +161,19 @@
161161
nor emptiable). Processors are not required to detect this error.</p>
162162
</error>
163163

164-
<error spec="XQ" role="xquery" code="0024" class="TY" type="type">
164+
<error spec="XQ" code="0024" class="TY" type="type">
165165
<p> It is a <termref def="dt-type-error">type error</termref> if the content sequence in an
166166
element constructor contains an attribute node following a node that is not an attribute
167167
node.</p>
168168
</error>
169169

170-
<error spec="XQ" role="xquery" code="0025" class="DY" type="dynamic">
170+
<error spec="XQ" code="0025" class="DY" type="dynamic">
171171
<p> It is a <termref def="dt-dynamic-error">dynamic error</termref> if any attribute of a
172172
constructed element does not have a name that is distinct from the names of all other
173173
attributes of the constructed element.</p>
174174
</error>
175175

176-
<error spec="XQ" role="xquery" code="0026" class="DY" type="dynamic">
176+
<error spec="XQ" code="0026" class="DY" type="dynamic">
177177
<p> It is a <termref def="dt-dynamic-error">dynamic error</termref> if the result of the
178178
content expression of a computed processing instruction constructor contains the string
179179
<code>"?&gt;"</code>.</p>
@@ -330,7 +330,7 @@
330330
def="dt-expanded-qname">expanded QNames</termref>.</p>
331331
</error>
332332

333-
<error spec="XQ" role="xquery" code="0041" class="DY" type="dynamic">
333+
<error spec="XQ" code="0041" class="DY" type="dynamic">
334334
<p> It is a <termref def="dt-dynamic-error">dynamic error</termref> if the value of the
335335
name expression in a computed processing instruction constructor cannot be cast to the
336336
type <code>xs:NCName</code>.</p>
@@ -350,7 +350,7 @@
350350
</error>
351351
-->
352352

353-
<error spec="XQ" role="xquery" code="0044" class="DY" type="dynamic">
353+
<error spec="XQ" code="0044" class="DY" type="dynamic">
354354
<!-- <change diff="chg" at="XQ.E19"> -->
355355
<p>It is a <termref def="dt-dynamic-error">dynamic error</termref> the node-name of a node
356356
constructed by a computed attribute constructor has any of the following properties: </p>
@@ -509,7 +509,7 @@
509509
</error>
510510
-->
511511

512-
<error spec="XQ" role="xquery" code="0064" class="DY" type="dynamic">
512+
<error spec="XQ" code="0064" class="DY" type="dynamic">
513513
<p> It is a <termref def="dt-dynamic-error">dynamic error</termref> if the value of the
514514
name expression in a computed processing instruction constructor is equal to
515515
<code>XML</code> (in any combination of upper and lower case).</p>
@@ -559,7 +559,7 @@
559559
declaration attributes of a direct element constructor do not have distinct names.</p>
560560
</error>
561561

562-
<error spec="XQ" role="xquery" code="0072" class="DY" type="dynamic">
562+
<error spec="XQ" code="0072" class="DY" type="dynamic">
563563
<p> It is a <termref def="dt-dynamic-error">dynamic error</termref> if the result of the
564564
content expression of a computed comment constructor contains two adjacent hyphens or
565565
ends with a hyphen.</p>
@@ -571,7 +571,7 @@
571571
</error>
572572
-->
573573

574-
<error spec="XQ" role="xquery" code="0074" class="DY" type="dynamic">
574+
<error spec="XQ" code="0074" class="DY" type="dynamic">
575575
<p> It is a <termref def="dt-dynamic-error">dynamic error</termref> if the value of the
576576
name expression in a computed element or attribute constructor cannot be converted to an
577577
<termref def="dt-expanded-qname">expanded QName</termref> (for example, because it
@@ -651,12 +651,12 @@
651651
support <bibref ref="XMLNAMES11"/>.</p>
652652
</error>
653653

654-
<error spec="XQ" role="xquery" code="0086" class="TY" type="type">
654+
<error spec="XQ" code="0086" class="TY" type="type">
655655
<p> It is a <termref def="dt-type-error">type error</termref> if the typed value of a
656-
copied element or attribute node is <termref def="dt-namespace-sensitive"
657-
>namespace-sensitive</termref> when <termref def="dt-construction-mode">construction
656+
copied <phrase role="xquery">element or</phrase> attribute node is <termref def="dt-namespace-sensitive"
657+
>namespace-sensitive</termref> <phrase role="xquery">when <termref def="dt-construction-mode">construction
658658
mode</termref> is <code>preserve</code> and <termref def="dt-copy-namespaces-mode"
659-
>copy-namespaces mode</termref> is <code>no-preserve</code>.</p>
659+
>copy-namespaces mode</termref> is <code>no-preserve</code></phrase>.</p>
660660
</error>
661661

662662
<error spec="XQ" role="xquery" code="0087" class="ST" type="static">
@@ -692,14 +692,14 @@
692692
character in the version of XML that is in use.</p>
693693
</error>
694694

695-
<error spec="XQ" role="xquery" code="0091" class="DY" type="dynamic">
695+
<error spec="XQ" code="0091" class="DY" type="dynamic">
696696
<p>An implementation <termref def="may">MAY</termref> raise a <termref
697697
def="dt-dynamic-error">dynamic error</termref> if an <code>xml:id</code> error, as
698698
defined in <bibref ref="XMLID"/>, is encountered during construction of an attribute
699699
named <code>xml:id</code>.</p>
700700
</error>
701701

702-
<error spec="XQ" role="xquery" code="0092" class="DY" type="dynamic">
702+
<error spec="XQ" code="0092" class="DY" type="dynamic">
703703
<p>An implementation <termref def="may">MAY</termref> raise a <termref
704704
def="dt-dynamic-error">dynamic error</termref> if a constructed attribute named
705705
<code>xml:space</code> has a value other than <code>preserve</code> or
@@ -728,7 +728,7 @@ if the value bound to a grouping variable consists of a sequence of more than o
728728

729729
<!-- ################ -->
730730

731-
<error spec="XQ" role="xquery" code="0096" class="DY" type="dynamic">
731+
<error spec="XQ" code="0096" class="DY" type="dynamic">
732732
<!-- <change diff="chg" at="XQ.E19"> -->
733733
<p>It is a <termref def="dt-dynamic-error">dynamic error</termref>
734734
<phrase diff="add">if</phrase> the node-name of a node constructed by a computed element
@@ -809,7 +809,7 @@ if the value bound to a grouping variable consists of a sequence of more than o
809809
</error>
810810
-->
811811

812-
<error spec="XQ" role="xquery" code="0101" class="DY" type="dynamic">
812+
<error spec="XQ" code="0101" class="DY" type="dynamic">
813813

814814
<p>An error is raised if a computed namespace constructor attempts to do any of the
815815
following:</p>
@@ -837,7 +837,7 @@ if the value bound to a grouping variable consists of a sequence of more than o
837837
</ulist>
838838
</error>
839839

840-
<error spec="XQ" role="xquery" code="0102" class="DY" type="type">
840+
<error spec="XQ" code="0102" class="DY" type="type">
841841
<p> In an element constructor, if two or more namespace bindings in the in-scope bindings
842842
would have the same prefix, then an error is raised if they have different URIs; if they
843843
would have the same prefix and URI, duplicate bindings are ignored. </p>
@@ -859,9 +859,9 @@ if the value bound to a grouping variable consists of a sequence of more than o
859859
</p>
860860
</error>
861861

862-
<error spec="XQ" role="xquery" code="0105" class="TY" type="type">
863-
<p> It is a <termref def="dt-type-error">type error</termref> if the content sequence in an
864-
element constructor contains a function <phrase diff="del">item</phrase>.</p>
862+
<error spec="XQ" code="0105" class="TY" type="type">
863+
<p> It is a <termref def="dt-type-error">type error</termref> if the content sequence of an
864+
element or document constructor contains a function item.</p>
865865
</error>
866866

867867
<error spec="XQ" role="xquery" code="0106" class="ST" type="static">

0 commit comments

Comments
 (0)