From 55190b2d6f7b722f48f3739f5fd53461a7c45e51 Mon Sep 17 00:00:00 2001
From: Michael Kay "1621"
(1234 in base 9) with 4.0. As a workaround, this can be rewritten as
format-integer(1234, "0^000")
.
In computed node constructors, the node name must now be written in quotation marks
+ if it matches certain language keywords. For example element div {}
must now be
+ written element "div" {}
. (Alternatively, element {"div"} {}
+ and element Q{}div {}
are permitted by both XQuery 3.1 and XQuery 4.0.)
+ This change is made because {}
is now a valid expression representing an
+ empty map, so expressions such as element otherwise {}
could (without this rule) be
+ parsed in two different ways.
In &language;, certain expressions are classified as @code/text()
, which will always return an empty sequence. A processor may report
a static error when such expressions are encountered; however, processors are
In a computed node constructor of the form
element NNN {}
, attribute NNN {}
,
diff --git a/specifications/xquery-40/src/expressions.xml b/specifications/xquery-40/src/expressions.xml
index 70f44db99..54fbf1a3c 100644
--- a/specifications/xquery-40/src/expressions.xml
+++ b/specifications/xquery-40/src/expressions.xml
@@ -15085,12 +15085,11 @@ be created: element
, attribute
,
processing-instruction
, comment
, or
namespace
.
For those kinds of nodes that have names (element, attribute, and -processing instruction nodes), the keyword that specifies the node +
For those kinds of nodes that have names (element, attribute,
+processing instruction, and namespace nodes), the keyword that specifies the node
kind is followed by the name of the node to be created. This name may
be specified either as an EQName or as an expression enclosed in
-braces. XQuery 4.0 allows the node name to be written in quotation
+ marks (for example, Because the list of reserved keywords may be extended in future
+ versions of this specification, the safest strategy is to always to
+ use quotation marks (for example To write code that is portable between XQuery 3.1 and XQuery 4.0,
+ the best advice is to use either the form element "book" {}
, and at the same
+ time it disallows the use of a defined set of language keywords
+ without quotes: for example element div {}
was allowed
+ in XQuery 3.1 but must now be written element "div" {}
or
+ element {"div"} {}
. The reason for this incompatible
+ change is that allowing map constructors to omit the map
+ keyword would otherwise create an ambiguity: consider for example the
+ expression element otherwise {}
.element "div"
)
+ when the node name is a simple NCName
. To avoid
+ any dependency on the default namespace context, the form
+ element Q{}div
might also be used.element {"div"}
+ or the form element Q{}div
.