Merge lp:~zorba-coders/zorba/fix_bug_1182910 into lp:zorba

Proposed by Sorin Marian Nasoi
Status: Merged
Approved by: Sorin Marian Nasoi
Approved revision: 11494
Merged at revision: 11491
Proposed branch: lp:~zorba-coders/zorba/fix_bug_1182910
Merge into: lp:zorba
Diff against target: 15358 lines (+3708/-8115)
21 files modified
modules/w3c/xpath_functions.xq (+7/-7)
src/compiler/translator/translator.cpp (+18/-18)
src/functions/func_fn_hof_functions_impl.cpp (+16/-16)
src/functions/function_consts.h (+1/-1)
src/functions/pregenerated/func_fn_hof_functions.cpp (+2/-2)
src/functions/pregenerated/func_fn_hof_functions.h (+3/-3)
src/functions/pregenerated/function_enum.h (+1/-1)
src/runtime/hof/fn_hof_functions_impl.cpp (+40/-40)
src/runtime/hof/pregenerated/fn_hof_functions.cpp (+10/-10)
src/runtime/hof/pregenerated/fn_hof_functions.h (+10/-10)
src/runtime/pregenerated/iterator_enum.h (+1/-1)
src/runtime/spec/hof/fn_hof_functions.xml (+13/-13)
src/runtime/visitors/pregenerated/planiter_visitor.h (+3/-3)
src/runtime/visitors/pregenerated/printer_visitor.cpp (+5/-5)
src/runtime/visitors/pregenerated/printer_visitor.h (+2/-2)
test/fots/CMakeLists.txt (+0/-62)
test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-7.xml.res (+1/-1)
test/rbkt/Queries/w3c_known_failures.txt (+36/-0)
test/rbkt/Queries/w3c_known_failures_XQueryX.txt (+36/-0)
test/rbkt/Queries/zorba/spec/XQuery_3.0.html (+3482/-7920)
test/rbkt/Queries/zorba/spec/xquery_spec.xqi (+21/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/fix_bug_1182910
Reviewer Review Type Date Requested Status
Sorin Marian Nasoi Approve
Nicolae Brinza Approve
Review via email: mp+167369@code.launchpad.net

Commit message

- partial fix for lp:1182910: updated function names from fn:map and fn:map-pairs to fn:for-each and fn:for-each-pair
- updated order of params for functions: fn:for-each, fn:for-each-pair, fn:filter, fn:fold-right, fn:fold-left
- updated XQuery 3.0 F&O spec for test xquery_30

To post a comment you must log in.
Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/fix_bug_1182910 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:281 (message):
  Validation queue job fix_bug_1182910-2013-06-04T19-13-06.838Z is finished.
  The final status was:

  5 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

11492. By sorin.marian.nasoi <email address hidden>

- updated expected failures

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job fix_bug_1182910-2013-06-04T19-53-51.059Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1, Needs Information < 1, Resubmit < 1. Got: 1 Approve, 1 Pending.

11493. By sorin.marian.nasoi <email address hidden>

- fixes

Revision history for this message
Nicolae Brinza (nbrinza) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/fix_bug_1182910 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:281 (message):
  Validation queue job fix_bug_1182910-2013-06-04T21-26-53.305Z is finished.
  The final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job fix_bug_1182910-2013-06-05T04-10-52.092Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/w3c/xpath_functions.xq'
2--- modules/w3c/xpath_functions.xq 2013-03-04 16:17:30 +0000
3+++ modules/w3c/xpath_functions.xq 2013-06-05 04:10:35 +0000
4@@ -259,7 +259,7 @@
5 (:~
6 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-filter">fn:filter</a>
7 :)
8-declare function fn:filter($f as function(item()) as xs:boolean, $seq as item()*) as item()* external;
9+declare function fn:filter($seq as item()*, $f as function(item()) as xs:boolean) as item()* external;
10
11 (:~
12 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-floor">fn:floor</a>
13@@ -269,12 +269,12 @@
14 (:~
15 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-fold-left">fn:fold-left</a>
16 :)
17-declare function fn:fold-left( $f as function(item()*, item()) as item()*, $zero as item()*, $seq as item()*) as item()* external;
18+declare function fn:fold-left($seq as item()*, $zero as item()*, $f as function(item()*, item()) as item()*) as item()* external;
19
20 (:~
21 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-fold-right">fn:fold-right</a>
22 :)
23-declare function fn:fold-right( $f as function(item(), item()*) as item()*, $zero as item()*, $seq as item()*) as item()* external;
24+declare function fn:fold-right($seq as item()*, $zero as item()*, $f as function(item()*, item()) as item()*) as item()* external;
25
26 (:~
27 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-format-date">fn:format-date</a>
28@@ -407,14 +407,14 @@
29 declare function fn:lower-case($arg as xs:string?) as xs:string external;
30
31 (:~
32- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-map">fn:map</a>
33+ : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-for-each">fn:for-each</a>
34 :)
35-declare function fn:map($f as function(item()) as item()*, $seq as item()*) as item()* external;
36+declare function fn:for-each( $seq as item()*, $f as function(item()) as item()*) as item()* external;
37
38 (:~
39- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-map-pairs">fn:map-pairs</a>
40+ : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-for-each-pair">fn:for-each-pair</a>
41 :)
42-declare function fn:map-pairs( $f as function(item(), item()) as item()*, $seq1 as item()*, $seq2 as item()*) as item()* external;
43+declare function fn:for-each-pair( $seq1 as item()*, $seq2 as item()*, $f as function(item(), item()) as item()*) as item()* external;
44
45 (:~
46 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-matches">fn:matches</a>
47
48=== modified file 'src/compiler/translator/translator.cpp'
49--- src/compiler/translator/translator.cpp 2013-05-31 17:56:26 +0000
50+++ src/compiler/translator/translator.cpp 2013-06-05 04:10:35 +0000
51@@ -12168,27 +12168,27 @@
52 arguments[2]);
53 break;
54 }
55- case FunctionConsts::FN_MAP_2:
56+ case FunctionConsts::FN_FOR_EACH_2:
57 {
58- // map(function, sequence) is rewritten internally as:
59+ // fn:for-each(sequence, function) is rewritten internally as:
60 //
61 // for $item in $sequence
62- // return dynamic_function_invocation[ $function, $item ]
63-
64- arguments[0] = normalize_fo_arg(0, arguments[0], f, loc);
65+ // return dynamic_function_invocation[ $item, $function ]
66+
67+ arguments[1] = normalize_fo_arg(1, arguments[1], f, loc);
68
69 flwor_expr* flwor = CREATE(flwor)(theRootSctx, theUDF, loc);
70- for_clause* seq_fc = wrap_in_forclause(arguments[1], false);
71+ for_clause* seq_fc = wrap_in_forclause(arguments[0], false);
72 flwor->add_clause(seq_fc);
73-
74+
75 std::vector<expr*> fncall_args;
76 fncall_args.push_back(CREATE(wrapper)(theRootSctx, theUDF, loc, seq_fc->get_var()));
77
78 expr* dynamic_fncall =
79 CREATE(dynamic_function_invocation)(theRootSctx, theUDF, loc,
80- arguments[0],
81+ arguments[1],
82 fncall_args);
83-
84+
85 flwor->set_return_expr(dynamic_fncall);
86
87 resultExpr = flwor;
88@@ -12200,22 +12200,22 @@
89 //
90 // for $item in $sequence
91 // return
92- // if (dynamic_function_invocation[ $function, $item])
93+ // if (dynamic_function_invocation[ $item, $function ])
94 // then $item
95 // else ()
96-
97- arguments[0] = normalize_fo_arg(0, arguments[0], f, loc);
98+
99+ arguments[1] = normalize_fo_arg(1, arguments[1], f, loc);
100
101 flwor_expr* flwor = CREATE(flwor)(theRootSctx, theUDF, loc);
102- for_clause* seq_fc = wrap_in_forclause(arguments[1], true);
103+ for_clause* seq_fc = wrap_in_forclause(arguments[0], true);
104 flwor->add_clause(seq_fc);
105-
106+
107 std::vector<expr*> fncall_args;
108 fncall_args.push_back(CREATE(wrapper)(theRootSctx, theUDF, loc, seq_fc->get_var()));
109-
110+
111 expr* dynamic_fncall =
112 CREATE(dynamic_function_invocation)(theRootSctx, theUDF, loc,
113- arguments[0],
114+ arguments[1],
115 fncall_args);
116
117 expr* if_expr =
118@@ -12223,7 +12223,7 @@
119 dynamic_fncall,
120 CREATE(wrapper)(theRootSctx, theUDF, loc, seq_fc->get_var()),
121 create_empty_seq(loc));
122-
123+
124 flwor->set_return_expr(if_expr);
125
126 resultExpr = flwor;
127@@ -12647,7 +12647,7 @@
128
129 break;
130 }
131- case FunctionConsts::FN_MAP_2:
132+ case FunctionConsts::FN_FOR_EACH_2:
133 case FunctionConsts::FN_FILTER_2:
134 {
135 flwor_expr* flworBody = CREATE(flwor)(theRootSctx, theUDF, loc);
136
137=== modified file 'src/functions/func_fn_hof_functions_impl.cpp'
138--- src/functions/func_fn_hof_functions_impl.cpp 2013-04-10 21:01:35 +0000
139+++ src/functions/func_fn_hof_functions_impl.cpp 2013-06-05 04:10:35 +0000
140@@ -33,10 +33,10 @@
141 /*******************************************************************************
142
143 ********************************************************************************/
144-class fn_map_3_0 : public function
145+class fn_for_each_3_0 : public function
146 {
147 public:
148- fn_map_3_0(const signature& sig, FunctionConsts::FunctionKind kind)
149+ fn_for_each_3_0(const signature& sig, FunctionConsts::FunctionKind kind)
150 :
151 function(sig, kind)
152 {
153@@ -153,12 +153,12 @@
154 TypeConstants::QUANT_ONE);
155
156 DECL_WITH_KIND(sctx,
157- fn_map_3_0,
158- (createQName(static_context::W3C_FN_NS, "", "map"),
159+ fn_for_each_3_0,
160+ (createQName(static_context::W3C_FN_NS, "", "for-each"),
161+ GENV_TYPESYSTEM.ITEM_TYPE_STAR,
162 hofParamType,
163- GENV_TYPESYSTEM.ITEM_TYPE_STAR,
164 GENV_TYPESYSTEM.ITEM_TYPE_STAR),
165- FunctionConsts::FN_MAP_2);
166+ FunctionConsts::FN_FOR_EACH_2);
167 }
168
169 {
170@@ -173,8 +173,8 @@
171 DECL_WITH_KIND(sctx,
172 fn_filter,
173 (createQName(static_context::W3C_FN_NS, "", "filter"),
174+ GENV_TYPESYSTEM.ITEM_TYPE_STAR,
175 hofParamType,
176- GENV_TYPESYSTEM.ITEM_TYPE_STAR,
177 GENV_TYPESYSTEM.ITEM_TYPE_STAR),
178 FunctionConsts::FN_FILTER_2);
179 }
180@@ -190,13 +190,13 @@
181 TypeConstants::QUANT_ONE);
182
183 DECL_WITH_KIND(sctx,
184- fn_map_pairs_3_0,
185- (createQName(static_context::W3C_FN_NS, "", "map-pairs"),
186+ fn_for_each_pair_3_0,
187+ (createQName(static_context::W3C_FN_NS, "", "for-each-pair"),
188+ GENV_TYPESYSTEM.ITEM_TYPE_STAR,
189+ GENV_TYPESYSTEM.ITEM_TYPE_STAR,
190 hofParamType,
191- GENV_TYPESYSTEM.ITEM_TYPE_STAR,
192- GENV_TYPESYSTEM.ITEM_TYPE_STAR,
193 GENV_TYPESYSTEM.ITEM_TYPE_STAR),
194- FunctionConsts::FN_MAP_PAIRS_3);
195+ FunctionConsts::FN_FOR_EACH_PAIR_3);
196 }
197
198 {
199@@ -213,9 +213,9 @@
200 DECL_WITH_KIND(sctx,
201 fn_fold_left_3_0,
202 (createQName(static_context::W3C_FN_NS, "", "fold-left"),
203+ GENV_TYPESYSTEM.ITEM_TYPE_STAR,
204+ GENV_TYPESYSTEM.ITEM_TYPE_STAR,
205 hofParamType,
206- GENV_TYPESYSTEM.ITEM_TYPE_STAR,
207- GENV_TYPESYSTEM.ITEM_TYPE_STAR,
208 GENV_TYPESYSTEM.ITEM_TYPE_STAR),
209 FunctionConsts::FN_FOLD_LEFT_3);
210
211@@ -230,9 +230,9 @@
212 DECL_WITH_KIND(sctx,
213 fn_fold_right_3_0,
214 (createQName(static_context::W3C_FN_NS, "", "fold-right"),
215+ GENV_TYPESYSTEM.ITEM_TYPE_STAR,
216+ GENV_TYPESYSTEM.ITEM_TYPE_STAR,
217 hofParamType,
218- GENV_TYPESYSTEM.ITEM_TYPE_STAR,
219- GENV_TYPESYSTEM.ITEM_TYPE_STAR,
220 GENV_TYPESYSTEM.ITEM_TYPE_STAR),
221 FunctionConsts::FN_FOLD_RIGHT_3);
222 }
223
224=== modified file 'src/functions/function_consts.h'
225--- src/functions/function_consts.h 2013-05-03 14:31:19 +0000
226+++ src/functions/function_consts.h 2013-06-05 04:10:35 +0000
227@@ -80,7 +80,7 @@
228 FN_NAME_0,
229 FN_NAME_1,
230
231- FN_MAP_2,
232+ FN_FOR_EACH_2,
233 FN_FILTER_2,
234
235 OP_EXACTLY_ONE_NORAISE_1,
236
237=== modified file 'src/functions/pregenerated/func_fn_hof_functions.cpp'
238--- src/functions/pregenerated/func_fn_hof_functions.cpp 2013-04-10 21:01:35 +0000
239+++ src/functions/pregenerated/func_fn_hof_functions.cpp 2013-06-05 04:10:35 +0000
240@@ -53,14 +53,14 @@
241 return new FunctionArityIterator(sctx, loc, argv);
242 }
243
244-PlanIter_t fn_map_pairs_3_0::codegen(
245+PlanIter_t fn_for_each_pair_3_0::codegen(
246 CompilerCB*,
247 static_context* sctx,
248 const QueryLoc& loc,
249 std::vector<PlanIter_t>& argv,
250 expr& ann) const
251 {
252- return new FnMapPairsIterator(sctx, loc, argv);
253+ return new FnForEachPairIterator(sctx, loc, argv);
254 }
255
256
257
258=== modified file 'src/functions/pregenerated/func_fn_hof_functions.h'
259--- src/functions/pregenerated/func_fn_hof_functions.h 2013-04-10 21:01:35 +0000
260+++ src/functions/pregenerated/func_fn_hof_functions.h 2013-06-05 04:10:35 +0000
261@@ -98,11 +98,11 @@
262 };
263
264
265-//fn:map-pairs
266-class fn_map_pairs_3_0 : public function
267+//fn:for-each-pair
268+class fn_for_each_pair_3_0 : public function
269 {
270 public:
271- fn_map_pairs_3_0(const signature& sig, FunctionConsts::FunctionKind kind)
272+ fn_for_each_pair_3_0(const signature& sig, FunctionConsts::FunctionKind kind)
273 :
274 function(sig, kind)
275 {
276
277=== modified file 'src/functions/pregenerated/function_enum.h'
278--- src/functions/pregenerated/function_enum.h 2013-04-17 21:30:29 +0000
279+++ src/functions/pregenerated/function_enum.h 2013-06-05 04:10:35 +0000
280@@ -210,7 +210,7 @@
281 OP_ZORBA_FUNCTION_LOOKUP_5,
282 FN_FUNCTION_NAME_1,
283 FN_FUNCTION_ARITY_1,
284- FN_MAP_PAIRS_3,
285+ FN_FOR_EACH_PAIR_3,
286 FN_FOLD_LEFT_3,
287 FN_FOLD_RIGHT_3,
288 ZORBA_STORE_INTEGRITY_CONSTRAINTS_STATIC_DDL_ACTIVATE_1,
289
290=== modified file 'src/runtime/hof/fn_hof_functions_impl.cpp'
291--- src/runtime/hof/fn_hof_functions_impl.cpp 2013-05-08 20:14:47 +0000
292+++ src/runtime/hof/fn_hof_functions_impl.cpp 2013-06-05 04:10:35 +0000
293@@ -256,7 +256,7 @@
294 /*******************************************************************************
295
296 ********************************************************************************/
297-FnMapPairsIteratorState::~FnMapPairsIteratorState()
298+FnForEachPairIteratorState::~FnForEachPairIteratorState()
299 {
300 if (theIsOpen)
301 {
302@@ -265,7 +265,7 @@
303 }
304
305
306-void FnMapPairsIteratorState::init(PlanState& planState)
307+void FnForEachPairIteratorState::init(PlanState& planState)
308 {
309 PlanIteratorState::init(planState);
310 thePlanState = &planState;
311@@ -274,7 +274,7 @@
312 }
313
314
315-void FnMapPairsIteratorState::reset(PlanState& planState)
316+void FnForEachPairIteratorState::reset(PlanState& planState)
317 {
318 PlanIteratorState::reset(planState);
319 if (theIsOpen)
320@@ -284,25 +284,25 @@
321 }
322
323
324-uint32_t FnMapPairsIterator::getStateSizeOfSubtree() const
325+uint32_t FnForEachPairIterator::getStateSizeOfSubtree() const
326 {
327- uint32_t size = NaryBaseIterator<FnMapPairsIterator, FnMapPairsIteratorState>::
328+ uint32_t size = NaryBaseIterator<FnForEachPairIterator, FnForEachPairIteratorState>::
329 getStateSizeOfSubtree();
330
331 return size + sizeof(UDFunctionCallIteratorState);
332 }
333
334
335-void FnMapPairsIterator::openImpl(PlanState& planState, uint32_t& offset)
336+void FnForEachPairIterator::openImpl(PlanState& planState, uint32_t& offset)
337 {
338- StateTraitsImpl<FnMapPairsIteratorState>::createState(planState,
339+ StateTraitsImpl<FnForEachPairIteratorState>::createState(planState,
340 theStateOffset,
341 offset);
342
343- StateTraitsImpl<FnMapPairsIteratorState>::initState(planState, theStateOffset);
344+ StateTraitsImpl<FnForEachPairIteratorState>::initState(planState, theStateOffset);
345
346- FnMapPairsIteratorState* state =
347- StateTraitsImpl<FnMapPairsIteratorState>::getState(planState, theStateOffset);
348+ FnForEachPairIteratorState* state =
349+ StateTraitsImpl<FnForEachPairIteratorState>::getState(planState, theStateOffset);
350
351 state->theUDFStateOffset = offset;
352
353@@ -317,27 +317,27 @@
354 }
355
356
357-bool FnMapPairsIterator::nextImpl(
358+bool FnForEachPairIterator::nextImpl(
359 store::Item_t& result,
360 PlanState& planState) const
361 {
362 store::Item_t child1, child2;
363 std::vector<PlanIter_t> arguments;
364-
365- FnMapPairsIteratorState* state;
366- DEFAULT_STACK_INIT(FnMapPairsIteratorState, state, planState);
367-
368- consumeNext(state->theFnItem, theChildren[0], planState);
369+
370+ FnForEachPairIteratorState* state;
371+ DEFAULT_STACK_INIT(FnForEachPairIteratorState, state, planState);
372+
373+ consumeNext(state->theFnItem, theChildren[2], planState);
374
375 // function signature guarantees that
376 ZORBA_ASSERT(state->theFnItem->isFunction());
377
378 while (true)
379 {
380- if (!consumeNext(child1, theChildren[1], planState) ||
381- !consumeNext(child2, theChildren[2], planState))
382+ if (!consumeNext(child1, theChildren[0], planState) ||
383+ !consumeNext(child2, theChildren[1], planState))
384 break;
385-
386+
387 if (child1.getp() && child2.getp())
388 {
389 {
390@@ -348,12 +348,12 @@
391 store::Iterator_t seqIter2 = seq2->getIterator();
392 seqIter1->open();
393 seqIter2->open();
394-
395+
396 arguments.push_back(NULL); // the first argument is expected to be the function item and it is not used
397 arguments.push_back(new PlanStateIteratorWrapper(seqIter1));
398 arguments.push_back(new PlanStateIteratorWrapper(seqIter2));
399 }
400-
401+
402 state->thePlan = static_cast<FunctionItem*>(state->theFnItem.getp())->getImplementation(arguments, planState.theCompilerCB);
403 // must be opened after vars and params are set
404 state->thePlan->open(planState, state->theUDFStateOffset);
405@@ -363,7 +363,7 @@
406 {
407 STACK_PUSH(true, state);
408 }
409-
410+
411 // need to close here early in case the plan is completely
412 // consumed. Otherwise, the plan would still be opened
413 // if destroyed from the state's destructor.
414@@ -452,18 +452,18 @@
415 store::Item_t curSeqItem, nextSeqItem, tempItem;
416 std::vector<store::Item_t> zero;
417 bool haveSeqItems;
418-
419+
420 FnFoldLeftIteratorState* state;
421 DEFAULT_STACK_INIT(FnFoldLeftIteratorState, state, planState);
422
423- consumeNext(state->theFnItem, theChildren[0], planState);
424+ consumeNext(state->theFnItem, theChildren[2], planState);
425
426 // function signature guarantees that
427 ZORBA_ASSERT(state->theFnItem->isFunction());
428
429- if ((haveSeqItems = consumeNext(curSeqItem, theChildren[2], planState)))
430- haveSeqItems = consumeNext(nextSeqItem, theChildren[2], planState);
431-
432+ if ((haveSeqItems = consumeNext(curSeqItem, theChildren[0], planState)))
433+ haveSeqItems = consumeNext(nextSeqItem, theChildren[0], planState);
434+
435 if (curSeqItem.getp() == NULL && nextSeqItem.getp() == NULL)
436 {
437 // consume and return the "zero" argument
438@@ -479,7 +479,7 @@
439 {
440 zero.push_back(tempItem);
441 }
442-
443+
444 while (true)
445 {
446 {
447@@ -490,48 +490,48 @@
448 store::Iterator_t seqIter2 = seq->getIterator();
449 seqIter1->open();
450 seqIter2->open();
451-
452+
453 std::vector<PlanIter_t> arguments;
454 arguments.push_back(NULL);
455 arguments.push_back(new PlanStateIteratorWrapper(seqIter1));
456 arguments.push_back(new PlanStateIteratorWrapper(seqIter2));
457 if (theIsFoldRight)
458 std::reverse(++arguments.begin(), arguments.end());
459-
460+
461 state->thePlan = static_cast<FunctionItem*>(state->theFnItem.getp())->getImplementation(arguments, planState.theCompilerCB);
462 state->thePlan->open(planState, state->theUDFStateOffset);
463 state->theIsOpen = true;
464 }
465-
466+
467 if (curSeqItem.isNull() || nextSeqItem.isNull())
468 break;
469-
470+
471 zero.clear();
472 while (consumeNext(tempItem, state->thePlan, planState))
473 {
474 zero.push_back(tempItem);
475 }
476-
477+
478 state->thePlan->close(planState);
479 state->theIsOpen = false;
480-
481+
482 curSeqItem = nextSeqItem;
483 nextSeqItem = NULL;
484 if (haveSeqItems)
485- haveSeqItems = consumeNext(nextSeqItem, theChildren[2], planState);
486-
487+ haveSeqItems = consumeNext(nextSeqItem, theChildren[0], planState);
488+
489 } // while (true)
490-
491+
492 while (consumeNext(result, state->thePlan, planState))
493 {
494 STACK_PUSH(true, state);
495 }
496-
497+
498 state->thePlan->close(planState);
499 state->theIsOpen = false;
500-
501+
502 } // else
503-
504+
505 STACK_END(state);
506 }
507
508
509=== modified file 'src/runtime/hof/pregenerated/fn_hof_functions.cpp'
510--- src/runtime/hof/pregenerated/fn_hof_functions.cpp 2013-04-16 06:45:24 +0000
511+++ src/runtime/hof/pregenerated/fn_hof_functions.cpp 2013-06-05 04:10:35 +0000
512@@ -120,17 +120,17 @@
513 // </FunctionArityIterator>
514
515
516-// <FnMapPairsIterator>
517-SERIALIZABLE_CLASS_VERSIONS(FnMapPairsIterator)
518+// <FnForEachPairIterator>
519+SERIALIZABLE_CLASS_VERSIONS(FnForEachPairIterator)
520
521-void FnMapPairsIterator::serialize(::zorba::serialization::Archiver& ar)
522+void FnForEachPairIterator::serialize(::zorba::serialization::Archiver& ar)
523 {
524 serialize_baseclass(ar,
525- (NaryBaseIterator<FnMapPairsIterator, FnMapPairsIteratorState>*)this);
526+ (NaryBaseIterator<FnForEachPairIterator, FnForEachPairIteratorState>*)this);
527 }
528
529
530-void FnMapPairsIterator::accept(PlanIterVisitor& v) const
531+void FnForEachPairIterator::accept(PlanIterVisitor& v) const
532 {
533 v.beginVisit(*this);
534
535@@ -143,11 +143,11 @@
536 v.endVisit(*this);
537 }
538
539-FnMapPairsIterator::~FnMapPairsIterator() {}
540-
541-FnMapPairsIteratorState::FnMapPairsIteratorState() {}
542-
543-// </FnMapPairsIterator>
544+FnForEachPairIterator::~FnForEachPairIterator() {}
545+
546+FnForEachPairIteratorState::FnForEachPairIteratorState() {}
547+
548+// </FnForEachPairIterator>
549
550
551 // <FnFoldLeftIterator>
552
553=== modified file 'src/runtime/hof/pregenerated/fn_hof_functions.h'
554--- src/runtime/hof/pregenerated/fn_hof_functions.h 2013-04-16 06:45:24 +0000
555+++ src/runtime/hof/pregenerated/fn_hof_functions.h 2013-06-05 04:10:35 +0000
556@@ -139,7 +139,7 @@
557 *
558 * Author: Zorba Team
559 */
560-class FnMapPairsIteratorState : public PlanIteratorState
561+class FnForEachPairIteratorState : public PlanIteratorState
562 {
563 public:
564 PlanState* thePlanState; //
565@@ -148,33 +148,33 @@
566 uint32_t theUDFStateOffset; //
567 store::Item_t theFnItem; //
568
569- FnMapPairsIteratorState();
570+ FnForEachPairIteratorState();
571
572- ~FnMapPairsIteratorState();
573+ ~FnForEachPairIteratorState();
574
575 void init(PlanState&);
576 void reset(PlanState&);
577 };
578
579-class FnMapPairsIterator : public NaryBaseIterator<FnMapPairsIterator, FnMapPairsIteratorState>
580+class FnForEachPairIterator : public NaryBaseIterator<FnForEachPairIterator, FnForEachPairIteratorState>
581 {
582 public:
583- SERIALIZABLE_CLASS(FnMapPairsIterator);
584+ SERIALIZABLE_CLASS(FnForEachPairIterator);
585
586- SERIALIZABLE_CLASS_CONSTRUCTOR2T(FnMapPairsIterator,
587- NaryBaseIterator<FnMapPairsIterator, FnMapPairsIteratorState>);
588+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(FnForEachPairIterator,
589+ NaryBaseIterator<FnForEachPairIterator, FnForEachPairIteratorState>);
590
591 void serialize( ::zorba::serialization::Archiver& ar);
592
593- FnMapPairsIterator(
594+ FnForEachPairIterator(
595 static_context* sctx,
596 const QueryLoc& loc,
597 std::vector<PlanIter_t>& children)
598 :
599- NaryBaseIterator<FnMapPairsIterator, FnMapPairsIteratorState>(sctx, loc, children)
600+ NaryBaseIterator<FnForEachPairIterator, FnForEachPairIteratorState>(sctx, loc, children)
601 {}
602
603- virtual ~FnMapPairsIterator();
604+ virtual ~FnForEachPairIterator();
605
606 uint32_t getStateSizeOfSubtree() const;
607
608
609=== modified file 'src/runtime/pregenerated/iterator_enum.h'
610--- src/runtime/pregenerated/iterator_enum.h 2013-04-05 21:00:15 +0000
611+++ src/runtime/pregenerated/iterator_enum.h 2013-06-05 04:10:35 +0000
612@@ -130,7 +130,7 @@
613 TYPE_FunctionLookupIterator,
614 TYPE_FunctionNameIterator,
615 TYPE_FunctionArityIterator,
616- TYPE_FnMapPairsIterator,
617+ TYPE_FnForEachPairIterator,
618 TYPE_FnFoldLeftIterator,
619 TYPE_ActivateICIterator,
620 TYPE_DeactivateICIterator,
621
622=== modified file 'src/runtime/spec/hof/fn_hof_functions.xml'
623--- src/runtime/spec/hof/fn_hof_functions.xml 2013-04-16 06:45:24 +0000
624+++ src/runtime/spec/hof/fn_hof_functions.xml 2013-06-05 04:10:35 +0000
625@@ -105,19 +105,19 @@
626
627 <!--
628 /*******************************************************************************
629- fn:map-pairs
630+ fn:for-each-pair
631 ********************************************************************************/
632 -->
633- <zorba:iterator name="FnMapPairsIterator" generateOpenImpl="true" generateGetStateSize="true">
634+ <zorba:iterator name="FnForEachPairIterator" generateOpenImpl="true" generateGetStateSize="true">
635 <zorba:description author="Zorba Team">
636 Applies the function item $f to successive pairs of items taken one from $seq1 and one from $seq2, returning the concatenation of the resulting sequences in order.
637 </zorba:description>
638
639 <zorba:function generateDECL="false">
640- <zorba:signature localname="map-pairs" prefix="fn" version="3.0">
641+ <zorba:signature localname="for-each-pair" prefix="fn" version="3.0">
642+ <zorba:param>item()*</zorba:param>
643+ <zorba:param>item()*</zorba:param>
644 <zorba:param>function()*</zorba:param>
645- <zorba:param>item()*</zorba:param>
646- <zorba:param>item()*</zorba:param>
647 <zorba:output>item()*</zorba:output>
648 </zorba:signature>
649 </zorba:function>
650@@ -144,25 +144,25 @@
651 </zorba:description>
652
653 <zorba:member type="bool" name="theIsFoldRight"/>
654-
655+
656 <zorba:constructor>
657 <zorba:parameter type="bool" name="aIsFoldRight"/>
658 </zorba:constructor>
659
660 <zorba:function generateDECL="false" generateCodegen="false">
661 <zorba:signature localname="fold-left" prefix="fn" version="3.0">
662+ <zorba:param>item()*</zorba:param>
663+ <zorba:param>item()*</zorba:param>
664 <zorba:param>function()*</zorba:param>
665- <zorba:param>item()*</zorba:param>
666- <zorba:param>item()*</zorba:param>
667 <zorba:output>item()*</zorba:output>
668 </zorba:signature>
669 </zorba:function>
670-
671+
672 <zorba:function generateDECL="false" generateCodegen="false">
673 <zorba:signature localname="fold-right" prefix="fn" version="3.0">
674+ <zorba:param>item()*</zorba:param>
675+ <zorba:param>item()*</zorba:param>
676 <zorba:param>function()*</zorba:param>
677- <zorba:param>item()*</zorba:param>
678- <zorba:param>item()*</zorba:param>
679 <zorba:output>item()*</zorba:output>
680 </zorba:signature>
681 </zorba:function>
682@@ -174,7 +174,7 @@
683 <zorba:member type="uint32_t" name="theUDFStateOffset"/>
684 <zorba:member type="store::Item_t" name="theFnItem"/>
685 </zorba:state>
686-
687+
688 </zorba:iterator>
689-
690+
691 </zorba:iterators>
692
693=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
694--- src/runtime/visitors/pregenerated/planiter_visitor.h 2013-04-05 21:00:15 +0000
695+++ src/runtime/visitors/pregenerated/planiter_visitor.h 2013-06-05 04:10:35 +0000
696@@ -266,7 +266,7 @@
697
698 class FunctionArityIterator;
699
700- class FnMapPairsIterator;
701+ class FnForEachPairIterator;
702
703 class FnFoldLeftIterator;
704
705@@ -1128,8 +1128,8 @@
706 virtual void beginVisit ( const FunctionArityIterator& ) = 0;
707 virtual void endVisit ( const FunctionArityIterator& ) = 0;
708
709- virtual void beginVisit ( const FnMapPairsIterator& ) = 0;
710- virtual void endVisit ( const FnMapPairsIterator& ) = 0;
711+ virtual void beginVisit ( const FnForEachPairIterator& ) = 0;
712+ virtual void endVisit ( const FnForEachPairIterator& ) = 0;
713
714 virtual void beginVisit ( const FnFoldLeftIterator& ) = 0;
715 virtual void endVisit ( const FnFoldLeftIterator& ) = 0;
716
717=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
718--- src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-04-05 21:00:15 +0000
719+++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-06-05 04:10:35 +0000
720@@ -1537,18 +1537,18 @@
721 // </FunctionArityIterator>
722
723
724-// <FnMapPairsIterator>
725-void PrinterVisitor::beginVisit ( const FnMapPairsIterator& a) {
726- thePrinter.startBeginVisit("FnMapPairsIterator", ++theId);
727+// <FnForEachPairIterator>
728+void PrinterVisitor::beginVisit ( const FnForEachPairIterator& a) {
729+ thePrinter.startBeginVisit("FnForEachPairIterator", ++theId);
730 printCommons( &a, theId );
731 thePrinter.endBeginVisit( theId );
732 }
733
734-void PrinterVisitor::endVisit ( const FnMapPairsIterator& ) {
735+void PrinterVisitor::endVisit ( const FnForEachPairIterator& ) {
736 thePrinter.startEndVisit();
737 thePrinter.endEndVisit();
738 }
739-// </FnMapPairsIterator>
740+// </FnForEachPairIterator>
741
742
743 // <FnFoldLeftIterator>
744
745=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
746--- src/runtime/visitors/pregenerated/printer_visitor.h 2013-04-05 21:00:15 +0000
747+++ src/runtime/visitors/pregenerated/printer_visitor.h 2013-06-05 04:10:35 +0000
748@@ -409,8 +409,8 @@
749 void beginVisit( const FunctionArityIterator& );
750 void endVisit ( const FunctionArityIterator& );
751
752- void beginVisit( const FnMapPairsIterator& );
753- void endVisit ( const FnMapPairsIterator& );
754+ void beginVisit( const FnForEachPairIterator& );
755+ void endVisit ( const FnForEachPairIterator& );
756
757 void beginVisit( const FnFoldLeftIterator& );
758 void endVisit ( const FnFoldLeftIterator& );
759
760=== modified file 'test/fots/CMakeLists.txt'
761--- test/fots/CMakeLists.txt 2013-05-31 07:21:49 +0000
762+++ test/fots/CMakeLists.txt 2013-06-05 04:10:35 +0000
763@@ -269,8 +269,6 @@
764 EXPECTED_FOTS_FAILURE (prod-FunctionDecl function-decl-reserved-function-names-029 1147547)
765 EXPECTED_FOTS_FAILURE (prod-FunctionDecl function-decl-reserved-function-names-031 1147547)
766 EXPECTED_FOTS_FAILURE (prod-InstanceofExpr instanceof113 0)
767-EXPECTED_FOTS_FAILURE (prod-InstanceofExpr instanceof132 0)
768-EXPECTED_FOTS_FAILURE (prod-InstanceofExpr instanceof133 0)
769 EXPECTED_FOTS_FAILURE (prod-InstanceofExpr instanceof139 1160559)
770 EXPECTED_FOTS_FAILURE (prod-InstanceofExpr instanceof140 0)
771 EXPECTED_FOTS_FAILURE (prod-InstanceofExpr cbcl-instance-of-001 0)
772@@ -366,81 +364,21 @@
773 EXPECTED_FOTS_FAILURE (xs-error xs-error-041 1170470)
774 EXPECTED_FOTS_FAILURE (xs-error xs-error-042 1170470)
775 EXPECTED_FOTS_FAILURE (xs-error xs-error-049 1170470)
776-EXPECTED_FOTS_FAILURE (fn-filter filter-001 1182910) #Changes in F&O spec
777-EXPECTED_FOTS_FAILURE (fn-filter filter-002 1182910)
778-EXPECTED_FOTS_FAILURE (fn-filter filter-003 1182910)
779-EXPECTED_FOTS_FAILURE (fn-filter filter-004 1182910)
780-EXPECTED_FOTS_FAILURE (fn-filter filter-005 1182910)
781-EXPECTED_FOTS_FAILURE (fn-filter fn-filter-013 1182910)
782-EXPECTED_FOTS_FAILURE (fn-filter fn-filter-014 1182910)
783-EXPECTED_FOTS_FAILURE (fn-filter fn-filter-017 1182910)
784-EXPECTED_FOTS_FAILURE (fn-filter fn-filter-020 1182910)
785-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-001 1182910)
786-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-002 1182910)
787-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-003 1182910)
788-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-004 1182910)
789-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-005 1182910)
790-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-006 1182910)
791-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-007 1182910)
792-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-008 1182910)
793-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-015 1182910)
794-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-016 1182910)
795-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-017 1182910)
796-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-018 1182910)
797-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-019 1182910)
798-EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-020 1182910)
799-EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-001 1182910)
800-EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-002 1182910)
801-EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-003 1182910)
802-EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-004 1182910)
803 EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-005 1182910)
804 EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-006 1182910)
805 EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-007 1182910)
806-EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-013 1182910)
807 EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-014 1182910)
808 EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-015 1182910)
809 EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-016 1182910)
810 EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-017 1182910)
811-EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-018 1182910)
812-EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-019 1182910)
813-EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-020 1182910)
814-EXPECTED_FOTS_FAILURE (fn-for-each for-each-001 1182910)
815-EXPECTED_FOTS_FAILURE (fn-for-each for-each-002 1182910)
816-EXPECTED_FOTS_FAILURE (fn-for-each for-each-003 1182910)
817-EXPECTED_FOTS_FAILURE (fn-for-each for-each-004 1182910)
818-EXPECTED_FOTS_FAILURE (fn-for-each for-each-005 1182910)
819-EXPECTED_FOTS_FAILURE (fn-for-each for-each-006 1182910)
820-EXPECTED_FOTS_FAILURE (fn-for-each for-each-007 1182910)
821-EXPECTED_FOTS_FAILURE (fn-for-each for-each-008 1182910)
822-EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-423 1182910)
823 EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-424 1182910)
824 EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-426 1182910)
825-EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-428 1182910)
826 EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-430 1182910)
827-EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-431 1182910)
828-EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-432 1182910)
829-EXPECTED_FOTS_FAILURE (fn-for-each-pair for-each-pair-001 1182910)
830-EXPECTED_FOTS_FAILURE (fn-for-each-pair for-each-pair-002 1182910)
831-EXPECTED_FOTS_FAILURE (fn-for-each-pair for-each-pair-003 1182910)
832-EXPECTED_FOTS_FAILURE (fn-for-each-pair for-each-pair-004 1182910)
833-EXPECTED_FOTS_FAILURE (fn-for-each-pair for-each-pair-005 1182910)
834-EXPECTED_FOTS_FAILURE (fn-for-each-pair for-each-pair-006 1182910)
835-EXPECTED_FOTS_FAILURE (fn-for-each-pair for-each-pair-007 1182910)
836-EXPECTED_FOTS_FAILURE (fn-for-each-pair for-each-pair-008 1182910)
837-EXPECTED_FOTS_FAILURE (fn-for-each-pair fn-for-each-pair-008 1182910)
838-EXPECTED_FOTS_FAILURE (fn-for-each-pair fn-for-each-pair-017 1182910)
839-EXPECTED_FOTS_FAILURE (fn-for-each-pair fn-for-each-pair-025 1182910)
840 EXPECTED_FOTS_FAILURE (fn-for-each-pair fn-for-each-pair-026 1182910)
841-EXPECTED_FOTS_FAILURE (fn-for-each-pair fn-for-each-pair-027 1182910)
842 EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-062 1182910)
843-EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-423 1182910)
844 EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-424 1182910)
845 EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-426 1182910)
846-EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-428 1182910)
847 EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-430 1182910)
848-EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-431 1182910)
849-EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-432 1182910)
850-EXPECTED_FOTS_FAILURE (misc-HigherOrderFunctions xqhof3 0) #this is a test-case that was updated in FOTS
851 EXPECTED_FOTS_FAILURE (prod-CompNamespaceConstructor nscons-042 0)
852
853 # Initialize FOTSExpectedFailures.xml
854
855=== modified file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-7.xml.res'
856--- test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-7.xml.res 2013-03-04 21:00:58 +0000
857+++ test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-7.xml.res 2013-06-05 04:10:35 +0000
858@@ -1,1 +1,1 @@
859-QName abs adjust-date-to-timezone adjust-dateTime-to-timezone adjust-time-to-timezone analyze-string available-environment-variables avg base-uri boolean ceiling codepoint-equal codepoints-to-string collection compare concat contains count current-date current-dateTime current-time data dateTime day-from-date day-from-dateTime days-from-duration deep-equal default-collation distinct-values doc doc-available document-uri element-with-id empty encode-for-uri ends-with environment-variable error escape-html-uri exactly-one exists false filter floor fold-left fold-right format-date format-dateTime format-integer format-number format-time function-arity function-lookup function-name generate-id has-children head hours-from-dateTime hours-from-duration hours-from-time id idref implicit-timezone in-scope-prefixes index-of innermost insert-before iri-to-uri lang last local-name local-name-from-QName lower-case map map-pairs matches max min minutes-from-dateTime minutes-from-duration minutes-from-time month-from-date month-from-dateTime months-from-duration name namespace-uri namespace-uri-for-prefix namespace-uri-from-QName nilled node-name normalize-space normalize-unicode not number one-or-more outermost parse-xml parse-xml-fragment path position prefix-from-QName put remove replace resolve-QName resolve-uri reverse root round round-half-to-even seconds-from-dateTime seconds-from-duration seconds-from-time serialize starts-with static-base-uri string string-join string-length string-to-codepoints subsequence substring substring-after substring-before sum tail timezone-from-date timezone-from-dateTime timezone-from-time tokenize trace translate true unordered unparsed-text unparsed-text-available unparsed-text-lines upper-case uri-collection year-from-date year-from-dateTime years-from-duration zero-or-one acos asin atan atan2 cos exp exp10 log log10 pi pow sin sqrt tan base-uri boundary-space-policy construction-mode copy-namespaces-mode default-collation default-collection-type default-function-namespace default-order function-annotations function-arguments-count function-names in-scope-attribute-declarations in-scope-attribute-groups in-scope-element-declarations in-scope-element-groups in-scope-schema-types in-scope-variables option ordering-mode statically-known-collations statically-known-document-type statically-known-documents statically-known-namespace-binding statically-known-namespaces xpath10-compatibility-mode
860+QName abs adjust-date-to-timezone adjust-dateTime-to-timezone adjust-time-to-timezone analyze-string available-environment-variables avg base-uri boolean ceiling codepoint-equal codepoints-to-string collection compare concat contains count current-date current-dateTime current-time data dateTime day-from-date day-from-dateTime days-from-duration deep-equal default-collation distinct-values doc doc-available document-uri element-with-id empty encode-for-uri ends-with environment-variable error escape-html-uri exactly-one exists false filter floor fold-left fold-right for-each for-each-pair format-date format-dateTime format-integer format-number format-time function-arity function-lookup function-name generate-id has-children head hours-from-dateTime hours-from-duration hours-from-time id idref implicit-timezone in-scope-prefixes index-of innermost insert-before iri-to-uri lang last local-name local-name-from-QName lower-case matches max min minutes-from-dateTime minutes-from-duration minutes-from-time month-from-date month-from-dateTime months-from-duration name namespace-uri namespace-uri-for-prefix namespace-uri-from-QName nilled node-name normalize-space normalize-unicode not number one-or-more outermost parse-xml parse-xml-fragment path position prefix-from-QName put remove replace resolve-QName resolve-uri reverse root round round-half-to-even seconds-from-dateTime seconds-from-duration seconds-from-time serialize starts-with static-base-uri string string-join string-length string-to-codepoints subsequence substring substring-after substring-before sum tail timezone-from-date timezone-from-dateTime timezone-from-time tokenize trace translate true unordered unparsed-text unparsed-text-available unparsed-text-lines upper-case uri-collection year-from-date year-from-dateTime years-from-duration zero-or-one acos asin atan atan2 cos exp exp10 log log10 pi pow sin sqrt tan base-uri boundary-space-policy construction-mode copy-namespaces-mode default-collation default-collection-type default-function-namespace default-order function-annotations function-arguments-count function-names in-scope-attribute-declarations in-scope-attribute-groups in-scope-element-declarations in-scope-element-groups in-scope-schema-types in-scope-variables option ordering-mode statically-known-collations statically-known-document-type statically-known-documents statically-known-namespace-binding statically-known-namespaces xpath10-compatibility-mode
861\ No newline at end of file
862
863=== modified file 'test/rbkt/Queries/w3c_known_failures.txt'
864--- test/rbkt/Queries/w3c_known_failures.txt 2013-05-29 00:06:48 +0000
865+++ test/rbkt/Queries/w3c_known_failures.txt 2013-06-05 04:10:35 +0000
866@@ -21,6 +21,42 @@
867 test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/FoldRight/fold-right-003
868 test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/FoldRight/fold-right-006
869 test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/FoldRight/fold-right-007
870+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Map/map-004
871+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Map/map-903
872+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Map/map-007
873+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Map/map-001
874+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Map/map-002
875+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Map/map-008
876+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Map/map-006
877+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Map/map-003
878+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Map/map-005
879+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Map/map-902
880+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Map/map-901
881+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Filter/filter-001
882+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Filter/filter-004
883+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Filter/filter-005
884+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Filter/filter-003
885+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/Filter/filter-002
886+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/FoldLeft/fold-left-006
887+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/FoldLeft/fold-left-003
888+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/FoldLeft/fold-left-002
889+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/FoldLeft/fold-left-007
890+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/FoldLeft/fold-left-008
891+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/FoldLeft/fold-left-004
892+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/FoldLeft/fold-left-001
893+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/FoldLeft/fold-left-009
894+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/FoldLeft/fold-left-005
895+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/FoldRight/fold-right-004
896+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/MapPairs/map-pairs-006
897+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/MapPairs/map-pairs-002
898+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/MapPairs/map-pairs-007
899+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/MapPairs/map-pairs-901
900+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/MapPairs/map-pairs-003
901+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/MapPairs/map-pairs-005
902+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/MapPairs/map-pairs-001
903+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/MapPairs/map-pairs-004
904+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/MapPairs/map-pairs-008
905+test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/MapPairs/map-pairs-902
906 test/rbkt/w3c_testsuite/XQuery/FunctX/functx-fn-tokenize/functx-fn-tokenize-all
907 test/rbkt/w3c_testsuite/XQuery/FunctX/functx-fn-tokenize/functx-fn-tokenize-7
908 test/rbkt/w3c_testsuite/XQuery/Functions/AllStringFunc/MatchStringFunc/MatchesFunc/K2-MatchesFunc-5
909
910=== modified file 'test/rbkt/Queries/w3c_known_failures_XQueryX.txt'
911--- test/rbkt/Queries/w3c_known_failures_XQueryX.txt 2013-05-29 00:07:09 +0000
912+++ test/rbkt/Queries/w3c_known_failures_XQueryX.txt 2013-06-05 04:10:35 +0000
913@@ -20,6 +20,42 @@
914 test/rbkt/w3c_testsuite/XQueryX/Expressions/HigherOrder/hof-916
915 test/rbkt/w3c_testsuite/XQueryX/Expressions/HigherOrder/hof-049
916 test/rbkt/w3c_testsuite/XQueryX/Expressions/HigherOrder/hof-047
917+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Map/map-901
918+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Map/map-001
919+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Map/map-003
920+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Map/map-007
921+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Map/map-006
922+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Map/map-903
923+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Map/map-008
924+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Map/map-902
925+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Map/map-002
926+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Map/map-004
927+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Map/map-005
928+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Filter/filter-002
929+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Filter/filter-005
930+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Filter/filter-003
931+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Filter/filter-001
932+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/Filter/filter-004
933+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/FoldLeft/fold-left-002
934+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/FoldLeft/fold-left-004
935+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/FoldLeft/fold-left-007
936+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/FoldLeft/fold-left-008
937+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/FoldLeft/fold-left-001
938+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/FoldLeft/fold-left-009
939+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/FoldLeft/fold-left-003
940+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/FoldLeft/fold-left-005
941+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/FoldLeft/fold-left-006
942+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/FoldRight/fold-right-004
943+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/MapPairs/map-pairs-008
944+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/MapPairs/map-pairs-007
945+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/MapPairs/map-pairs-003
946+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/MapPairs/map-pairs-005
947+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/MapPairs/map-pairs-001
948+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/MapPairs/map-pairs-902
949+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/MapPairs/map-pairs-901
950+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/MapPairs/map-pairs-002
951+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/MapPairs/map-pairs-006
952+test/rbkt/w3c_testsuite/XQueryX/Functions/HigherOrder/MapPairs/map-pairs-004
953 test/rbkt/w3c_testsuite/XQueryX/exprSeqTypes/PrologExpr/VariableProlog/ExternalVariablesWith/K2-ExternalVariablesWith-22
954 test/rbkt/w3c_testsuite/XQueryX/exprSeqTypes/SeqExprCast/K2-SeqExprCast-231
955 test/rbkt/w3c_testsuite/XQueryX/exprSeqTypes/SeqExprCast/K2-SeqExprCast-232
956
957=== modified file 'test/rbkt/Queries/zorba/spec/XQuery_3.0.html'
958--- test/rbkt/Queries/zorba/spec/XQuery_3.0.html 2013-02-07 17:24:36 +0000
959+++ test/rbkt/Queries/zorba/spec/XQuery_3.0.html 2013-06-05 04:10:35 +0000
960@@ -1,10 +1,11 @@
961-<!--XSLT Processor: SAXON 9.1.0.5 from Saxonica SAXON 9.1.0.5--><html xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/xhtml" lang="EN" xml:lang="EN">
962+<!--XSLT Processor: SAXON 9.3.0.5 from Saxonica SAXON EE 9.3.0.5--><html xmlns="http://www.w3.org/1999/xhtml" lang="EN" xml:lang="EN">
963 <head>
964- <meta name="generator" content="HTML Tidy for Mac OS X (vers 31 October 2006 - Apple Inc. build 15.6), see www.w3.org"/>
965+ <meta name="generator" content="HTML Tidy for Windows (vers 14 February 2006), see www.w3.org"/>
966 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
967 <title>XPath and XQuery Functions and Operators 3.0</title>
968 <style type="text/css">
969 /**/
970+/* from xsl:query.xsl (C) */
971 code { font-family: monospace; }
972
973 div.constraint,
974@@ -28,6 +29,7 @@
975 color: #8F8F8F;
976 }
977
978+/* from xsl:query.xsl (D) */
979 div.exampleInner pre { margin-left: 1em;
980 margin-top: 0em; margin-bottom: 0em}
981 div.exampleOuter {border: 4px double gray;
982@@ -166,6 +168,7 @@
983 }
984
985
986+/* from xsl-query.xsl (B) */
987 table.small { font-size: x-small; }
988 a.judgment:visited, a.judgment:link { font-family: sans-serif;
989 color: black;
990@@ -176,7 +179,7 @@
991 text-decoration: none }
992 /**/
993 </style>
994- <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-WD.css"/>
995+ <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-CR.css"/>
996 </head>
997 <body>
998 <div class="head">
999@@ -189,12 +192,12 @@
1000 <a name="title" id="title"/>XPath and XQuery Functions and
1001 Operators 3.0</h1>
1002 <h2>
1003- <a name="w3c-doctype" id="w3c-doctype"/>W3C Working Draft 13
1004-December 2011</h2>
1005+ <a name="w3c-doctype" id="w3c-doctype"/>W3C Candidate
1006+Recommendation 21 May 2013</h2>
1007 <dl>
1008 <dt>This version:</dt>
1009 <dd>
1010- <a href="http://www.w3.org/TR/2011/WD-xpath-functions-30-20111213/">http://www.w3.org/TR/2011/WD-xpath-functions-30-20111213/</a>
1011+ <a href="http://www.w3.org/TR/2013/CR-xpath-functions-30-20130521/">http://www.w3.org/TR/2013/CR-xpath-functions-30-20130521/</a>
1012 </dd>
1013 <dt>Latest version:</dt>
1014 <dd>
1015@@ -202,6 +205,8 @@
1016 </dd>
1017 <dt>Previous versions:</dt>
1018 <dd>
1019+ <a href="http://www.w3.org/TR/2013/CR-xpath-functions-30-20130108/">http://www.w3.org/TR/2013/CR-xpath-functions-30-20130108/</a>
1020+ <a href="http://www.w3.org/TR/2011/WD-xpath-functions-30-20111213/">http://www.w3.org/TR/2011/WD-xpath-functions-30-20111213/</a>
1021 <a href="http://www.w3.org/TR/2011/WD-xpath-functions-30-20110614/">http://www.w3.org/TR/2011/WD-xpath-functions-30-20110614/</a>
1022 <a href="http://www.w3.org/TR/2010/WD-xpath-functions-30-20101214/">http://www.w3.org/TR/2010/WD-xpath-functions-30-20101214/</a>
1023 <a href="http://www.w3.org/TR/2009/WD-xpath-functions-11-20091215/">http://www.w3.org/TR/2009/WD-xpath-functions-11-20091215/</a>
1024@@ -214,11 +219,11 @@
1025 <strong>translations</strong>
1026 </a>.</p>
1027 <p>This document is also available in these non-normative formats:
1028-<a href="http://www.w3.org/TR/2011/WD-xpath-functions-30-20111213/xpath-functions-30.xml">
1029-XML</a> and <a href="http://www.w3.org/TR/2011/WD-xpath-functions-30-20111213/xpath-functions-30-diff.html">Change
1030+<a href="http://www.w3.org/TR/2013/CR-xpath-functions-30-20130521/xpath-functions-30.xml">
1031+XML</a> and <a href="http://www.w3.org/TR/2013/CR-xpath-functions-30-20130521/xpath-functions-30-diff.html">Change
1032 markings relative to previous Working Draft</a>.</p>
1033 <p class="copyright">
1034- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2011 <a href="http://www.w3.org/">
1035+ <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2013 <a href="http://www.w3.org/">
1036 <acronym title="World Wide Web Consortium">W3C</acronym>
1037 </a>
1038 <sup>®</sup>
1039@@ -227,8 +232,8 @@
1040 </a>, <a href="http://www.ercim.eu/">
1041 <acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym>
1042 </a>,
1043-<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
1044-W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
1045+<a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. W3C
1046+<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
1047 <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
1048 and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
1049 use</a> rules apply.</p>
1050@@ -273,21 +278,40 @@
1051 progressed to Recommendation together (XQuery 3.0, XQueryX 3.0,
1052 XSLT 3.0, Data Model 3.0, Functions and Operators 3.0,
1053 Serialization 3.0, XPath 3.0).</p>
1054- <p>This is a <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#last-call">Last
1055-Call Working Draft</a> as described in the <a href="http://www.w3.org/2005/10/Process-20051014/tr.html">Process
1056-Document</a>. It was jointly developed by the W3C <a href="http://www.w3.org/XML/Query/">XML Query Working Group</a> and the
1057-W3C <a href="http://www.w3.org/Style/XSL/">XSL Working Group</a>,
1058-each of which is part of the <a href="http://www.w3.org/XML/Activity">XML Activity</a>. Comments on this
1059-document will be formally accepted at least through 10 February
1060-2012. The Working Groups expect to advance this specification to
1061-<a href="http://www.w3.org/2005/10/Process-20051014/tr.html#RecsW3C">Recommendation</a>
1062+ <p>W3C publishes a <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#RecsCR">Candidate
1063+Recommendation</a>, as described in the <a href="http://www.w3.org/2005/10/Process-20051014/tr.html">Process
1064+Document</a>, to indicate that the document is believed to be
1065+stable and to encourage implementation by the developer community.
1066+The publication of this document constitutes a <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#cfi">call for
1067+implementations</a> of this specification.</p>
1068+ <p>This document was jointly developed by the W3C <a href="http://www.w3.org/XML/Query/">XML Query Working Group</a> and the
1069+W3C <a href="http://www.w3.org/Style/XSL/">XSLT Working Group</a>,
1070+each of which is part of the <a href="http://www.w3.org/XML/Activity">XML Activity</a>. It will remain a
1071+Candidate Recommendation until at least 08 April 2013. The Working
1072+Groups expect to advance this specification to <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#RecsW3C">Recommendation</a>
1073 Status.</p>
1074- <p>This Last Call Working Draft makes a number of substantive
1075-technical changes (as well as many editorial changes), including
1076-new features, adopted since the previous Working Draft was
1077-published. Please note that this Working Draft of XPath and XQuery
1078-Functions and Operators 3.0 represents the second version of
1079-<a href="http://www.w3.org/TR/2010/REC-xpath-functions-20101214/">a
1080+ <p>Once the entrance criteria for Proposed Recommendation have been
1081+achieved, the Director will be requested to advance this document
1082+to <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#RecsPR">Proposed
1083+Recommendation</a> status. Working closely with the developer
1084+community, we expect to show evidence of implementations by
1085+approximately 31 July 2013.</p>
1086+ <p>This updated Candidate Recommendation is being published to
1087+allow document reviewers and implementors to see in context all
1088+changes that have been made during the CR review period. The most
1089+important changes are to the names of the functions formerly named
1090+"fn:map" and "fn:map-pairs" (renamed "fn:for-each" and
1091+"fn:for-each-pair", respectively), and to the order of arguments
1092+for these two functions as well as fn:filter, fn:fold-left, and
1093+fn:fold-right. The motivation for the change is partly usability,
1094+and partly concern about possible conflicts with features being
1095+considered for future releases. A full list of changes since the
1096+Candidate Recommendation of 08 January 2013 is at <a href="#substantive-changes-current-draft">
1097+ <b>E.4 Substantive changes
1098+(post Candidate Recommendation)</b>
1099+ </a>. Please note that this
1100+Candidate Recommendation of XPath and XQuery Functions and
1101+Operators 3.0 represents the second version of <a href="http://www.w3.org/TR/2010/REC-xpath-functions-20101214/">a
1102 previous W3C Recommendation</a>.</p>
1103 <p>This specification is designed to be referenced normatively from
1104 other specifications defining a host language for it; it is not
1105@@ -295,18 +319,18 @@
1106 implementability of this specification has been tested in the
1107 context of its normative inclusion in host languages defined by the
1108 <a href="http://www.w3.org/TR/xquery-30/">XQuery 3.0</a> and XSLT
1109-3.0 (expected in 2012) specifications; see the <a href="http://dev.w3.org/2011/xquery-30-test-suite/results/XQTSReport.html">
1110-XQuery 3.0 implementation report</a> (and, in the future, the WGs
1111-expect that there will also be a member-only XSLT 3.0
1112+3.0 (expected in 2013) specifications; see the <a href="http://dev.w3.org/2011/QT3-test-suite/reports/QT3TSReport.html">XQuery
1113+3.0 implementation report</a> (and, in the future, the WGs expect
1114+that there will also be a — possibly member-only — XSLT 3.0
1115 implementation report) for details.</p>
1116- <p>This document incorporates changes made against the previous
1117-publication of the Working Draft. Changes to this document since
1118-the previous publication of the Working Draft are detailed in
1119-<a href="#changelog">
1120- <b>F Changes since previous
1121-Recommendation</b>
1122+ <p>This document incorporates changes made against the <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#last-call">Last
1123+Call Working Draft</a> of 13 December 2011. Changes to this
1124+document since the <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#last-call">Last
1125+Call Working Draft</a> are detailed in <a href="#changelog">
1126+ <b>E
1127+Changes since previous Recommendation</b>
1128 </a>.</p>
1129- <p>Please report errors in this document using W3C's <a href="http://www.w3.org/Bugs/Public/">public Bugzilla system</a>
1130+ <p>Please report errors in this document using W3C's <a href="https://www.w3.org/Bugs/Public/">public Bugzilla system</a>
1131 (instructions can be found at <a href="http://www.w3.org/XML/2005/04/qt-bugzilla">http://www.w3.org/XML/2005/04/qt-bugzilla</a>).
1132 If access to that system is not feasible, you may send your
1133 comments to the W3C XSLT/XPath/XQuery public comments mailing list,
1134@@ -316,10 +340,10 @@
1135 Please use multiple Bugzilla entries (or, if necessary, multiple
1136 email messages) if you have more than one comment to make. Archives
1137 of the comments and responses are available at <a href="http://lists.w3.org/Archives/Public/public-qt-comments/">http://lists.w3.org/Archives/Public/public-qt-comments/</a>.</p>
1138- <p>Publication as a Working Draft does not imply endorsement by the
1139-W3C Membership. This is a draft document and may be updated,
1140-replaced or obsoleted by other documents at any time. It is
1141-inappropriate to cite this document as other than work in
1142+ <p>Publication as a Candidate Recommendation does not imply
1143+endorsement by the W3C Membership. This is a draft document and may
1144+be updated, replaced or obsoleted by other documents at any time.
1145+It is inappropriate to cite this document as other than work in
1146 progress.</p>
1147 <p>This document was produced by groups operating under the
1148 <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
1149@@ -386,7 +410,7 @@
1150 <li>
1151 <p>
1152 <a href="#func-false">false</a>  <a href="#func-filter">filter</a>  <a href="#func-floor">floor</a> 
1153-<a href="#func-fold-left">fold-left</a>  <a href="#func-fold-right">fold-right</a>  <a href="#func-format-date">format-date</a>  <a href="#func-format-dateTime">format-dateTime</a>  <a href="#func-format-integer">format-integer</a>  <a href="#func-format-number">format-number</a>  <a href="#func-format-time">format-time</a>  <a href="#func-function-arity">function-arity</a>  <a href="#func-function-lookup">function-lookup</a>  <a href="#func-function-name">function-name</a> </p>
1154+<a href="#func-fold-left">fold-left</a>  <a href="#func-fold-right">fold-right</a>  <a href="#func-for-each">for-each</a>  <a href="#func-for-each-pair">for-each-pair</a>  <a href="#func-format-date">format-date</a>  <a href="#func-format-dateTime">format-dateTime</a>  <a href="#func-format-integer">format-integer</a>  <a href="#func-format-number">format-number</a>  <a href="#func-format-time">format-time</a>  <a href="#func-function-arity">function-arity</a>  <a href="#func-function-lookup">function-lookup</a>  <a href="#func-function-name">function-name</a> </p>
1155 </li>
1156 <li>
1157 <p>
1158@@ -409,7 +433,7 @@
1159 </li>
1160 <li>
1161 <p>
1162- <a href="#func-map">map</a>  <a href="#func-map-pairs">map-pairs</a>  <a href="#func-matches">matches</a>  <a href="#func-max">max</a>  <a href="#func-min">min</a>  <a href="#func-minutes-from-dateTime">minutes-from-dateTime</a>  <a href="#func-minutes-from-duration">minutes-from-duration</a>  <a href="#func-minutes-from-time">minutes-from-time</a>  <a href="#func-month-from-date">month-from-date</a>  <a href="#func-month-from-dateTime">month-from-dateTime</a>  <a href="#func-months-from-duration">months-from-duration</a>  <a href="#func-multiply-dayTimeDuration">multiply-dayTimeDuration</a> 
1163+ <a href="#func-matches">matches</a>  <a href="#func-max">max</a>  <a href="#func-min">min</a>  <a href="#func-minutes-from-dateTime">minutes-from-dateTime</a>  <a href="#func-minutes-from-duration">minutes-from-duration</a>  <a href="#func-minutes-from-time">minutes-from-time</a>  <a href="#func-month-from-date">month-from-date</a>  <a href="#func-month-from-dateTime">month-from-dateTime</a>  <a href="#func-months-from-duration">months-from-duration</a>  <a href="#func-multiply-dayTimeDuration">multiply-dayTimeDuration</a> 
1164 <a href="#func-multiply-yearMonthDuration">multiply-yearMonthDuration</a> </p>
1165 </li>
1166 <li>
1167@@ -1178,7 +1202,7 @@
1168     16.2 <a href="#basic-hofs">Basic higher-order
1169 functions</a>
1170 <br/>
1171-        16.2.1 <a href="#func-map">fn:map</a>
1172+        16.2.1 <a href="#func-for-each">fn:for-each</a>
1173 <br/>
1174         16.2.2 <a href="#func-filter">fn:filter</a>
1175 <br/>
1176@@ -1186,17 +1210,23 @@
1177 <br/>
1178         16.2.4 <a href="#func-fold-right">fn:fold-right</a>
1179 <br/>
1180-        16.2.5 <a href="#func-map-pairs">fn:map-pairs</a>
1181+        16.2.5 <a href="#func-for-each-pair">fn:for-each-pair</a>
1182 <br/>
1183 17 <a href="#constructor-functions">Constructor functions</a>
1184 <br/>
1185     17.1 <a href="#constructor-functions-for-xsd-types">Constructor
1186-functions for XML Schema built-in types</a>
1187+functions for XML Schema built-in atomic types</a>
1188 <br/>
1189     17.2 <a href="#constructor-qname-notation">Constructor
1190 functions for xs:QName and xs:NOTATION</a>
1191 <br/>
1192-    17.3 <a href="#constructor-functions-for-user-defined-types">Constructor
1193+    17.3 <a href="#constructor-functions-for-xsd-list-types">Constructor functions
1194+for XML Schema built-in list types</a>
1195+ <br/>
1196+    17.4 <a href="#constructor-functions-for-xsd-union-types">Constructor functions
1197+for XML Schema built-in union types</a>
1198+ <br/>
1199+    17.5 <a href="#constructor-functions-for-user-defined-types">Constructor
1200 functions for user-defined types</a>
1201 <br/>
1202 18 <a href="#casting">Casting</a>
1203@@ -1267,62 +1297,64 @@
1204 <br/>
1205 B <a href="#error-summary">Error summary</a>
1206 <br/>
1207-C <a href="#xpath1-compatibility">Compatibility with XPath 1.0</a>
1208-(Non-Normative)<br/>
1209-D <a href="#examples">Illustrative user-written functions</a>
1210-(Non-Normative)<br/>
1211-    D.1 <a href="#if-empty-if-absent">eg:if-empty and
1212+C <a href="#examples">Illustrative user-written functions</a>
1213+(Non-Normative)<br/>
1214+    C.1 <a href="#if-empty-if-absent">eg:if-empty and
1215 eg:if-absent</a>
1216 <br/>
1217-        D.1.1 <a href="#if-empty">eg:if-empty</a>
1218- <br/>
1219-        D.1.2 <a href="#if-absent">eg:if-absent</a>
1220- <br/>
1221-    D.2 <a href="#union-intersect-except-on-values">Union,
1222+        C.1.1 <a href="#if-empty">eg:if-empty</a>
1223+ <br/>
1224+        C.1.2 <a href="#if-absent">eg:if-absent</a>
1225+ <br/>
1226+    C.2 <a href="#union-intersect-except-on-values">Union,
1227 intersection and difference on sequences of values</a>
1228 <br/>
1229-        D.2.1 <a href="#value-union">eg:value-union</a>
1230- <br/>
1231-        D.2.2 <a href="#value-intersect">eg:value-intersect</a>
1232- <br/>
1233-        D.2.3 <a href="#value-except">eg:value-except</a>
1234- <br/>
1235-    D.3 <a href="#index-of-node">eg:index-of-node</a>
1236- <br/>
1237-    D.4 <a href="#string-pad">eg:string-pad</a>
1238- <br/>
1239-    D.5 <a href="#func-distinct-nodes-stable">eg:distinct-nodes-stable</a>
1240- <br/>
1241-    D.6 <a href="#highest-lowest">Finding minima and
1242+        C.2.1 <a href="#value-union">eg:value-union</a>
1243+ <br/>
1244+        C.2.2 <a href="#value-intersect">eg:value-intersect</a>
1245+ <br/>
1246+        C.2.3 <a href="#value-except">eg:value-except</a>
1247+ <br/>
1248+    C.3 <a href="#index-of-node">eg:index-of-node</a>
1249+ <br/>
1250+    C.4 <a href="#string-pad">eg:string-pad</a>
1251+ <br/>
1252+    C.5 <a href="#func-distinct-nodes-stable">eg:distinct-nodes-stable</a>
1253+ <br/>
1254+    C.6 <a href="#highest-lowest">Finding minima and
1255 maxima</a>
1256 <br/>
1257-        D.6.1 <a href="#highest">eg:highest</a>
1258- <br/>
1259-        D.6.2 <a href="#lowest">eg:lowest</a>
1260- <br/>
1261-    D.7 <a href="#sorting">Sorting</a>
1262- <br/>
1263-E <a href="#impl-def">Checklist of implementation-defined
1264+        C.6.1 <a href="#highest">eg:highest</a>
1265+ <br/>
1266+        C.6.2 <a href="#lowest">eg:lowest</a>
1267+ <br/>
1268+    C.7 <a href="#sorting">Sorting</a>
1269+ <br/>
1270+D <a href="#impl-def">Checklist of implementation-defined
1271 features</a> (Non-Normative)<br/>
1272-F <a href="#changelog">Changes since previous Recommendation</a>
1273+E <a href="#changelog">Changes since previous Recommendation</a>
1274 (Non-Normative)<br/>
1275-    F.1 <a href="#substantive-changes-2009-12-15">Substantive
1276+    E.1 <a href="#substantive-changes-2009-12-15">Substantive
1277 changes (15 December 2009)</a>
1278 <br/>
1279-    F.2 <a href="#substantive-changes-current-draft">Substantive
1280-changes (current draft)</a>
1281- <br/>
1282-    F.3 <a href="#incompatibilities">Incompatibilities</a>
1283- <br/>
1284-    F.4 <a href="#editorial-changes">Editorial changes</a>
1285- <br/>
1286-G <a href="#quickref">Function and Operator Quick Reference</a>
1287-(Non-Normative)<br/>
1288-    G.1 <a href="#quickref-section">Functions and Operators by
1289-Section</a>
1290- <br/>
1291-    G.2 <a href="#quickref-alpha">Functions and Operators
1292-Alphabetically</a>
1293+    E.2 <a href="#substantive-changes-2012-06-18">Substantive
1294+changes (18 June 2012)</a>
1295+ <br/>
1296+    E.3 <a href="#substantive-changes-2013-01-08">Substantive
1297+changes (Candidate Recommendation)</a>
1298+ <br/>
1299+    E.4 <a href="#substantive-changes-current-draft">Substantive
1300+changes (post Candidate Recommendation)</a>
1301+ <br/>
1302+    E.5 <a href="#editorial-changes">Editorial changes</a>
1303+ <br/>
1304+F <a href="#back-compatibility">Compatibility with Previous
1305+Versions</a> (Non-Normative)<br/>
1306+    F.1 <a href="#xpath1-compatibility">Compatibility between XPath
1307+2.0 and XPath 1.0</a>
1308+ <br/>
1309+    F.2 <a href="#xpath2-compatibility">Compatibility between XPath
1310+3.0 and XPath 2.0</a>
1311 <br/>
1312 </p>
1313 </div>
1314@@ -1421,14 +1453,15 @@
1315 <p class="prefix">
1316 <b>Note:</b>
1317 </p>
1318- <p>At the time of writing there is a Candidate Recommendation of
1319-XML Schema 1.1 that introduces some new data types including
1320-<code>xs:dateTimeStamp</code>. Furthermore, XSD 1.1 includes the
1321-option of supporting revised definitions of types such as
1322-<code>xs:NCName</code> based on the rules in XML 1.1 rather than
1323-1.0. The rules affecting support for XSD 1.0 versus XSD 1.1 and XML
1324-1.0 versus XML 1.1 are likely to be refined in later drafts of this
1325-specification.</p>
1326+ <p>The XML Schema 1.1 recommendation introduces one new concrete
1327+data type: <code>xs:dateTimeStamp</code>; it also incorporates the
1328+types <code>xs:dayTimeDuration</code>,
1329+<code>xs:yearMonthDuration</code>, and
1330+<code>xs:anyAtomicType</code> which were previously defined as part
1331+of <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM)
1332+3.0]</a>. Furthermore, XSD 1.1 includes the option of supporting
1333+revised definitions of types such as <code>xs:NCName</code> based
1334+on the rules in XML 1.1 rather than 1.0.</p>
1335 </div>
1336 <p>In this document, text labeled as an example or as a Note is
1337 provided for explanatory purposes and is not normative.</p>
1338@@ -1460,8 +1493,8 @@
1339 <ul>
1340 <li>
1341 <p>
1342- <code>http://www.w3.org/2001/XMLSchema</code> for constructors
1343--- associated with <code>xs</code>.</p>
1344+ <code>http://www.w3.org/2001/XMLSchema</code> for constructors —
1345+associated with <code>xs</code>.</p>
1346 <p>The section <a href="#constructor-functions">
1347 <b>17 Constructor
1348 functions</b>
1349@@ -1515,6 +1548,15 @@
1350 </div>
1351 </li>
1352 <li>
1353+ <p>
1354+ <code>http://www.w3.org/2010/xslt-xquery-serialization</code> —
1355+associated with <code>output</code>.</p>
1356+ <p>There are no functions in this namespace: it is used for
1357+serialization parameters, as described in <a href="#xslt-xquery-serialization-30">[XSLT and XQuery Serialization
1358+3.0]</a>
1359+ </p>
1360+ </li>
1361+ <li>
1362 <p>Functions defined with the <code>op</code> prefix are described
1363 here to underpin the definitions of the operators in <a href="#xpath-30">[XML Path Language (XPath) 3.0]</a>, <a href="#xquery-30">[XQuery 3.0: An XML Query Language]</a> and <a href="#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a>. These
1364 functions are not available directly to users, and there is no
1365@@ -1777,18 +1819,18 @@
1366 or unions rather than types derived by extension or
1367 restriction.</p>
1368 <p>The first diagram and its corresponding table illustrate the
1369-"item" type hierarchy. In XDM, items include node types, function
1370-types, and built-in atomic types.</p>
1371- <div class="note">
1372- <p class="prefix">
1373- <b>Note:</b>
1374- </p>
1375- <p>This diagram fails to reveal that the graph of the subtype
1376-relationship between types is actually a lattice rather than a
1377-hierarchy. This is particularly evident with function types, and
1378-with union types: in both cases, a type may be an immediate subtype
1379-of several other types.</p>
1380- </div>
1381+relationship of various item types. Item types in the data model
1382+form a lattice rather than a hierarchy: in the relationship defined
1383+by the <code>derived-from(A, B)</code> function, some types are
1384+derived from more than one other type. Examples include functions
1385+(<code>function(xs:string) as xs:int</code> is substitutable for
1386+<code>function(xs:NCName) as xs:int</code> and also for
1387+<code>function(xs:string) as xs:decimal</code>), and union types
1388+(<code>A</code> is substitutable for <code>union(A, B)</code> and
1389+also for <code>union(A, C)</code>. In XDM, item types include node
1390+types, function types, and built-in atomic types. The diagram,
1391+which shows only hierarchic relationships, is therefore a
1392+simplification of the full model.</p>
1393 <img src="XPathTypeHierarchy-1-items.png" alt="Type hierarchy graphic, item hierarchy"/>
1394 <p>In the table, each type whose name is indented is derived from
1395 the type whose name appears nearest above it with one less level of
1396@@ -2197,9 +2239,6 @@
1397 </tr>
1398 </tbody>
1399 </table>
1400- <p>When XSD 1.1 is supported, one additional type needs to be added
1401-to these diagrams: the type <code>xs:dateTimeStamp</code>, which is
1402-derived from <code>xs:dateTime</code>.</p>
1403 </div>
1404 <div class="div2">
1405 <h3>
1406@@ -2463,25 +2502,24 @@
1407 </a>
1408 is called <b>context-independent</b>.</span>
1409 </p>
1410- <p>Functions that are context-dependent cannot be used as literal
1411-function items, nor can they be partially applied. For example,
1412-<code>position#0</code> is not valid as a literal function item,
1413-and <a href="#func-starts-with">
1414- <code>fn:starts-with(?, ?,
1415-"http://example.com/collation")</code>
1416- </a> is not a valid partial
1417-function application. In the latter case this is because, in
1418-theory, the same URI might refer to different collations depending
1419-on the static context in which the collation URI appears. It is
1420-possible to circumvent this problem by writing a user-defined
1421-function as a simple wrapper for a call on <a href="#func-starts-with">
1422- <code>fn:starts-with</code>
1423- </a>, and writing a
1424-partial application of this user-defined function. In this way the
1425-static context for the call on <a href="#func-starts-with">
1426- <code>fn:starts-with</code>
1427- </a> is made
1428-unambiguous.</p>
1429+ <p>A function that is context-dependent can be used as a named
1430+function reference, can be partially applied, and can be found
1431+using <a href="#func-function-lookup">
1432+ <code>fn:function-lookup</code>
1433+ </a>. The
1434+principle in such cases is that the static context used for the
1435+function evaluation is taken from the static context of the named
1436+function reference, partial function application, or the call on
1437+<a href="#func-function-lookup">
1438+ <code>fn:function-lookup</code>
1439+ </a>; and
1440+the dynamic context for the function evaluation is taken from the
1441+dynamic context of the evaluation of the named function reference,
1442+partial function application, or the call of <a href="#func-function-lookup">
1443+ <code>fn:function-lookup</code>
1444+ </a>. In
1445+effect, the static and dynamic part of the context thus act as part
1446+of the closure of the function item.</p>
1447 <p>Context-dependent functions fall into a number of
1448 categories:</p>
1449 <ol class="enumar">
1450@@ -2608,6 +2646,19 @@
1451 different results.</p>
1452 </li>
1453 </ol>
1454+ <p>The <a href="#func-function-lookup">
1455+ <code>fn:function-lookup</code>
1456+ </a>
1457+function is a special case because it is potentially dependent on
1458+everything in the static and dynamic context. This is because the
1459+static and dynamic context of the call to <a href="#func-function-lookup">
1460+ <code>fn:function-lookup</code>
1461+ </a> are
1462+used as the static and dynamic context of the function that
1463+<a href="#func-function-lookup">
1464+ <code>fn:function-lookup</code>
1465+ </a>
1466+returns.</p>
1467 <p>
1468 <span class="termdef">
1469 <a name="dt-implicit-arguments" id="dt-implicit-arguments"/>[Definition] For a <a title="context-dependent" class="termref" href="#dt-context-dependent">
1470@@ -2859,16 +2910,25 @@
1471 <dt class="label">Error Conditions</dt>
1472 <dd>
1473 <p>The following errors may be raised when <code>$arg</code> is
1474-omitted: if the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
1475- <sup>
1476- <small>DM30</small>
1477- </sup>
1478-[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1479- <small>XP</small>
1480- </sup>; if
1481-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
1482- <small>XP</small>
1483- </sup>.</p>
1484+omitted:</p>
1485+ <ul>
1486+ <li>
1487+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
1488+ <sup>
1489+ <small>DM30</small>
1490+ </sup>,
1491+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1492+ <small>XP30</small>
1493+ </sup>
1494+ </p>
1495+ </li>
1496+ <li>
1497+ <p>If the context item is not a node, <span>type error</span>
1498+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
1499+ <small>XP30</small>
1500+ </sup>.</p>
1501+ </li>
1502+ </ul>
1503 </dd>
1504 <dt class="label">Notes</dt>
1505 <dd>
1506@@ -2958,16 +3018,25 @@
1507 <dt class="label">Error Conditions</dt>
1508 <dd>
1509 <p>The following errors may be raised when <code>$arg</code> is
1510-omitted: if the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
1511- <sup>
1512- <small>DM30</small>
1513- </sup>
1514-[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1515- <small>XP</small>
1516- </sup>; if
1517-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
1518- <small>XP</small>
1519- </sup>.</p>
1520+omitted:</p>
1521+ <ul>
1522+ <li>
1523+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
1524+ <sup>
1525+ <small>DM30</small>
1526+ </sup>,
1527+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1528+ <small>XP30</small>
1529+ </sup>
1530+ </p>
1531+ </li>
1532+ <li>
1533+ <p>If the context item is not a node, <span>type error</span>
1534+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
1535+ <small>XP30</small>
1536+ </sup>.</p>
1537+ </li>
1538+ </ul>
1539 </dd>
1540 <dt class="label">Notes</dt>
1541 <dd>
1542@@ -3054,16 +3123,16 @@
1543 </dd>
1544 <dt class="label">Error Conditions</dt>
1545 <dd>
1546- <p>An error is raised [<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1547- <small>XP</small>
1548- </sup> by the
1549-zero-argument version of the function if the context item is
1550+ <p>A <span>dynamic</span> error is raised [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1551+ <small>XP30</small>
1552+ </sup> by
1553+the zero-argument version of the function if the context item is
1554 <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
1555 <sup>
1556 <small>DM30</small>
1557 </sup>.</p>
1558- <p>An error is raised [<a href="#ERRFOTY0014" title="err:FOTY0014">err:FOTY0014</a>] if <code>$arg</code> is a function
1559-item.</p>
1560+ <p>A <span>type</span> error is raised [<a href="#ERRFOTY0014" title="err:FOTY0014">err:FOTY0014</a>] if <code>$arg</code> is a
1561+function item.</p>
1562 </dd>
1563 <dt class="label">Examples</dt>
1564 <dd>
1565@@ -3162,20 +3231,14 @@
1566 </dd>
1567 <dt class="label">Error Conditions</dt>
1568 <dd>
1569- <p>An error is raised [<a href="#ERRFOTY0012" title="err:FOTY0012">err:FOTY0012</a>] if an item in the sequence
1570+ <p>A <span>type</span> error is raised [<a href="#ERRFOTY0012" title="err:FOTY0012">err:FOTY0012</a>] if an item in the sequence
1571 <code>$arg</code> is a node that does not have a typed value.</p>
1572- <p>An error is raised [<a href="#ERRFOTY0013" title="err:FOTY0013">err:FOTY0013</a>] if an item in the sequence
1573+ <p>A <span>type</span> error is raised [<a href="#ERRFOTY0013" title="err:FOTY0013">err:FOTY0013</a>] if an item in the sequence
1574 <code>$arg</code> is a function item.</p>
1575- <p>The following errors may be raised when <code>$arg</code> is
1576-omitted: if the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
1577+ <p>A <span>dynamic</span> error is raised if <code>$arg</code> is
1578+omitted and the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
1579 <sup>
1580 <small>DM30</small>
1581- </sup>
1582-[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1583- <small>XP</small>
1584- </sup>; if
1585-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
1586- <small>XP</small>
1587 </sup>.</p>
1588 </dd>
1589 <dt class="label">Notes</dt>
1590@@ -3258,17 +3321,7 @@
1591 <dd>
1592 <p>The zero-argument version of the function returns the base URI
1593 of the context node: it is equivalent to calling
1594-<code>fn:base-uri(.)</code>. This may result in an error being
1595-raised: if the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
1596- <sup>
1597- <small>DM30</small>
1598- </sup>
1599-[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1600- <small>XP</small>
1601- </sup>; if
1602-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
1603- <small>XP</small>
1604- </sup>.</p>
1605+<code>fn:base-uri(.)</code>.</p>
1606 <p>The single-argument version of the function behaves as
1607 follows:</p>
1608 <ol class="enumar">
1609@@ -3304,17 +3357,26 @@
1610 </dd>
1611 <dt class="label">Error Conditions</dt>
1612 <dd>
1613- <p>If <code>$arg</code> is not specified, the following errors may
1614-be raised: if the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
1615- <sup>
1616- <small>DM30</small>
1617- </sup>
1618-[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1619- <small>XP</small>
1620- </sup>; if
1621-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
1622- <small>XP</small>
1623- </sup>.</p>
1624+ <p>The following errors may be raised when <code>$arg</code> is
1625+omitted:</p>
1626+ <ul>
1627+ <li>
1628+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
1629+ <sup>
1630+ <small>DM30</small>
1631+ </sup>,
1632+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1633+ <small>XP30</small>
1634+ </sup>
1635+ </p>
1636+ </li>
1637+ <li>
1638+ <p>If the context item is not a node, <span>type error</span>
1639+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
1640+ <small>XP30</small>
1641+ </sup>.</p>
1642+ </li>
1643+ </ul>
1644 </dd>
1645 </dl>
1646 </div>
1647@@ -3387,16 +3449,25 @@
1648 <dt class="label">Error Conditions</dt>
1649 <dd>
1650 <p>The following errors may be raised when <code>$arg</code> is
1651-omitted: if the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
1652- <sup>
1653- <small>DM30</small>
1654- </sup>
1655-[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1656- <small>XP</small>
1657- </sup>; if
1658-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
1659- <small>XP</small>
1660- </sup>.</p>
1661+omitted:</p>
1662+ <ul>
1663+ <li>
1664+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
1665+ <sup>
1666+ <small>DM30</small>
1667+ </sup>,
1668+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1669+ <small>XP30</small>
1670+ </sup>
1671+ </p>
1672+ </li>
1673+ <li>
1674+ <p>If the context item is not a node, <span>type error</span>
1675+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
1676+ <small>XP30</small>
1677+ </sup>.</p>
1678+ </li>
1679+ </ul>
1680 </dd>
1681 <dt class="label">Notes</dt>
1682 <dd>
1683@@ -3603,7 +3674,8 @@
1684 </dd>
1685 <dt class="label">Error Conditions</dt>
1686 <dd>
1687- <p>This function always raises an error.</p>
1688+ <p>This function always raises a <span>dynamic</span> error. By
1689+default, it raises [<a href="#ERRFOER0000" title="err:FOER0000">err:FOER0000</a>]</p>
1690 </dd>
1691 <dt class="label">Notes</dt>
1692 <dd>
1693@@ -3612,6 +3684,10 @@
1694 <p>The type "none" is a special type defined in <a href="#xquery-semantics">[XQuery 1.0 and XPath 2.0 Formal Semantics]</a>
1695 and is not available to the user. It indicates that the function
1696 never returns and ensures that it has the correct static type.</p>
1697+ <p>Any QName may be used as an error code; there are no reserved
1698+names or namespaces. The error is always classified as a dynamic
1699+error, even if the error code used is one that is normally used for
1700+static errors or type errors.</p>
1701 </dd>
1702 <dt class="label">Examples</dt>
1703 <dd>
1704@@ -4013,7 +4089,7 @@
1705 following options:</p>
1706 <ul>
1707 <li>
1708- <p>Raising an error [<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>] via an overflow trap.</p>
1709+ <p>Raising a <span>dynamic</span> error [<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>] via an overflow trap.</p>
1710 </li>
1711 <li>
1712 <p>Returning <code>INF</code> or <code>-INF</code>.</p>
1713@@ -4032,7 +4108,7 @@
1714 following options:</p>
1715 <ul>
1716 <li>
1717- <p>Raising an error [<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>] via an underflow trap.</p>
1718+ <p>Raising a <span>dynamic</span> error [<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>] via an underflow trap.</p>
1719 </li>
1720 <li>
1721 <p>Returning <code>0.0E0</code> or <code>+/- 2**Emin</code> or a
1722@@ -4046,9 +4122,9 @@
1723 <p>For <code>xs:decimal</code> operations, overflow behavior
1724 <a title="must" class="termref" href="#must">
1725 <span class="arrow">·</span>must<span class="arrow">·</span>
1726- </a> raise an error
1727-[<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>]. On
1728-underflow, <code>0.0</code> must be returned.</p>
1729+ </a> raise a
1730+<span>dynamic</span> error [<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>]. On underflow, <code>0.0</code>
1731+must be returned.</p>
1732 </li>
1733 <li>
1734 <p>For <code>xs:integer</code> operations, implementations that
1735@@ -4060,7 +4136,7 @@
1736 <p>They <a title="may" class="termref" href="#may">
1737 <span class="arrow">·</span>may<span class="arrow">·</span>
1738 </a> choose to
1739-always raise an error [<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>].</p>
1740+always raise a <span>dynamic</span> error [<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>].</p>
1741 </li>
1742 <li>
1743 <p>They <a title="may" class="termref" href="#may">
1744@@ -4322,21 +4398,21 @@
1745 </dd>
1746 <dt class="label">Error Conditions</dt>
1747 <dd>
1748- <p>An error is raised [<a href="#ERRFOAR0001" title="err:FOAR0001">err:FOAR0001</a>] for <code>xs:decimal</code> and
1749-<code>xs:integer</code> operands, if the divisor is (positive or
1750-negative) zero.</p>
1751+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFOAR0001" title="err:FOAR0001">err:FOAR0001</a>] for <code>xs:decimal</code>
1752+and <code>xs:integer</code> operands, if the divisor is (positive
1753+or negative) zero.</p>
1754 </dd>
1755 <dt class="label">Notes</dt>
1756 <dd>
1757 <p>For <code>xs:float</code> and <code>xs:double</code> operands,
1758-floating point division is performed as specified in <a href="#">[ieee754]</a>. A positive number divided by positive zero
1759-returns <code>INF</code>. A negative number divided by positive
1760-zero returns <code>-INF</code>. Division by negative zero returns
1761-<code>-INF</code> and <code>INF</code>, respectively. Positive or
1762-negative zero divided by positive or negative zero returns
1763-<code>NaN</code>. Also, <code>INF</code> or <code>-INF</code>
1764-divided by <code>INF</code> or <code>-INF</code> returns
1765-<code>NaN</code>.</p>
1766+floating point division is performed as specified in <a href="#ieee754-2008">[IEEE 754-2008]</a>. A positive number divided by
1767+positive zero returns <code>INF</code>. A negative number divided
1768+by positive zero returns <code>-INF</code>. Division by negative
1769+zero returns <code>-INF</code> and <code>INF</code>, respectively.
1770+Positive or negative zero divided by positive or negative zero
1771+returns <code>NaN</code>. Also, <code>INF</code> or
1772+<code>-INF</code> divided by <code>INF</code> or <code>-INF</code>
1773+returns <code>NaN</code>.</p>
1774 </dd>
1775 </dl>
1776 </div>
1777@@ -4400,9 +4476,9 @@
1778 </dd>
1779 <dt class="label">Error Conditions</dt>
1780 <dd>
1781- <p>An error is raised [<a href="#ERRFOAR0001" title="err:FOAR0001">err:FOAR0001</a>] if the divisor is (positive or
1782-negative) zero.</p>
1783- <p>An error is raised [<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>] if either operand is
1784+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFOAR0001" title="err:FOAR0001">err:FOAR0001</a>] if the divisor is (positive
1785+or negative) zero.</p>
1786+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>] if either operand is
1787 <code>NaN</code> or if <code>$arg1</code> is <code>INF</code> or
1788 <code>-INF</code>.</p>
1789 </dd>
1790@@ -4507,16 +4583,16 @@
1791 infinity, nor positive or negative zero, nor <code>NaN</code> is
1792 involved, the result obeys <code>(a idiv b)*b+(a mod b)</code> =
1793 <code>a</code>. Division is truncating division, analogous to
1794-integer division, not <a href="#">[ieee754]</a> rounding division
1795-i.e. additional digits are truncated, not rounded to the required
1796-precision.</p>
1797+integer division, not <a href="#ieee754-2008">[IEEE 754-2008]</a>
1798+rounding division i.e. additional digits are truncated, not rounded
1799+to the required precision.</p>
1800 </li>
1801 </ul>
1802 </dd>
1803 <dt class="label">Error Conditions</dt>
1804 <dd>
1805- <p>An error is raised [<a href="#ERRFOAR0001" title="err:FOAR0001">err:FOAR0001</a>] for <code>xs:integer</code> and
1806-<code>xs:decimal</code> operands, if <code>$arg2</code> is
1807+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFOAR0001" title="err:FOAR0001">err:FOAR0001</a>] for <code>xs:integer</code>
1808+and <code>xs:decimal</code> operands, if <code>$arg2</code> is
1809 zero.</p>
1810 </dd>
1811 <dt class="label">Examples</dt>
1812@@ -5397,29 +5473,30 @@
1813 give the same result as calling the single-argument version with
1814 the context item (<code>.</code>). That is,
1815 <code>fn:number()</code> is equivalent to
1816-<code>fn:number(.)</code>.</p>
1817+<code>fn:number(.)</code>, as defined by the rules that follow.</p>
1818 <p>If <code>$arg</code> is the empty sequence or if
1819-<code>$arg</code> or the context item cannot be converted to an
1820-<code>xs:double</code>, the <code>xs:double</code> value
1821-<code>NaN</code> is returned.</p>
1822- <p>Otherwise, <code>$arg</code>, or the context item after
1823-atomization, is converted to an <code>xs:double</code> following
1824-the rules of <a href="#casting-to-double">
1825- <b>18.1.2.2 Casting to
1826-xs:double</b>
1827- </a>. If the conversion to <code>xs:double</code>
1828-fails, the <code>xs:double</code> value <code>NaN</code> is
1829-returned.</p>
1830+<code>$arg</code> cannot be converted to an <code>xs:double</code>,
1831+the <code>xs:double</code> value <code>NaN</code> is returned.</p>
1832+ <p>Otherwise, <code>$arg</code> is converted to an
1833+<code>xs:double</code> following the rules of <a href="#casting-to-double">
1834+ <b>18.1.2.2 Casting to xs:double</b>
1835+ </a>. If
1836+the conversion to <code>xs:double</code> fails, the
1837+<code>xs:double</code> value <code>NaN</code> is returned.</p>
1838 </dd>
1839 <dt class="label">Error Conditions</dt>
1840 <dd>
1841- <p>An error is raised [<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1842- <small>XP</small>
1843+ <p>A <span>dynamic</span> error is raised [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
1844+ <small>XP30</small>
1845 </sup> if
1846 <code>$arg</code> is omitted and the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
1847 <sup>
1848 <small>DM30</small>
1849 </sup>.</p>
1850+ <p>As a consequence of the rules given above, a type error occurs
1851+if the context item cannot be atomized, or if the result of
1852+atomizing the context item is a sequence containing more than one
1853+atomic value.</p>
1854 </dd>
1855 <dt class="label">Notes</dt>
1856 <dd>
1857@@ -5427,6 +5504,12 @@
1858 of positive infinity; XSD 1.0 does not. It is <a title="implementation-defined" class="termref" href="#implementation-defined">
1859 <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
1860 </a> whether XSD 1.1 is supported.</p>
1861+ <p>Generally <code>fn:number</code> returns <code>NaN</code> rather
1862+than raising a dynamic error if the argument cannot be converted to
1863+<code>xs:double</code>. However, a type error is raised in the
1864+usual way if the supplied argument cannot be atomized or if the
1865+result of atomization does not match the required argument
1866+type.</p>
1867 </dd>
1868 <dt class="label">Examples</dt>
1869 <dd>
1870@@ -5489,7 +5572,7 @@
1871 </tr>
1872 <tr>
1873 <td valign="baseline">
1874- <code class="arg">$language</code>
1875+ <code class="arg">$lang</code>
1876 </td>
1877 <td valign="baseline">
1878 <code class="as"> as </code>
1879@@ -5503,7 +5586,17 @@
1880 </dd>
1881 <dt class="label">Properties</dt>
1882 <dd>
1883- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
1884+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
1885+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
1886+ </a>,
1887+<a title="context-dependent" class="termref" href="#dt-context-dependent">
1888+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
1889+ </a>,
1890+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
1891+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
1892+ </a>.
1893+It depends on default language.</p>
1894+ <p>The three-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
1895 <span class="arrow">·</span>deterministic<span class="arrow">·</span>
1896 </a>,
1897 <a title="context-independent" class="termref" href="#dt-context-independent">
1898@@ -5522,18 +5615,16 @@
1899 output. If the value of <code>$value</code> is negative, the rules
1900 below are applied to the absolute value of <code>$value</code>, and
1901 a minus sign is prepended to the result.</p>
1902- <p>The value of <code>$picture</code>
1903- <strong>must</strong> match
1904-the regular expression:</p>
1905- <p>
1906- <code>^((\p{Nd}|#|[^\p{N}\p{L}])+?)(([co](\([^()]\))?)?[at]?)$</code>
1907- </p>
1908- <p>The substring that matches the first capturing group in this
1909-regular expression are referred to as the primary format token. The
1910-substring that matches the second capturing group (which may be
1911-empty) is referred to as the format modifier. A picture thus
1912-consists of a primary format token, followed by an optional format
1913-modifier.</p>
1914+ <p>The value of <code>$picture</code> consists of a primary format
1915+token, optionally followed by a format modifier. The primary format
1916+token is always present and <strong>must not</strong> be
1917+zero-length. If the string contains one or more semicolons then
1918+everything that precedes the last semicolon is taken as the primary
1919+format token and everything that follows is taken as the format
1920+modifier; if the string contains no semicolon then the entire
1921+picture is taken as the primary format token, and the format
1922+modifier is taken to be absent (which is equivalent to supplying a
1923+zero-length string).</p>
1924 <p>The primary format token is classified as one of the
1925 following:</p>
1926 <ul>
1927@@ -5550,12 +5641,12 @@
1928 <span class="arrow">·</span>character<span class="arrow">·</span>
1929 </a> in
1930 Unicode category Nd. All <var>mandatory-digit-signs</var> within
1931-the format token must be from the same digit family, where a digit
1932-family is a sequence of ten consecutive characters in Unicode
1933-category Nd, having digit values 0 through 9. Within the format
1934-token, these digits are interchangeable: a three-digit number may
1935-thus be indicated equivalently by <code>000</code>,
1936-<code>001</code>, or <code>999</code>.</p>
1937+the format token <strong>must</strong> be from the same digit
1938+family, where a digit family is a sequence of ten consecutive
1939+characters in Unicode category Nd, having digit values 0 through 9.
1940+Within the format token, these digits are interchangeable: a
1941+three-digit number may thus be indicated equivalently by
1942+<code>000</code>, <code>001</code>, or <code>999</code>.</p>
1943 </li>
1944 <li>
1945 <p>a <var>grouping-separator-sign</var> is a non-alphanumeric
1946@@ -5565,6 +5656,22 @@
1947 No, Lu, Ll, Lt, Lm or Lo.</p>
1948 </li>
1949 </ul>
1950+ <p>If the primary format token contains at least one Unicode digit
1951+then it is taken as a decimal digit pattern, and in this case it
1952+<strong>must</strong> match the regular expression
1953+<code>^((\p{Nd}|#|[^\p{N}\p{L}])+?)$</code>. If it contains a digit
1954+but does not match this pattern, a <span>dynamic</span> error is
1955+raised [<a href="#ERRFODF1310" title="err:FODF1310">err:FODF1310</a>].</p>
1956+ <div class="note">
1957+ <p class="prefix">
1958+ <b>Note:</b>
1959+ </p>
1960+ <p>If a semicolon is to be used as a grouping separator, then the
1961+primary format token as a whole must be followed by another
1962+semicolon, to ensure that the grouping separator is not mistaken as
1963+a separator between the primary format token and the format
1964+modifier.</p>
1965+ </div>
1966 <p>There <strong>must</strong> be at least one
1967 <var>mandatory-digit-sign</var>. There may be zero or more
1968 <var>optional-digit-signs</var>, and (if present) these
1969@@ -5687,12 +5794,14 @@
1970 that can be formatted using this format token; indeed, for some
1971 numbering sequences there may be intrinsic limits. For example, the
1972 format token <code>&amp;#x2460;</code> (circled digit one, ①) has a
1973-range of 1 to 20 imposed by the Unicode character repertoire. For
1974-the numbering sequences described above any upper bound imposed by
1975-the implementation <strong>must not</strong> be less than 1000 (one
1976-thousand) and any lower bound must not be greater than 1. Numbers
1977-that fall outside this range <strong>must</strong> be formatted
1978-using the format token <code>1</code>.</p>
1979+range <span>imposed by the Unicode character repertoire — 1 to 20
1980+in Unicode versions prior to 4.0, increased in subsequent
1981+versions</span>. For the numbering sequences described above any
1982+upper bound imposed by the implementation <strong>must not</strong>
1983+be less than 1000 (one thousand) and any lower bound must not be
1984+greater than 1. Numbers that fall outside this range
1985+<strong>must</strong> be formatted using the format token
1986+<code>1</code>.</p>
1987 <p>The above expansions of numbering sequences for format tokens
1988 such as <code>a</code> and <code>i</code> are indicative but not
1989 prescriptive. There are various conventions in use for how
1990@@ -5710,23 +5819,27 @@
1991 sequences, for example different languages using the Cyrillic
1992 alphabet use different sequences of characters, each starting with
1993 the letter #x410 (Cyrillic capital letter A). In such cases, the
1994-<code>$language</code> argument specifies which language's
1995-conventions are to be used. <span>If the argument is specified, the
1996-value <strong>should</strong> be a string that is castable to the
1997-type <code>xs:language</code>
1998- </span>.</p>
1999+<code>$lang</code> argument specifies which language's conventions
2000+are to be used. <span>If the argument is specified, the value
2001+<strong>should</strong> be either an empty sequence or a value that
2002+would be valid for the <code>xml:lang</code> attribute (see
2003+<a href="#REC-xml">[REC-xml]</a>). Note that this permits the
2004+identification of sublanguages based on country codes (from ISO
2005+3166-1) as well as identification of dialects and regions within a
2006+country.</span>.</p>
2007 <p>The set of languages for which numbering is supported is
2008 <a title="implementation-defined" class="termref" href="#implementation-defined">
2009 <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
2010- </a>. If the <code>$language</code> argument is
2011-absent, or is set to an empty sequence, or is invalid, or is not a
2012-language supported by the implementation, then the number is
2013-formatted using a default language; the default language is
2014-<a title="implementation-defined" class="termref" href="#implementation-defined">
2015- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
2016- </a>.</p>
2017- <p>The format modifier, if present, is one <span>or more</span> of
2018-the following, in order:</p>
2019+ </a>. If the <code>$lang</code> argument is absent,
2020+or is set to an empty sequence, or is invalid, or is not a language
2021+supported by the implementation, then the number is formatted using
2022+<span>the default language from the dynamic context</span>.</p>
2023+ <p>The format modifier <span>
2024+ <strong>must</strong> be a string that
2025+matches the regular expression
2026+<code>^([co](\(.+\))?)?[at]?$</code>.</span> That is, if it is
2027+present it must consist of one <span>or more</span> of the
2028+following, in order:</p>
2029 <ul>
2030 <li>
2031 <p>either <code>c</code> or <code>o</code>, optionally followed by
2032@@ -5748,17 +5861,24 @@
2033 ...</code>, and when used with the format token <code>w</code>
2034 outputs the sequence <code>first second third fourth
2035 ...</code>.</p>
2036- <p>In some languages, ordinal numbers vary depending on the
2037-grammatical context, for example they may have different genders
2038-and may decline with the noun that they qualify. In such cases the
2039-string appearing in parentheses after the letter <code>o</code> may
2040-be used to indicate the variation of the ordinal number required.
2041-The way in which the variation is indicated will depend on the
2042+ <p>The string of characters between the parentheses, if present, is
2043+used to select between other possible variations of cardinal or
2044+ordinal numbering sequences. The interpretation of this string is
2045+<a title="" class="termref" href="#">
2046+ <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
2047+ </a>. No error occurs if the implementation does
2048+not define any interpretation for the defined string.</p>
2049+ <p>For example, in some languages, ordinal numbers vary depending
2050+on the grammatical context: they may have different genders and may
2051+decline with the noun that they qualify. In such cases the string
2052+appearing in parentheses after the letter <code>o</code> may be
2053+used to indicate the variation of the ordinal number required. The
2054+way in which the variation is indicated will depend on the
2055 conventions of the language. For inflected languages that vary the
2056-ending of the word, the preferred approach is to indicate the
2057-required ending, preceded by a hyphen: for example in German,
2058-appropriate values are <code>o(-e)</code>, <code>o(-er)</code>,
2059-<code>o(-es)</code>, <code>o(-en)</code>.</p>
2060+ending of the word, the <strong>recommended</strong> approach is to
2061+indicate the required ending, preceded by a hyphen: for example in
2062+German, appropriate values are <code>o(-e)</code>,
2063+<code>o(-er)</code>, <code>o(-es)</code>, <code>o(-en)</code>.</p>
2064 <p>It is <a title="implementation-defined" class="termref" href="#implementation-defined">
2065 <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
2066 </a> what combinations of values of the format
2067@@ -5769,16 +5889,16 @@
2068 numbers are generated instead.</p>
2069 <div class="exampleOuter">
2070 <div class="exampleHeader">
2071- <a name="d5e6102" id="d5e6102"/>Example: Ordinal Numbering in Italian</div>
2072- <p>The specification <code>"1o(-º)"</code> with
2073-<code>$language</code> equal to <code>it</code>, if supported,
2074-should produce the sequence:</p>
2075+ <a name="d5e6328" id="d5e6328"/>Example: Ordinal Numbering in Italian</div>
2076+ <p>The specification <code>"1;o(-º)"</code> with <code>$lang</code>
2077+equal to <code>it</code>, if supported, should produce the
2078+sequence:</p>
2079 <div class="exampleInner">
2080 <pre>
2081 1º 2º 3º 4º ...
2082 </pre>
2083 </div>
2084- <p>The specification <code>"Wwo"</code> with <code>$language</code>
2085+ <p>The specification <code>"Ww;o"</code> with <code>$lang</code>
2086 equal to <code>it</code>, if supported, should produce the
2087 sequence:</p>
2088 <div class="exampleInner">
2089@@ -5803,6 +5923,25 @@
2090 </a>
2091 </span>.</p>
2092 </dd>
2093+ <dt class="label">Error Conditions</dt>
2094+ <dd>
2095+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODF1310" title="err:FODF1310">err:FODF1310</a>] if the format token is
2096+invalid, that is, if it violates any mandatory rules (indicated by
2097+an emphasized <strong>must</strong> or <strong>required</strong>
2098+keyword in the above rules). For example, the error is raised if
2099+the primary format token contains a digit but does not match the
2100+required regular expression.</p>
2101+ </dd>
2102+ <dt class="label">Notes</dt>
2103+ <dd>
2104+ <p>Note the careful distinction between conditions that are errors
2105+and conditions where fallback occurs. The principle is that an
2106+error in the syntax of the format picture will be reported by all
2107+processors, while a construct that is recognized by some
2108+implementations but not others will never result in an error, but
2109+will instead cause a fallback representation of the integer to be
2110+used.</p>
2111+ </dd>
2112 <dt class="label">Examples</dt>
2113 <dd>
2114 <p>The expression <code>format-integer(123, '0000')</code> returns
2115@@ -5811,16 +5950,18 @@
2116 <code>format-integer(123, 'w')</code> might return <code>"one
2117 hundred and twenty-three"</code>
2118 </p>
2119- <p>The expression <code>format-integer(21, '1o', 'en')</code>
2120+ <p>The expression <code>format-integer(21, '1;o', 'en')</code>
2121 returns <code>"21st"</code>.</p>
2122 <p>
2123- <code>format-integer(14, 'Wwo(-e)', 'de')</code> might return
2124+ <code>format-integer(14, 'Ww;o(-e)', 'de')</code> might return
2125 <code>"Vierzehnte"</code>
2126 </p>
2127 <p>The expression <code>format-integer(7, 'a')</code> returns
2128 <code>"g"</code>.</p>
2129 <p>The expression <code>format-integer(57, 'I')</code> returns
2130 <code>"LVII"</code>.</p>
2131+ <p>The expression <code>format-integer(1234, '#;##0;')</code>
2132+returns <code>"1;234"</code>.</p>
2133 </dd>
2134 </dl>
2135 </div>
2136@@ -5873,9 +6014,11 @@
2137 <p>The static context provides a set of decimal formats. One of the
2138 decimal formats is unnamed, the others (if any) are identified by a
2139 QName. There is always an unnamed decimal format available, but its
2140-contents are implementation-defined.</p>
2141- <p>Each decimal format provides a set of named variables, described
2142-in the following table:</p>
2143+contents are <a title="implementation-defined" class="termref" href="#implementation-defined">
2144+ <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
2145+ </a>.</p>
2146+ <p>Each decimal format provides a set of named
2147+<span>properties</span>, described in the following table:</p>
2148 <table summary="A table [this is bad style]" border="1">
2149 <thead>
2150 <tr>
2151@@ -5958,13 +6101,15 @@
2152 <td valign="top">mandatory-digit-sign</td>
2153 <td valign="top">A single <a title="character" class="termref" href="#character">
2154 <span class="arrow">·</span>character<span class="arrow">·</span>
2155- </a>, which must be defined in Unicode as a
2156-digit</td>
2157- <td valign="top">Defines the character (typically "0") used in the
2158-picture string to represent a mandatory digit, and in the formatted
2159-number to represent the digit zero; by implication, this also
2160-defines the characters used to represent the digits one to
2161-nine.</td>
2162+ </a>, which must be <span>a character in Unicode
2163+category Nd with decimal digit value 0 (zero)</span>
2164+ </td>
2165+ <td valign="top">Defines the characters used in the picture string
2166+to represent a mandatory digit: for example, if the
2167+mandatory-digit-sign is "0" then any of the digits "0" to "9" may
2168+be used (interchangeably) in the picture string to represent a
2169+mandatory digit, and in the formatted number the characters "0" to
2170+"9" will be used to represent the digits one to nine.</td>
2171 </tr>
2172 <tr>
2173 <td valign="top">optional-digit-sign</td>
2174@@ -5997,17 +6142,20 @@
2175 <var>mandatory-digit-sign</var>.</span>
2176 </p>
2177 <p>It is a constraint that, for any named or unnamed decimal
2178-format, the variables representing characters used in a <a title="picture string" class="termref" href="#dt-picture-string">
2179+format, the <span>properties</span> representing characters used in
2180+a <a title="picture string" class="termref" href="#dt-picture-string">
2181 <span class="arrow">·</span>picture
2182 string<span class="arrow">·</span>
2183 </a> must have distinct values.
2184-These variables are <var>decimal-separator-sign</var>,
2185+These <span>properties</span> are
2186+<var>decimal-separator-sign</var>,
2187 <var>grouping-separator-sign</var>, <var>percent-sign</var>,
2188 <var>per-mille-sign</var>, <var>optional-digit-sign</var>, and
2189 <var>pattern-separator-sign</var>. Furthermore, none of these
2190-variables may be equal to any <a title="character" class="termref" href="#character">
2191+<span>properties</span> may be equal to any <a title="character" class="termref" href="#character">
2192 <span class="arrow">·</span>character<span class="arrow">·</span>
2193- </a> in the <a title="digit family" class="termref" href="#dt-decimal-digit-family">
2194+ </a> in the
2195+<a title="digit family" class="termref" href="#dt-decimal-digit-family">
2196 <span class="arrow">·</span>decimal
2197 digit family<span class="arrow">·</span>
2198 </a>.</p>
2199@@ -6089,7 +6237,7 @@
2200 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
2201 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
2202 </a>.
2203-It depends on decimal-formats and namespaces.</p>
2204+It depends on decimal formats, and namespaces.</p>
2205 </dd>
2206 <dt class="label">Rules</dt>
2207 <dd>
2208@@ -6120,10 +6268,23 @@
2209 the <code>xs:double</code> value <code>NaN</code>.</p>
2210 <p>The value of <code>$decimal-format-name</code>, <span>if present
2211 and non-empty,</span>
2212- <strong>must</strong> be a lexical QName,
2213-which is expanded using the <span>statically known
2214-namespaces</span>. The default namespace is not used (no prefix
2215-means no namespace).</p>
2216+ <strong>must</strong>
2217+ <span>be a string which
2218+after removal of leading and trailing whitespace is in the form of
2219+an an <code>EQName</code> as defined in the XPath 3.0 grammar, that
2220+is one of the following</span>:</p>
2221+ <ul>
2222+ <li>
2223+ <p>A lexical QName, which is expanded using the <span>statically
2224+known namespaces</span>. The default namespace is not used (no
2225+prefix means no namespace).</p>
2226+ </li>
2227+ <li>
2228+ <p>A <code>URIQualifiedName</code> using the syntax
2229+<code>Q{uri}local</code>, where the URI can be zero-length to
2230+indicate a name in no namespace.</p>
2231+ </li>
2232+ </ul>
2233 <p>The decimal format that is used is the decimal format in the
2234 static context whose name matches <code>$decimal-format-name</code>
2235 if supplied, or the default decimal format in the static context
2236@@ -6151,9 +6312,11 @@
2237 </dd>
2238 <dt class="label">Error Conditions</dt>
2239 <dd>
2240- <p>An error is raised [<a href="#ERRFODF1280" title="err:FODF1280">err:FODF1280</a>] if the name specified as the
2241-<code>$decimal-format-name</code> argument is not a valid lexical
2242-QName, or if its prefix <span>is not found in the statically known
2243+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODF1280" title="err:FODF1280">err:FODF1280</a>] if the name specified as the
2244+<code>$decimal-format-name</code> argument is <span>neither a valid
2245+lexical QName nor a valid <code>URIQualifiedName</code>
2246+ </span>, or
2247+if it uses a prefix <span>that is not found in the statically known
2248 namespaces</span>, or if the static context does not contain a
2249 declaration of a decimal-format with a matching expanded QName. If
2250 the processor is able to detect the error statically (for example,
2251@@ -6168,8 +6331,25 @@
2252 </dd>
2253 <dt class="label">Examples</dt>
2254 <dd>
2255- <p>The expression <code>format-number(12345.6, '#.###,00')</code>
2256-returns <code>"12.345,00"</code>.</p>
2257+ <p>The following examples assume a default decimal format in which
2258+the chosen digits are the ASCII digits 0-9, the decimal separator
2259+is ".", the grouping separator is ",", the minus-sign is "-", and
2260+the percent-sign is "%".</p>
2261+ <p>The expression <code>format-number(12345.6, '#,###.00')</code>
2262+returns <code>"12,345.60"</code>.</p>
2263+ <p>The expression <code>format-number(12345678.9,
2264+'9,999.99')</code> returns <code>"12,345,678.90"</code>.</p>
2265+ <p>The expression <code>format-number(123.9, '9999')</code> returns
2266+<code>"0124"</code>.</p>
2267+ <p>The expression <code>format-number(0.14, '01%')</code> returns
2268+<code>"14%"</code>.</p>
2269+ <p>The expression <code>format-number(-6, '000')</code> returns
2270+<code>"-006"</code>.</p>
2271+ <p>The following example assumes the existence of a decimal format
2272+named 'ch' in which the grouping separator is <code>ʹ</code> and
2273+the decimal separator is <code>·</code>:</p>
2274+ <p>The expression <code>format-number(1234.5678, '#ʹ##0·00',
2275+'ch')</code> returns <code>"1ʹ234·57"</code>.</p>
2276 </dd>
2277 </dl>
2278 </div>
2279@@ -6184,8 +6364,11 @@
2280 <p>This differs from the <code>format-number</code> function
2281 previously defined in XSLT 2.0 in that any digit can be used in the
2282 picture string to represent a mandatory digit: for example the
2283-picture strings '000', '001', and '999' are equivalent. This is to
2284-align <code>format-number</code> (which previously used '000') with
2285+picture strings '000', '001', and '999' are equivalent. <span>The
2286+digits used must all be from the same decimal digit family,
2287+specifically, the sequence of ten consecutive digits starting with
2288+the <var>mandatory-digit-sign</var>.</span> This change is to align
2289+<code>format-number</code> (which previously used '000') with
2290 <code>format-dateTime</code> (which used '001').</p>
2291 </div>
2292 <p>
2293@@ -6195,7 +6378,8 @@
2294 sequence of <a title="character" class="termref" href="#character">
2295 <span class="arrow">·</span>characters<span class="arrow">·</span>
2296 </a>, in which the characters assigned to the
2297-variables <var>decimal-separator-sign</var>,
2298+<span>properties</span>
2299+ <var>decimal-separator-sign</var>,
2300 <var>grouping-sign</var>, <var>decimal-digit-family</var>,
2301 <var>optional-digit-sign</var> and
2302 <var>pattern-separator-sign</var> are classified as active
2303@@ -6208,15 +6392,19 @@
2304 <var>decimal-separator-sign</var> if there is one, or the entire
2305 sub-picture otherwise. The <var>fractional part</var> of the
2306 sub-picture is defined as the part that appears to the right of the
2307-<var>decimal-separator-sign</var> if there is one; it is a
2308-zero-length string otherwise.</p>
2309- <p>An error is raised [<a href="#ERRFODF1310" title="err:FODF1310">err:FODF1310</a>] if the <a title="picture string" class="termref" href="#dt-picture-string">
2310- <span class="arrow">·</span>picture string<span class="arrow">·</span>
2311- </a> does
2312-not conform to the following rules. Note that in these rules the
2313-words "preceded" and "followed" refer to characters anywhere in the
2314-string, they are not to be read as "immediately preceded" and
2315-"immediately followed".</p>
2316+<var>decimal-separator-sign</var>
2317+ <span>if there is one, or the
2318+part that appears to the right of the rightmost active character
2319+otherwise. The fractional part may be zero-length.</span>
2320+ </p>
2321+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODF1310" title="err:FODF1310">err:FODF1310</a>] if the <a title="picture string" class="termref" href="#dt-picture-string">
2322+ <span class="arrow">·</span>picture
2323+string<span class="arrow">·</span>
2324+ </a> does not conform to the
2325+following rules. Note that in these rules the words "preceded" and
2326+"followed" refer to characters anywhere in the string, they are not
2327+to be read as "immediately preceded" and "immediately
2328+followed".</p>
2329 <ul>
2330 <li>
2331 <p>A picture-string consists either of a sub-picture, or of two
2332@@ -6267,12 +6455,12 @@
2333 <p>This phase of the algorithm analyses the <a title="picture string" class="termref" href="#dt-picture-string">
2334 <span class="arrow">·</span>picture
2335 string<span class="arrow">·</span>
2336- </a> and the variables from the
2337-selected decimal format in the static context, and it has the
2338-effect of setting the values of various variables, which are used
2339-in the subsequent formatting phase. These variables are listed
2340-below. Each is shown with its initial setting and its data
2341-type.</p>
2342+ </a> and the
2343+<span>properties</span> from the selected decimal format in the
2344+static context, and it has the effect of setting the values of
2345+various variables, which are used in the subsequent formatting
2346+phase. These variables are listed below. Each is shown with its
2347+initial setting and its data type.</p>
2348 <p>Several variables are associated with each sub-picture. If there
2349 are two sub-pictures, then these rules are applied to one
2350 sub-picture to obtain the values that apply to positive numbers,
2351@@ -6336,6 +6524,16 @@
2352 characters that appear within the fractional part of the
2353 sub-picture and to the left of the
2354 <var>grouping-separator-sign</var>.</p>
2355+ <div class="note">
2356+ <p class="prefix">
2357+ <b>Note:</b>
2358+ </p>
2359+ <p>There is no need to extrapolate grouping positions on the
2360+fractional side, because the number of digits in the output will
2361+never exceed the number of <var>optional-digit-sign</var> and
2362+<var>decimal-digit-family</var> in the fractional part of the
2363+sub-picture.</p>
2364+ </div>
2365 </li>
2366 <li>
2367 <p>The <var>minimum-fractional-part-size</var> is set to the number
2368@@ -6350,8 +6548,8 @@
2369 </li>
2370 <li>
2371 <p>The <var>suffix</var> is set to contain all passive characters
2372-to the right of the rightmost active character in the fractional
2373-part of the sub-picture.</p>
2374+to the right of the rightmost active character in the
2375+sub-picture.</p>
2376 </li>
2377 </ul>
2378 <div class="note">
2379@@ -6531,6 +6729,15 @@
2380 information is outside the scope of this specification.</p>
2381 </li>
2382 <li>
2383+ <p>IEEE defines various rounding algorithms for inexact results,
2384+and states that the choice of rounding direction, and the
2385+mechanisms for influencing this choice, are language-defined. In
2386+this specification, the rounding direction and any mechanisms for
2387+influencing it are <a title="implementation-defined" class="termref" href="#implementation-defined">
2388+ <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
2389+ </a>.</p>
2390+ </li>
2391+ <li>
2392 <p>Certain operations (such as taking the square root of a negative
2393 number) are defined in IEEE to signal the invalid operation
2394 exception and return a quiet NaN. In this specification, such
2395@@ -7791,8 +7998,8 @@
2396 <b>4.2 Arithmetic operators on numeric
2397 values</b>
2398 </a>.</p>
2399- <p>If <code>$arg</code> is <code>NaN</code> then the result is
2400-<code>NaN</code>.</p>
2401+ <p>If <span>either argument</span> is <code>NaN</code> then the
2402+result is <code>NaN</code>.</p>
2403 <p>If <code>$y</code> is positive and <code>$x</code> is positive
2404 and finite, then (subject to rules for overflow, underflow and
2405 approximation) the value of <code>atan2($y, $x)</code> is
2406@@ -7998,7 +8205,7 @@
2407 </dd>
2408 <dt class="label">Error Conditions</dt>
2409 <dd>
2410- <p>An error is raised [<a href="#ERRFOCH0001" title="err:FOCH0001">err:FOCH0001</a>] if any of the codepoints in
2411+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFOCH0001" title="err:FOCH0001">err:FOCH0001</a>] if any of the codepoints in
2412 <code>$arg</code> is not a permitted XML character.</p>
2413 </dd>
2414 <dt class="label">Examples</dt>
2415@@ -8162,9 +8369,9 @@
2416 functions. Functions that allow specification of a collation do so
2417 with an argument whose type is <code>xs:string</code> but whose
2418 lexical form must conform to an <code>xs:anyURI</code>. If the
2419-collation is specified using a relative URI, it is assumed to be
2420-relative to the value of the <span>Dynamic Base URI property from
2421-the dynamic context</span>. This specification also defines the
2422+collation is specified using a relative URI reference, <span>it is
2423+resolved relative to the value of the Static Base URI property from
2424+the static context</span>. This specification also defines the
2425 manner in which a default collation is determined if the collation
2426 argument is not specified in calls of functions that use a
2427 collation but allow it to be omitted.</p>
2428@@ -8307,7 +8514,7 @@
2429 CollationA is used.</p>
2430 </li>
2431 <li>
2432- <p>Otherwise, an error is raised [<a href="#ERRFOCH0002" title="err:FOCH0002">err:FOCH0002</a>].</p>
2433+ <p>Otherwise, a <span>dynamic</span> error is raised [<a href="#ERRFOCH0002" title="err:FOCH0002">err:FOCH0002</a>].</p>
2434 </li>
2435 </ul>
2436 </li>
2437@@ -8321,7 +8528,7 @@
2438 CollationB is used.</p>
2439 </li>
2440 <li>
2441- <p>Otherwise, an error is raised [<a href="#ERRFOCH0002" title="err:FOCH0002">err:FOCH0002</a>].</p>
2442+ <p>Otherwise, a <span>dynamic</span> error is raised [<a href="#ERRFOCH0002" title="err:FOCH0002">err:FOCH0002</a>].</p>
2443 </li>
2444 </ul>
2445 </li>
2446@@ -8398,7 +8605,7 @@
2447 </dd>
2448 <dt class="label">Properties</dt>
2449 <dd>
2450- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
2451+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
2452 <span class="arrow">·</span>deterministic<span class="arrow">·</span>
2453 </a>,
2454 <a title="context-dependent" class="termref" href="#dt-context-dependent">
2455@@ -8408,6 +8615,16 @@
2456 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
2457 </a>.
2458 It depends on collations.</p>
2459+ <p>The three-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
2460+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
2461+ </a>,
2462+<a title="context-dependent" class="termref" href="#dt-context-dependent">
2463+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
2464+ </a>,
2465+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
2466+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
2467+ </a>.
2468+It depends on collations, and static base uri.</p>
2469 </dd>
2470 <dt class="label">Rules</dt>
2471 <dd>
2472@@ -9118,8 +9335,8 @@
2473 <sup>
2474 <small>DM30</small>
2475 </sup>,
2476-an error is raised: [<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
2477- <small>XP</small>
2478+a <span>dynamic</span> error is raised: [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
2479+ <small>XP30</small>
2480 </sup>.</p>
2481 </dd>
2482 <dt class="label">Notes</dt>
2483@@ -9207,8 +9424,8 @@
2484 <sup>
2485 <small>DM30</small>
2486 </sup>
2487-then an error is raised: [<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
2488- <small>XP</small>
2489+then a <span>dynamic</span> error is raised: [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
2490+ <small>XP30</small>
2491 </sup>.</p>
2492 </dd>
2493 <dt class="label">Notes</dt>
2494@@ -9333,7 +9550,7 @@
2495 </ul>
2496 <p>Normalization forms NFC, NFD, NFKC, and NFKD, and the algorithms
2497 to be used for converting a string to each of these forms, are
2498-defined in <a href="#Unicode-Normalization">[Unicode Normaliation
2499+defined in <a href="#Unicode-Normalization">[Unicode Normalization
2500 Forms]</a>.</p>
2501 <p>The motivation for normalization form FULLY-NORMALIZED is
2502 explained in <a href="#charmod-normalization">[Character Model for
2503@@ -9343,7 +9560,7 @@
2504 <ul>
2505 <li>
2506 <p>A string is <b>fully-normalized</b> if (a) it is in
2507-normalization form NFC as defined in <a href="#Unicode-Normalization">[Unicode Normaliation Forms]</a>, and (b)
2508+normalization form NFC as defined in <a href="#Unicode-Normalization">[Unicode Normalization Forms]</a>, and (b)
2509 it does not start with a composing character.</p>
2510 </li>
2511 <li>
2512@@ -9354,7 +9571,7 @@
2513 <p>the second character in the canonical decomposition mapping of
2514 some character that is not listed in the Composition Exclusion
2515 Table defined in <a href="#Unicode-Normalization">[Unicode
2516-Normaliation Forms]</a>;</p>
2517+Normalization Forms]</a>;</p>
2518 </li>
2519 <li>
2520 <p>of non-zero canonical combining class (as defined in <a href="#Unicode">[The Unicode Standard]</a>).</p>
2521@@ -9381,12 +9598,25 @@
2522 with <a title="implementation-defined" class="termref" href="#implementation-defined">
2523 <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
2524 </a> semantics.</p>
2525+ <p>It is <a title="" class="termref" href="#">
2526+ <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
2527+ </a> which version of Unicode (and therefore, of
2528+the normalization algorithms and their underlying data) is
2529+supported by the implementation. See <a href="#Unicode-Normalization">[Unicode Normalization Forms]</a> for
2530+details of the stability policy regarding changes to the
2531+normalization rules in future versions of Unicode. If the input
2532+string contains codepoints that are unassigned in the relevant
2533+version of Unicode, or for which no normalization rules are
2534+defined, the <code>fn:normalize-unicode</code> function leaves such
2535+codepoints unchanged. If the implementation supports the requested
2536+normalization form then it <strong>must</strong> be able to handle
2537+every input string without raising an error.</p>
2538 </dd>
2539 <dt class="label">Error Conditions</dt>
2540 <dd>
2541- <p>An error is raised [<a href="#ERRFOCH0003" title="err:FOCH0003">err:FOCH0003</a>] if the effective value of the
2542-<code>$normalizationForm</code> argument is not one of the values
2543-supported by the implementation.</p>
2544+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFOCH0003" title="err:FOCH0003">err:FOCH0003</a>] if the effective value of
2545+the <code>$normalizationForm</code> argument is not one of the
2546+values supported by the implementation.</p>
2547 </dd>
2548 </dl>
2549 </div>
2550@@ -9903,7 +10133,7 @@
2551 </dd>
2552 <dt class="label">Properties</dt>
2553 <dd>
2554- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
2555+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
2556 <span class="arrow">·</span>deterministic<span class="arrow">·</span>
2557 </a>,
2558 <a title="context-dependent" class="termref" href="#dt-context-dependent">
2559@@ -9913,6 +10143,16 @@
2560 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
2561 </a>.
2562 It depends on collations.</p>
2563+ <p>The three-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
2564+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
2565+ </a>,
2566+<a title="context-dependent" class="termref" href="#dt-context-dependent">
2567+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
2568+ </a>,
2569+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
2570+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
2571+ </a>.
2572+It depends on collations, and static base uri.</p>
2573 </dd>
2574 <dt class="label">Rules</dt>
2575 <dd>
2576@@ -9944,8 +10184,9 @@
2577 </dd>
2578 <dt class="label">Error Conditions</dt>
2579 <dd>
2580- <p>An error <strong>may</strong> be raised [<a href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</a>] if the specified collation
2581-does not support collation units.</p>
2582+ <p>A <span>dynamic</span> error <strong>may</strong> be raised
2583+[<a href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</a>] if
2584+the specified collation does not support collation units.</p>
2585 </dd>
2586 <dt class="label">Examples</dt>
2587 <dd>
2588@@ -10041,7 +10282,7 @@
2589 </dd>
2590 <dt class="label">Properties</dt>
2591 <dd>
2592- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
2593+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
2594 <span class="arrow">·</span>deterministic<span class="arrow">·</span>
2595 </a>,
2596 <a title="context-dependent" class="termref" href="#dt-context-dependent">
2597@@ -10051,6 +10292,16 @@
2598 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
2599 </a>.
2600 It depends on collations.</p>
2601+ <p>The three-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
2602+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
2603+ </a>,
2604+<a title="context-dependent" class="termref" href="#dt-context-dependent">
2605+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
2606+ </a>,
2607+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
2608+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
2609+ </a>.
2610+It depends on collations, and static base uri.</p>
2611 </dd>
2612 <dt class="label">Rules</dt>
2613 <dd>
2614@@ -10082,8 +10333,9 @@
2615 </dd>
2616 <dt class="label">Error Conditions</dt>
2617 <dd>
2618- <p>An error <strong>may</strong> be raised [<a href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</a>] if the specified collation
2619-does not support collation units.</p>
2620+ <p>A <span>dynamic</span> error <strong>may</strong> be raised
2621+[<a href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</a>] if
2622+the specified collation does not support collation units.</p>
2623 </dd>
2624 <dt class="label">Examples</dt>
2625 <dd>
2626@@ -10180,7 +10432,7 @@
2627 </dd>
2628 <dt class="label">Properties</dt>
2629 <dd>
2630- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
2631+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
2632 <span class="arrow">·</span>deterministic<span class="arrow">·</span>
2633 </a>,
2634 <a title="context-dependent" class="termref" href="#dt-context-dependent">
2635@@ -10190,6 +10442,16 @@
2636 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
2637 </a>.
2638 It depends on collations.</p>
2639+ <p>The three-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
2640+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
2641+ </a>,
2642+<a title="context-dependent" class="termref" href="#dt-context-dependent">
2643+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
2644+ </a>,
2645+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
2646+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
2647+ </a>.
2648+It depends on collations, and static base uri.</p>
2649 </dd>
2650 <dt class="label">Rules</dt>
2651 <dd>
2652@@ -10221,8 +10483,9 @@
2653 </dd>
2654 <dt class="label">Error Conditions</dt>
2655 <dd>
2656- <p>An error <strong>may</strong> be raised [<a href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</a>] if the specified collation
2657-does not support collation units.</p>
2658+ <p>A <span>dynamic</span> error <strong>may</strong> be raised
2659+[<a href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</a>] if
2660+the specified collation does not support collation units.</p>
2661 </dd>
2662 <dt class="label">Examples</dt>
2663 <dd>
2664@@ -10318,7 +10581,7 @@
2665 </dd>
2666 <dt class="label">Properties</dt>
2667 <dd>
2668- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
2669+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
2670 <span class="arrow">·</span>deterministic<span class="arrow">·</span>
2671 </a>,
2672 <a title="context-dependent" class="termref" href="#dt-context-dependent">
2673@@ -10328,6 +10591,16 @@
2674 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
2675 </a>.
2676 It depends on collations.</p>
2677+ <p>The three-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
2678+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
2679+ </a>,
2680+<a title="context-dependent" class="termref" href="#dt-context-dependent">
2681+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
2682+ </a>,
2683+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
2684+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
2685+ </a>.
2686+It depends on collations, and static base uri.</p>
2687 </dd>
2688 <dt class="label">Rules</dt>
2689 <dd>
2690@@ -10359,8 +10632,9 @@
2691 </dd>
2692 <dt class="label">Error Conditions</dt>
2693 <dd>
2694- <p>An error <strong>may</strong> be raised [<a href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</a>] if the specified collation
2695-does not support collation units.</p>
2696+ <p>A <span>dynamic</span> error <strong>may</strong> be raised
2697+[<a href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</a>] if
2698+the specified collation does not support collation units.</p>
2699 </dd>
2700 <dt class="label">Examples</dt>
2701 <dd>
2702@@ -10453,7 +10727,7 @@
2703 </dd>
2704 <dt class="label">Properties</dt>
2705 <dd>
2706- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
2707+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
2708 <span class="arrow">·</span>deterministic<span class="arrow">·</span>
2709 </a>,
2710 <a title="context-dependent" class="termref" href="#dt-context-dependent">
2711@@ -10463,6 +10737,16 @@
2712 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
2713 </a>.
2714 It depends on collations.</p>
2715+ <p>The three-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
2716+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
2717+ </a>,
2718+<a title="context-dependent" class="termref" href="#dt-context-dependent">
2719+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
2720+ </a>,
2721+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
2722+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
2723+ </a>.
2724+It depends on collations, and static base uri.</p>
2725 </dd>
2726 <dt class="label">Rules</dt>
2727 <dd>
2728@@ -10494,8 +10778,9 @@
2729 </dd>
2730 <dt class="label">Error Conditions</dt>
2731 <dd>
2732- <p>An error <strong>may</strong> be raised [<a href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</a>] if the specified collation
2733-does not support collation units.</p>
2734+ <p>A <span>dynamic</span> error <strong>may</strong> be raised
2735+[<a href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</a>] if
2736+the specified collation does not support collation units.</p>
2737 </dd>
2738 <dt class="label">Examples</dt>
2739 <dd>
2740@@ -10632,6 +10917,9 @@
2741 <p>
2742 <code>[10] Char ::= [^.\?*+{}()|^$#x5B#x5D]</code>
2743 </p>
2744+ <p>The XSD 1.1 grammar for regular expressions uses the same
2745+production rule, but renumbered and renamed <code>[73]
2746+NormalChar</code>; it is affected in the same way.</p>
2747 <p>The characters <code>#x5B</code> and <code>#x5D</code>
2748 correspond to "<code>[</code>" and "<code>]</code>"
2749 respectively.</p>
2750@@ -10653,6 +10941,17 @@
2751 <code>[11] charClass ::= charClassEsc | charClassExpr |
2752 WildCardEsc | "^" | "$"</code>
2753 </p>
2754+ <p>Using XSD 1.1 as the baseline the equivalent is to change the
2755+production:</p>
2756+ <p>
2757+ <code>[74] charClass ::= SingleCharEsc | charClassEsc |
2758+charClassExpr | WildCardEsc</code>
2759+ </p>
2760+ <p>to read:</p>
2761+ <p>
2762+ <code>[74] charClass ::= SingleCharEsc | charClassEsc |
2763+charClassExpr | WildCardEsc | "^" | "$"</code>
2764+ </p>
2765 </li>
2766 <li>
2767 <p>
2768@@ -10700,6 +10999,8 @@
2769 <code>[4] quantifier ::= ( [?*+] | ( '{' quantity '}' ) )
2770 '?'?</code>
2771 </p>
2772+ <p>(In the XSD 1.1 version of the regular expression grammar, this
2773+rule is unchanged, but is renumbered [67])</p>
2774 <div class="note">
2775 <p class="prefix">
2776 <b>Note:</b>
2777@@ -10716,34 +11017,45 @@
2778 <p>Sub-expressions (groups) within the regular expression are
2779 recognized. The regular expression syntax defined by <a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
2780 allows a regular expression to contain parenthesized
2781-sub-expressions, but attaches no special significance to them. The
2782-<a href="#func-replace">
2783- <code>fn:replace</code>
2784- </a> function
2785-described below allows access to the parts of the input string that
2786-matched a sub-expression (called captured substrings). The
2787-sub-expressions are numbered according to the position of the
2788-opening parenthesis in left-to-right order within the top-level
2789-regular expression: the first opening parenthesis identifies
2790-captured substring 1, the second identifies captured substring 2,
2791-and so on. 0 identifies the substring captured by the entire
2792-regular expression. If a sub-expression matches more than one
2793-substring (because it is within a construct that allows
2794-repetition), then only the <em>last</em> substring that it matched
2795-will be captured.</p>
2796+sub-expressions, but attaches no special significance to them.
2797+<span>Some operations associated with regular expressions (for
2798+example, back-references, and the <a href="#func-replace">
2799+ <code>fn:replace</code>
2800+ </a> function) allow access
2801+to the parts of the input string that matched a sub-expression
2802+(called captured substrings).</span> The sub-expressions are
2803+numbered according to the position of the opening parenthesis in
2804+left-to-right order within the top-level regular expression: the
2805+first opening parenthesis identifies captured substring 1, the
2806+second identifies captured substring 2, and so on. 0 identifies the
2807+substring captured by the entire regular expression.</p>
2808+ <p>When parentheses are used in a part of the regular expression
2809+that is matched more than once (because it is within a construct
2810+that allows repetition), then only the last substring that it
2811+matched will be captured. Note that this rule is not sufficient in
2812+all cases to ensure an unambiguous result, especially in cases
2813+where (a) the regular expression contains nested repeating
2814+constructs, and/or (b) the repeating construct matches a
2815+zero-length string. In such cases it is implementation-dependent
2816+which substring is captured. For example given the regular
2817+expression <code>(a*)+</code> and the input string
2818+<code>"aaaa"</code>, an implementation might legitimately capture
2819+either <code>"aaaa"</code> or a zero length string as the content
2820+of the captured subgroup.</p>
2821 <p>Non-capturing groups are also recognized. These are indicated by
2822-the syntax <code>(?:xxxx)</code>. Specifically, the production rule
2823-for <code>atom</code> in <a href="#xmlschema-2">[XML Schema Part 2:
2824-Datatypes Second Edition]</a> is changed from:</p>
2825- <p>
2826- <code>[9] atom ::= Char | charClass | ( '(' regExp ')'
2827-)</code>
2828- </p>
2829- <p>to:</p>
2830- <p>
2831- <code>[9] atom ::= Char | charClass | ( '(' '?:'? regExp ')'
2832-)</code>
2833- </p>
2834+the syntax <code>(?:xxxx)</code>. The production rule for
2835+<code>atom</code> in <a href="#xmlschema-2">[XML Schema Part 2:
2836+Datatypes Second Edition]</a> is changed to replace the
2837+alternative:</p>
2838+ <p>
2839+ <code>( '(' regExp ')' )</code>
2840+ </p>
2841+ <p>with:</p>
2842+ <p>
2843+ <code>( '(' '?:'? regExp ')' )</code>
2844+ </p>
2845+ <p>(For the new versions of the XSD 1.0 and XSD 1.1 production
2846+rules for <code>atom</code>, see below.)</p>
2847 <p>The presence of the optional <code>?:</code> has no effect on
2848 the set of strings that match the regular expression, but causes
2849 the left parenthesis not to be counted by operations that number
2850@@ -10775,7 +11087,9 @@
2851 <p>If no string is matched by the <code>N</code>th capturing
2852 subexpression, the back-reference is interpreted as matching a
2853 zero-length string.</p>
2854- <p>Back-references change the following production:</p>
2855+ <p>Combining this change with the introduction of non-capturing
2856+groups (see above), back-references change the following
2857+production:</p>
2858 <p>
2859 <span>
2860 <code>[9] atom ::= Char | charClass | ( '(' regExp ')'
2861@@ -10785,8 +11099,8 @@
2862 <p>to</p>
2863 <p>
2864 <span>
2865- <code>[9] atom ::= Char | charClass | ( '(' regExp ')' ) |
2866-backReference</code>
2867+ <code>[9] atom ::= Char | charClass | ( '(' '?:'? regExp
2868+')' ) | backReference</code>
2869 </span>
2870 </p>
2871 <p>
2872@@ -10795,6 +11109,27 @@
2873 [1-9][0-9]*</code>
2874 </span>
2875 </p>
2876+ <p>With respect to the XSD 1.1 version of the regular expression
2877+grammar, the effect is to change:</p>
2878+ <p>
2879+ <span>
2880+ <code>[72] atom ::= NormalChar | charClass | ( '(' regExp
2881+')' )</code>
2882+ </span>
2883+ </p>
2884+ <p>to</p>
2885+ <p>
2886+ <span>
2887+ <code>[72] atom ::= NormalChar | charClass | ( '(' '?:'?
2888+regExp ')' ) | backReference</code>
2889+ </span>
2890+ </p>
2891+ <p>
2892+ <span>
2893+ <code>[72a] backReference ::= "\"
2894+[1-9][0-9]*</code>
2895+ </span>
2896+ </p>
2897 <div class="note">
2898 <p class="prefix">
2899 <b>Note:</b>
2900@@ -10820,6 +11155,23 @@
2901 <code>[24]SingleCharEsc ::= '\'
2902 [nrt\|.?*+(){}$#x2D#x5B#x5D#x5E]</code>
2903 </p>
2904+ <p>(In the XSD 1.1 version of the regular expression grammar, the
2905+production rule for <code>SingleCharEsc</code> is unchanged, but is
2906+renumbered [84])</p>
2907+ </li>
2908+ <li>
2909+ <p>A regular expression that uses a Unicode block name that is not
2910+defined in the version(s) of Unicode supported by the processor
2911+(for example <code>\p{IsBadBlockName}</code>) is deemed to be
2912+invalid [<a href="#ERRFORX0002" title="err:FORX0002">err:FORX0002</a>].</p>
2913+ <div class="note">
2914+ <p class="prefix">
2915+ <b>Note:</b>
2916+ </p>
2917+ <p>XSD 1.0 does not say how this situation should be handled; XSD
2918+1.1 says that it should be handled by treating all characters as
2919+matching.</p>
2920+ </div>
2921 </li>
2922 </ul>
2923 <div class="note">
2924@@ -10842,7 +11194,8 @@
2925 of a letter within the string indicates that the option is on; its
2926 absence indicates that the option is off. Letters may appear in any
2927 order and may be repeated. If there are characters present that are
2928-not defined here as flags, then an error is raised [<a href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</a>].</p>
2929+not defined here as flags, then a <span>dynamic</span> error is
2930+raised [<a href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</a>].</p>
2931 <p>The following options are defined:</p>
2932 <ul>
2933 <li>
2934@@ -10850,11 +11203,12 @@
2935 <code>s</code>: If present, the match operates in "dot-all"
2936 mode. (Perl calls this the single-line mode.) If the <code>s</code>
2937 flag is not specified, the meta-character <code>.</code> matches
2938-any character except a newline (<code>#x0A</code>) character. In
2939-dot-all mode, the meta-character <code>.</code> matches any
2940-character whatsoever. Suppose the input contains "hello" and
2941-"world" on two lines. This will not be matched by the regular
2942-expression "hello.*world" unless dot-all mode is enabled.</p>
2943+any character except a newline (<code>#x0A</code>) <span>or
2944+carriage return (<code>#x0D</code>)</span> character. In dot-all
2945+mode, the meta-character <code>.</code> matches any character
2946+whatsoever. Suppose the input contains "hello" and "world" on two
2947+lines. This will not be matched by the regular expression
2948+"hello.*world" unless dot-all mode is enabled.</p>
2949 </li>
2950 <li>
2951 <p>
2952@@ -10884,13 +11238,7 @@
2953 <p>
2954 <a href="#func-lower-case">
2955 <code>fn:lower-case(C1) eq
2956-fn:lower-case(C2)</code>
2957- </a>
2958- </p>
2959- <p>or</p>
2960- <p>
2961- <a href="#func-upper-case">
2962- <code>fn:upper-case(C1) eq
2963+fn:lower-case(C2) or fn:upper-case(C1) eq
2964 fn:upper-case(C2)</code>
2965 </a>
2966 </p>
2967@@ -10904,7 +11252,9 @@
2968 both "z" and "Z".</p>
2969 </li>
2970 <li>
2971- <p>A character range (<code>charRange</code>) represents the set
2972+ <p>A character range (<span>production <code>charRange</code> in
2973+the XSD 1.0 grammar, replaced by productions <code>charRange</code>
2974+and <code>singleChar</code> in XSD 1.1</span>) represents the set
2975 containing all the characters that it would match in the absence of
2976 the "<code>i</code>" flag, together with their case-variants. For
2977 example, the regular expression "[A-Z]" will match all the letters
2978@@ -11109,13 +11459,13 @@
2979 </dd>
2980 <dt class="label">Error Conditions</dt>
2981 <dd>
2982- <p>An error is raised [<a href="#ERRFORX0002" title="err:FORX0002">err:FORX0002</a>] if the value of
2983+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORX0002" title="err:FORX0002">err:FORX0002</a>] if the value of
2984 <code>$pattern</code> is invalid according to the rules described
2985 in <a href="#regex-syntax">
2986 <b>5.6.1 Regular expression
2987 syntax</b>
2988 </a>.</p>
2989- <p>An error is raised [<a href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</a>] if the value of
2990+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</a>] if the value of
2991 <code>$flags</code> is invalid according to the rules described in
2992 <a href="#flags">
2993 <b>5.6.1.1 Flags</b>
2994@@ -11127,7 +11477,7 @@
2995 used as anchors, the string is considered to match the pattern if
2996 any substring matches the pattern. But if anchors are used, the
2997 anchors must match the start/end of the string (in string mode), or
2998-the start/end of a line (in multiline mode).</p>
2999+the start/end of a line (in multi-line mode).</p>
3000 <p>This is different from the behavior of patterns in <a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>,
3001 where regular expressions are <em>implicitly</em> anchored.</p>
3002 <p>Regular expression matching is defined on the basis of Unicode
3003@@ -11355,29 +11705,29 @@
3004 </dd>
3005 <dt class="label">Error Conditions</dt>
3006 <dd>
3007- <p>An error is raised [<a href="#ERRFORX0002" title="err:FORX0002">err:FORX0002</a>] if the value of
3008+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORX0002" title="err:FORX0002">err:FORX0002</a>] if the value of
3009 <code>$pattern</code> is invalid according to the rules described
3010 in section <a href="#regex-syntax">
3011 <b>5.6.1 Regular expression
3012 syntax</b>
3013 </a>.</p>
3014- <p>An error is raised [<a href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</a>] if the value of
3015+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</a>] if the value of
3016 <code>$flags</code> is invalid according to the rules described in
3017 section <a href="#regex-syntax">
3018 <b>5.6.1 Regular expression
3019 syntax</b>
3020 </a>.</p>
3021- <p>An error is raised [<a href="#ERRFORX0003" title="err:FORX0003">err:FORX0003</a>] if the pattern matches a
3022+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORX0003" title="err:FORX0003">err:FORX0003</a>] if the pattern matches a
3023 zero-length string, that is, if the expression <a href="#func-matches">
3024 <code>fn:matches("", $pattern, $flags)</code>
3025 </a>
3026 returns <code>true</code>. It is not an error, however, if a
3027 captured substring is zero-length.</p>
3028- <p>An error is raised [<a href="#ERRFORX0004" title="err:FORX0004">err:FORX0004</a>] if the value of
3029+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORX0004" title="err:FORX0004">err:FORX0004</a>] if the value of
3030 <code>$replacement</code> contains a "<code>$</code>" character
3031 that is not immediately followed by a digit <code>0-9</code> and
3032 not immediately preceded by a "\".</p>
3033- <p>An error is raised [<a href="#ERRFORX0004" title="err:FORX0004">err:FORX0004</a>] if the value of
3034+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORX0004" title="err:FORX0004">err:FORX0004</a>] if the value of
3035 <code>$replacement</code> contains a "<code>\</code>" character
3036 that is not part of a "<code>\\</code>" pair, unless it is
3037 immediately followed by a "<code>$</code>" character.</p>
3038@@ -11520,19 +11870,19 @@
3039 </dd>
3040 <dt class="label">Error Conditions</dt>
3041 <dd>
3042- <p>An error is raised [<a href="#ERRFORX0002" title="err:FORX0002">err:FORX0002</a>] if the value of
3043+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORX0002" title="err:FORX0002">err:FORX0002</a>] if the value of
3044 <code>$pattern</code> is invalid according to the rules described
3045 in section <a href="#regex-syntax">
3046 <b>5.6.1 Regular expression
3047 syntax</b>
3048 </a>.</p>
3049- <p>An error is raised [<a href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</a>] if the value of
3050+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</a>] if the value of
3051 <code>$flags</code> is invalid according to the rules described in
3052 section <a href="#regex-syntax">
3053 <b>5.6.1 Regular expression
3054 syntax</b>
3055 </a>.</p>
3056- <p>an error is raised [<a href="#ERRFORX0003" title="err:FORX0003">err:FORX0003</a>] if the supplied
3057+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORX0003" title="err:FORX0003">err:FORX0003</a>] if the supplied
3058 <code>$pattern</code> matches a zero-length string, that is, if
3059 <a href="#func-matches">
3060 <code>fn:matches("", $pattern,
3061@@ -11555,8 +11905,8 @@
3062 <p>The expression <code>fn:tokenize("1,15,,24,50,", ",")</code>
3063 returns <code>("1", "15", "", "24", "50", "")</code>.</p>
3064 <p>
3065- <code>fn:tokenize("abba", ".?")</code> raises the error
3066-[<a href="#ERRFORX0003" title="err:FORX0003">err:FORX0003</a>].</p>
3067+ <code>fn:tokenize("abba", ".?")</code> raises the
3068+<span>dynamic</span> error [<a href="#ERRFORX0003" title="err:FORX0003">err:FORX0003</a>].</p>
3069 <p>The expression <code>fn:tokenize("Some unparsed &lt;br&gt; HTML
3070 &lt;BR&gt; text", "\s*&lt;br&gt;\s*", "i")</code> returns
3071 <code>("Some unparsed", "HTML", "text")</code>.</p>
3072@@ -11737,6 +12087,13 @@
3073 example, a Basic XSLT Processor), in which case the elements will
3074 all be annotated as <code>xs:untyped</code> and the attributes as
3075 <code>xs:untypedAtomic</code>.</p>
3076+ <div class="note">
3077+ <p class="prefix">
3078+ <b>Note:</b>
3079+ </p>
3080+ <p>A free-standing copy of this schema can be found at <a href="analyze-string.xsd">analyze-string.xsd</a>
3081+ </p>
3082+ </div>
3083 <div class="exampleInner">
3084 <pre>
3085 &lt;?xml version="1.0" encoding="UTF-8"?&gt;
3086@@ -11776,25 +12133,33 @@
3087 </dd>
3088 <dt class="label">Error Conditions</dt>
3089 <dd>
3090- <p>An error is raised [<a href="#ERRFORX0002" title="err:FORX0002">err:FORX0002</a>] if the value of
3091+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORX0002" title="err:FORX0002">err:FORX0002</a>] if the value of
3092 <code>$pattern</code> is invalid according to the rules described
3093 in section <a href="#regex-syntax">
3094 <b>5.6.1 Regular expression
3095 syntax</b>
3096 </a>.</p>
3097- <p>An error is raised [<a href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</a>] if the value of
3098+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</a>] if the value of
3099 <code>$flags</code> is invalid according to the rules described in
3100 section <a href="#regex-syntax">
3101 <b>5.6.1 Regular expression
3102 syntax</b>
3103 </a>.</p>
3104- <p>An error is raised [<a href="#ERRFORX0003" title="err:FORX0003">err:FORX0003</a>] if the supplied
3105+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORX0003" title="err:FORX0003">err:FORX0003</a>] if the supplied
3106 <code>$pattern</code> matches a zero-length string, that is, if
3107 <a href="#func-matches">
3108 <code>fn:matches("", $pattern,
3109 $flags)</code>
3110 </a> returns <code>true</code>.</p>
3111 </dd>
3112+ <dt class="label">Notes</dt>
3113+ <dd>
3114+ <p>The declarations and definitions in the above schema are not
3115+automatically available in the static context of the
3116+<code>fn:analyze-string</code> call (or of any other expression).
3117+The contents of the static context are host-language defined, and
3118+in some host languages are implementation-defined.</p>
3119+ </dd>
3120 <dt class="label">Examples</dt>
3121 <dd>
3122 <p>In the following examples, the result document is shown in
3123@@ -11922,7 +12287,7 @@
3124 </dd>
3125 <dt class="label">Properties</dt>
3126 <dd>
3127- <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
3128+ <p>The one-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
3129 <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3130 </a>,
3131 <a title="context-dependent" class="termref" href="#dt-context-dependent">
3132@@ -11931,8 +12296,8 @@
3133 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3134 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3135 </a>.
3136-It depends on base-uri.</p>
3137- <p>The three-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
3138+It depends on static base uri.</p>
3139+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
3140 <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3141 </a>,
3142 <a title="context-independent" class="termref" href="#dt-context-independent">
3143@@ -11975,23 +12340,23 @@
3144 <dd>
3145 <p>The first form of this function resolves <code>$relative</code>
3146 against the value of the base-uri property from the static context.
3147-An error is raised [<a href="#ERRFONS0005" title="err:FONS0005">err:FONS0005</a>] if the base-uri property is not
3148-initialized in the static context.</p>
3149- <p>An error is raised [<a href="#ERRFORG0002" title="err:FORG0002">err:FORG0002</a>] if <code>$relative</code> is not a
3150-valid IRI according to the rules of RFC3987, extended with an
3151+A <span>dynamic</span> error is raised [<a href="#ERRFONS0005" title="err:FONS0005">err:FONS0005</a>] if the base-uri property is
3152+not initialized in the static context.</p>
3153+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORG0002" title="err:FORG0002">err:FORG0002</a>] if <code>$relative</code> is
3154+not a valid IRI according to the rules of RFC3987, extended with an
3155 implementation-defined subset of the extensions permitted in LEIRI,
3156 or if it is not a suitable relative reference to use as input to
3157 the RFC3986 resolution algorithm extended to handle additional
3158 unreserved characters.</p>
3159- <p>An error is raised [<a href="#ERRFORG0002" title="err:FORG0002">err:FORG0002</a>] if <code>$base</code> is not a
3160-valid IRI according to the rules of RFC3987, extended with an
3161+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORG0002" title="err:FORG0002">err:FORG0002</a>] if <code>$base</code> is not
3162+a valid IRI according to the rules of RFC3987, extended with an
3163 implementation-defined subset of the extensions permitted in LEIRI,
3164 or if it is not a suitable IRI to use as input to the chosen
3165 resolution algorithm (for example, if it is a relative IRI
3166 reference, if it is a non-hierarchic URI, or if it contains a
3167-fragment identifier), then .</p>
3168- <p>An error is raised [<a href="#ERRFORG0009" title="err:FORG0009">err:FORG0009</a>] if the chosen resolution algorithm
3169-fails for any other reason.</p>
3170+fragment identifier).</p>
3171+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORG0009" title="err:FORG0009">err:FORG0009</a>] if the chosen resolution
3172+algorithm fails for any other reason.</p>
3173 </dd>
3174 <dt class="label">Notes</dt>
3175 <dd>
3176@@ -14141,7 +14506,7 @@
3177 </dd>
3178 <dt class="label">Error Conditions</dt>
3179 <dd>
3180- <p>An error is raised [<a href="#ERRFOCA0005" title="err:FOCA0005">err:FOCA0005</a>] if <code>$arg2</code> is
3181+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFOCA0005" title="err:FOCA0005">err:FOCA0005</a>] if <code>$arg2</code> is
3182 <code>NaN</code>.</p>
3183 </dd>
3184 <dt class="label">Notes</dt>
3185@@ -14222,7 +14587,7 @@
3186 </dd>
3187 <dt class="label">Error Conditions</dt>
3188 <dd>
3189- <p>An error is raised [<a href="#ERRFOCA0005" title="err:FOCA0005">err:FOCA0005</a>] if <code>$arg2</code> is
3190+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFOCA0005" title="err:FOCA0005">err:FOCA0005</a>] if <code>$arg2</code> is
3191 <code>NaN</code>.</p>
3192 </dd>
3193 <dt class="label">Notes</dt>
3194@@ -14511,7 +14876,7 @@
3195 </dd>
3196 <dt class="label">Error Conditions</dt>
3197 <dd>
3198- <p>An error is raised [<a href="#ERRFOCA0005" title="err:FOCA0005">err:FOCA0005</a>] if <code>$arg2</code> is
3199+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFOCA0005" title="err:FOCA0005">err:FOCA0005</a>] if <code>$arg2</code> is
3200 <code>NaN</code>.</p>
3201 </dd>
3202 <dt class="label">Notes</dt>
3203@@ -14590,7 +14955,7 @@
3204 </dd>
3205 <dt class="label">Error Conditions</dt>
3206 <dd>
3207- <p>An error is raised [<a href="#ERRFOCA0005" title="err:FOCA0005">err:FOCA0005</a>] if <code>$arg2</code> is
3208+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFOCA0005" title="err:FOCA0005">err:FOCA0005</a>] if <code>$arg2</code> is
3209 <code>NaN</code>.</p>
3210 </dd>
3211 <dt class="label">Notes</dt>
3212@@ -14775,7 +15140,8 @@
3213 </a> return
3214 00:00:00 in case of time underflow. It <a title="must" class="termref" href="#must">
3215 <span class="arrow">·</span>must<span class="arrow">·</span>
3216- </a> raise an error [<a href="#ERRFODT0001" title="err:FODT0001">err:FODT0001</a>] in case of overflow.</p>
3217+ </a> raise a <span>dynamic</span> error [<a href="#ERRFODT0001" title="err:FODT0001">err:FODT0001</a>] in case of
3218+overflow.</p>
3219 </div>
3220 </div>
3221 <div class="div2">
3222@@ -14911,8 +15277,8 @@
3223 </dd>
3224 <dt class="label">Error Conditions</dt>
3225 <dd>
3226- <p>An error is raised [<a href="#ERRFORG0008" title="err:FORG0008">err:FORG0008</a>] if the two arguments both have
3227-timezones and the timezones are different.</p>
3228+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORG0008" title="err:FORG0008">err:FORG0008</a>] if the two arguments both
3229+have timezones and the timezones are different.</p>
3230 </dd>
3231 <dt class="label">Examples</dt>
3232 <dd>
3233@@ -15241,7 +15607,7 @@
3234 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3235 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3236 </a>.
3237-It depends on implicit-timezone.</p>
3238+It depends on implicit timezone.</p>
3239 </dd>
3240 <dt class="label">Rules</dt>
3241 <dd>
3242@@ -15306,7 +15672,7 @@
3243 <dd>
3244 <p>Defines the semantics of the "lt" operator on
3245 <code>xs:dateTime</code> values. Also used in the definition of the
3246-"le" operator.</p>
3247+<span>"ge"</span> operator.</p>
3248 </dd>
3249 <dt class="label">Signature</dt>
3250 <dd>
3251@@ -15332,7 +15698,7 @@
3252 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3253 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3254 </a>.
3255-It depends on implicit-timezone.</p>
3256+It depends on implicit timezone.</p>
3257 </dd>
3258 <dt class="label">Rules</dt>
3259 <dd>
3260@@ -15364,7 +15730,7 @@
3261 <dd>
3262 <p>Defines the semantics of the "gt" operator on
3263 <code>xs:dateTime</code> values. Also used in the definition of the
3264-"ge" operator.</p>
3265+<span>"le"</span> operator.</p>
3266 </dd>
3267 <dt class="label">Signature</dt>
3268 <dd>
3269@@ -15406,7 +15772,7 @@
3270 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3271 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3272 </a>.
3273-It depends on implicit-timezone.</p>
3274+It depends on implicit timezone.</p>
3275 </dd>
3276 <dt class="label">Rules</dt>
3277 <dd>
3278@@ -15459,7 +15825,7 @@
3279 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3280 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3281 </a>.
3282-It depends on implicit-timezone.</p>
3283+It depends on implicit timezone.</p>
3284 </dd>
3285 <dt class="label">Rules</dt>
3286 <dd>
3287@@ -15503,7 +15869,7 @@
3288 <dd>
3289 <p>Defines the semantics of the "lt" operator on
3290 <code>xs:date</code> values. Also used in the definition of the
3291-"le" operator.</p>
3292+<span>"ge"</span> operator.</p>
3293 </dd>
3294 <dt class="label">Signature</dt>
3295 <dd>
3296@@ -15556,7 +15922,7 @@
3297 <dd>
3298 <p>Defines the semantics of the "gt" operator on
3299 <code>xs:date</code> values. Also used in the definition of the
3300-"ge" operator.</p>
3301+<span>"le"</span> operator.</p>
3302 </dd>
3303 <dt class="label">Signature</dt>
3304 <dd>
3305@@ -15582,7 +15948,7 @@
3306 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3307 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3308 </a>.
3309-It depends on implicit-timezone.</p>
3310+It depends on implicit timezone.</p>
3311 </dd>
3312 <dt class="label">Rules</dt>
3313 <dd>
3314@@ -15647,7 +16013,7 @@
3315 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3316 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3317 </a>.
3318-It depends on implicit-timezone.</p>
3319+It depends on implicit timezone.</p>
3320 </dd>
3321 <dt class="label">Rules</dt>
3322 <dd>
3323@@ -15677,7 +16043,7 @@
3324 date components are <code>1972-12-31T08:00:00+09:00</code> and
3325 <code>1972-12-31T17:00:00-06:00</code>. These normalize to
3326 <code>1972-12-30T23:00:00Z</code> and
3327-<code>1972-12-31T23:00:00</code>. ).</em>
3328+<code>1972-12-31T23:00:00Z</code>. ).</em>
3329 </p>
3330 <p>The expression <code>op:time-equal(xs:time("21:30:00+10:30"),
3331 xs:time("06:00:00-05:00"))</code> returns <code>true()</code>.</p>
3332@@ -15712,7 +16078,7 @@
3333 <dd>
3334 <p>Defines the semantics of the "lt" operator on
3335 <code>xs:time</code> values. Also used in the definition of the
3336-"le" operator.</p>
3337+<span>"ge"</span> operator.</p>
3338 </dd>
3339 <dt class="label">Signature</dt>
3340 <dd>
3341@@ -15738,7 +16104,7 @@
3342 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3343 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3344 </a>.
3345-It depends on implicit-timezone.</p>
3346+It depends on implicit timezone.</p>
3347 </dd>
3348 <dt class="label">Rules</dt>
3349 <dd>
3350@@ -15786,7 +16152,7 @@
3351 <dd>
3352 <p>Defines the semantics of the "gt" operator on
3353 <code>xs:time</code> values. Also used in the definition of the
3354-"ge" operator.</p>
3355+<span>"le"</span> operator.</p>
3356 </dd>
3357 <dt class="label">Signature</dt>
3358 <dd>
3359@@ -15812,7 +16178,7 @@
3360 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3361 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3362 </a>.
3363-It depends on implicit-timezone.</p>
3364+It depends on implicit timezone.</p>
3365 </dd>
3366 <dt class="label">Rules</dt>
3367 <dd>
3368@@ -15886,7 +16252,7 @@
3369 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3370 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3371 </a>.
3372-It depends on implicit-timezone.</p>
3373+It depends on implicit timezone.</p>
3374 </dd>
3375 <dt class="label">Rules</dt>
3376 <dd>
3377@@ -15911,7 +16277,7 @@
3378 <p>
3379 <code>op:gYearMonth-equal(xs:gYearMonth("1978-03"),
3380 xs:gYearMonth("1986-03Z"))</code> returns <code>false()</code>. The
3381-starting instants are <code>1986-03-01T00:00:00-05:00</code> and
3382+starting instants are <code>1978-03-01T00:00:00-05:00</code> and
3383 <code>1986-03-01T00:00:00Z</code>, respectively.</p>
3384 </dd>
3385 </dl>
3386@@ -15956,7 +16322,7 @@
3387 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3388 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3389 </a>.
3390-It depends on implicit-timezone.</p>
3391+It depends on implicit timezone.</p>
3392 </dd>
3393 <dt class="label">Rules</dt>
3394 <dd>
3395@@ -16027,7 +16393,7 @@
3396 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3397 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3398 </a>.
3399-It depends on implicit-timezone.</p>
3400+It depends on implicit timezone.</p>
3401 </dd>
3402 <dt class="label">Rules</dt>
3403 <dd>
3404@@ -16102,7 +16468,7 @@
3405 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3406 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3407 </a>.
3408-It depends on implicit-timezone.</p>
3409+It depends on implicit timezone.</p>
3410 </dd>
3411 <dt class="label">Rules</dt>
3412 <dd>
3413@@ -16174,7 +16540,7 @@
3414 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3415 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3416 </a>.
3417-It depends on implicit-timezone.</p>
3418+It depends on implicit timezone.</p>
3419 </dd>
3420 <dt class="label">Rules</dt>
3421 <dd>
3422@@ -17202,7 +17568,7 @@
3423 <code class="function">fn:adjust-dateTime-to-timezone</code>(<code class="arg">$arg</code>
3424 <code class="as"> as </code>
3425 <code class="type">xs:dateTime?</code>)<code class="as"> as </code>
3426- <code class="return-type">xs:dateTime</code>
3427+ <code class="return-type">xs:dateTime?</code>
3428 </div>
3429 </div>
3430 <div class="exampleInner">
3431@@ -17225,7 +17591,7 @@
3432 <td valign="baseline">
3433 <code class="as"> as </code>
3434 <code class="type">xs:dayTimeDuration?</code>)<code class="as"> as </code>
3435- <code class="return-type">xs:dateTime</code>
3436+ <code class="return-type">xs:dateTime?</code>
3437 </td>
3438 </tr>
3439 </table>
3440@@ -17243,7 +17609,7 @@
3441 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3442 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3443 </a>.
3444-It depends on implicit-timezone.</p>
3445+It depends on implicit timezone.</p>
3446 <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
3447 <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3448 </a>,
3449@@ -17279,9 +17645,9 @@
3450 </dd>
3451 <dt class="label">Error Conditions</dt>
3452 <dd>
3453- <p>An error is raised [<a href="#ERRFODT0003" title="err:FODT0003">err:FODT0003</a>] if <code>$timezone</code> is less
3454-than <code>-PT14H</code> or greater than <code>PT14H</code> or is
3455-not an integral number of minutes.</p>
3456+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODT0003" title="err:FODT0003">err:FODT0003</a>] if <code>$timezone</code> is
3457+less than <code>-PT14H</code> or greater than <code>PT14H</code> or
3458+is not an integral number of minutes.</p>
3459 </dd>
3460 <dt class="label">Examples</dt>
3461 <dd>
3462@@ -17383,7 +17749,7 @@
3463 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3464 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3465 </a>.
3466-It depends on implicit-timezone.</p>
3467+It depends on implicit timezone.</p>
3468 <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
3469 <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3470 </a>,
3471@@ -17436,9 +17802,9 @@
3472 </dd>
3473 <dt class="label">Error Conditions</dt>
3474 <dd>
3475- <p>An error is raised [<a href="#ERRFODT0003" title="err:FODT0003">err:FODT0003</a>] if <code>$timezone</code> is less
3476-than <code>-PT14H</code> or greater than <code>PT14H</code> or is
3477-not an integral number of minutes.</p>
3478+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODT0003" title="err:FODT0003">err:FODT0003</a>] if <code>$timezone</code> is
3479+less than <code>-PT14H</code> or greater than <code>PT14H</code> or
3480+is not an integral number of minutes.</p>
3481 </dd>
3482 <dt class="label">Examples</dt>
3483 <dd>
3484@@ -17537,7 +17903,7 @@
3485 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3486 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3487 </a>.
3488-It depends on implicit-timezone.</p>
3489+It depends on implicit timezone.</p>
3490 <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
3491 <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3492 </a>,
3493@@ -17590,9 +17956,9 @@
3494 </dd>
3495 <dt class="label">Error Conditions</dt>
3496 <dd>
3497- <p>An error is raised [<a href="#ERRFODT0003" title="err:FODT0003">err:FODT0003</a>] if <code>$timezone</code> is less
3498-than <code>-PT14H</code> or greater than <code>PT14H</code> or if
3499-does not contain an integral number of minutes.</p>
3500+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODT0003" title="err:FODT0003">err:FODT0003</a>] if <code>$timezone</code> is
3501+less than <code>-PT14H</code> or greater than <code>PT14H</code> or
3502+if does not contain an integral number of minutes.</p>
3503 </dd>
3504 <dt class="label">Examples</dt>
3505 <dd>
3506@@ -17787,9 +18153,8 @@
3507 </a> return P0M or PT0S in case of duration
3508 underflow and 00:00:00 in case of time underflow. It <a title="must" class="termref" href="#must">
3509 <span class="arrow">·</span>must<span class="arrow">·</span>
3510- </a> raise an error
3511-[<a href="#ERRFODT0001" title="err:FODT0001">err:FODT0001</a>] in
3512-case of overflow.</p>
3513+ </a> raise a
3514+<span>dynamic</span> error [<a href="#ERRFODT0001" title="err:FODT0001">err:FODT0001</a>] in case of overflow.</p>
3515 <p>The value spaces of the two totally ordered subtypes of
3516 <code>xs:duration</code> described in <a href="#duration-subtypes">
3517 <b>8.1 Two totally ordered subtypes of
3518@@ -17810,7 +18175,8 @@
3519 case of numeric underflow and P0M or PT0S in case of duration
3520 underflow. It <a title="must" class="termref" href="#must">
3521 <span class="arrow">·</span>must<span class="arrow">·</span>
3522- </a> raise an error [<a href="#ERRFODT0002" title="err:FODT0002">err:FODT0002</a>] in case of overflow.</p>
3523+ </a> raise a <span>dynamic</span> error [<a href="#ERRFODT0002" title="err:FODT0002">err:FODT0002</a>] in case of
3524+overflow.</p>
3525 </div>
3526 <div class="div3">
3527 <h4>
3528@@ -17867,7 +18233,7 @@
3529 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3530 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3531 </a>.
3532-It depends on implicit-timezone.</p>
3533+It depends on implicit timezone.</p>
3534 </dd>
3535 <dt class="label">Rules</dt>
3536 <dd>
3537@@ -17940,7 +18306,7 @@
3538 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3539 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3540 </a>.
3541-It depends on implicit-timezone.</p>
3542+It depends on implicit timezone.</p>
3543 </dd>
3544 <dt class="label">Rules</dt>
3545 <dd>
3546@@ -18029,7 +18395,7 @@
3547 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3548 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3549 </a>.
3550-It depends on implicit-timezone.</p>
3551+It depends on implicit timezone.</p>
3552 </dd>
3553 <dt class="label">Rules</dt>
3554 <dd>
3555@@ -18962,15 +19328,27 @@
3556 </dd>
3557 <dt class="label">Properties</dt>
3558 <dd>
3559- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
3560- <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3561- </a>,
3562-<a title="context-dependent" class="termref" href="#dt-context-dependent">
3563- <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
3564- </a>,
3565-and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3566- <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3567- </a>.</p>
3568+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
3569+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3570+ </a>,
3571+<a title="context-dependent" class="termref" href="#dt-context-dependent">
3572+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
3573+ </a>,
3574+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3575+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3576+ </a>.
3577+It depends on default calendar, and default language, and default
3578+place, and implicit timezone.</p>
3579+ <p>The five-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
3580+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3581+ </a>,
3582+<a title="context-dependent" class="termref" href="#dt-context-dependent">
3583+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
3584+ </a>,
3585+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3586+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3587+ </a>.
3588+It depends on implicit timezone.</p>
3589 </dd>
3590 <dt class="label">Rules</dt>
3591 <dd>
3592@@ -19056,15 +19434,27 @@
3593 </dd>
3594 <dt class="label">Properties</dt>
3595 <dd>
3596- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
3597- <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3598- </a>,
3599-<a title="context-dependent" class="termref" href="#dt-context-dependent">
3600- <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
3601- </a>,
3602-and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3603- <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3604- </a>.</p>
3605+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
3606+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3607+ </a>,
3608+<a title="context-dependent" class="termref" href="#dt-context-dependent">
3609+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
3610+ </a>,
3611+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3612+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3613+ </a>.
3614+It depends on default calendar, and default language, and default
3615+place, and implicit timezone.</p>
3616+ <p>The five-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
3617+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3618+ </a>,
3619+<a title="context-dependent" class="termref" href="#dt-context-dependent">
3620+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
3621+ </a>,
3622+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3623+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3624+ </a>.
3625+It depends on implicit timezone.</p>
3626 </dd>
3627 <dt class="label">Rules</dt>
3628 <dd>
3629@@ -19150,15 +19540,27 @@
3630 </dd>
3631 <dt class="label">Properties</dt>
3632 <dd>
3633- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
3634- <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3635- </a>,
3636-<a title="context-dependent" class="termref" href="#dt-context-dependent">
3637- <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
3638- </a>,
3639-and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3640- <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3641- </a>.</p>
3642+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
3643+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3644+ </a>,
3645+<a title="context-dependent" class="termref" href="#dt-context-dependent">
3646+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
3647+ </a>,
3648+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3649+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3650+ </a>.
3651+It depends on default calendar, and default language, and default
3652+place, and implicit timezone.</p>
3653+ <p>The five-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
3654+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
3655+ </a>,
3656+<a title="context-dependent" class="termref" href="#dt-context-dependent">
3657+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
3658+ </a>,
3659+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
3660+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
3661+ </a>.
3662+It depends on implicit timezone.</p>
3663 </dd>
3664 <dt class="label">Rules</dt>
3665 <dd>
3666@@ -19219,11 +19621,14 @@
3667 </a>.</p>
3668 <p>In general, the use of an invalid <code>$picture</code>,
3669 <code>$language</code>, <code>$calendar</code>, or
3670-<code>$place</code> argument results in a dynamic error. By
3671-contrast, use of an option in any of these arguments that is valid
3672-but not supported by the implementation is not an error, and in
3673-these cases the implementation is required to output the value in a
3674-fallback representation.</p>
3675+<code>$place</code> argument results in a dynamic error
3676+<span>([<a href="#ERRFOFD1340" title="err:FOFD1340">err:FOFD1340</a>])</span>. By contrast, use of an
3677+option in any of these arguments that is valid but not supported by
3678+the implementation is not an error, and in these cases the
3679+implementation is required to output the value in a fallback
3680+representation. <span>More detailed rules are given
3681+below.</span>
3682+ </p>
3683 <div class="div4">
3684 <h5>
3685 <a name="date-picture-string" id="date-picture-string"/>9.8.4.1 The picture string</h5>
3686@@ -19370,11 +19775,11 @@
3687 </tr>
3688 </tbody>
3689 </table>
3690- <p>An error is reported [<a href="#ERRFOFD1340" title="err:FOFD1340">err:FOFD1340</a>] if the syntax of the picture is
3691-incorrect.</p>
3692- <p>An error is reported [<a href="#ERRFOFD1350" title="err:FOFD1350">err:FOFD1350</a>] if a component specifier within
3693-the picture refers to components that are not available in the
3694-given type of <code>$value</code>, for example if the picture
3695+ <p>A <span>dynamic</span> error is reported [<a href="#ERRFOFD1340" title="err:FOFD1340">err:FOFD1340</a>] if the syntax of the picture
3696+is incorrect.</p>
3697+ <p>A <span>dynamic</span> error is reported [<a href="#ERRFOFD1350" title="err:FOFD1350">err:FOFD1350</a>] if a component specifier
3698+within the picture refers to components that are not available in
3699+the given type of <code>$value</code>, for example if the picture
3700 supplied to the <a href="#func-format-time">
3701 <code>fn:format-time</code>
3702 </a> refers to the
3703@@ -19403,8 +19808,9 @@
3704 respectively. Components that can be output by name include (but
3705 are not limited to) months, days of the week, timezones, and eras.
3706 If the processor cannot output these components by name for the
3707-chosen calendar and language then it must use an
3708-implementation-defined fallback representation.</p>
3709+chosen calendar and language then it must use an <a title="implementation-defined" class="termref" href="#implementation-defined">
3710+ <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
3711+ </a> fallback representation.</p>
3712 </li>
3713 </ul>
3714 <p>If a comma is to be used as a grouping separator within the
3715@@ -19432,8 +19838,10 @@
3716 <td valign="top">either <code>a</code> or <code>t</code>
3717 </td>
3718 <td valign="top">indicates alphabetic or traditional numbering
3719-respectively, the default being implementation-defined. This has
3720-the same meaning as in the second argument of <a href="#func-format-integer">
3721+respectively, the default being <a title="implementation-defined" class="termref" href="#implementation-defined">
3722+ <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
3723+ </a>. This has the same meaning as in the second
3724+argument of <a href="#func-format-integer">
3725 <code>fn:format-integer</code>
3726 </a>.</td>
3727 </tr>
3728@@ -19507,9 +19915,11 @@
3729 output. In the case of fractional seconds in particular,
3730 <code>[f001]</code> requests three decimal digits,
3731 <code>[f01]</code> requests two digits, but <code>[f1]</code> will
3732-produce an implementation-defined number of digits. If exactly one
3733-digit is required, this can be achieved using the component
3734-specifier <code>[f1,1-1]</code>.</p>
3735+produce an <a title="implementation-defined" class="termref" href="#implementation-defined">
3736+ <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
3737+ </a> number of digits. If exactly one digit is
3738+required, this can be achieved using the component specifier
3739+<code>[f1,1-1]</code>.</p>
3740 </div>
3741 <p>If the minimum and maximum width are unspecified, then the
3742 output uses as many characters as are required to represent the
3743@@ -19687,7 +20097,7 @@
3744 <td>-5</td>
3745 <td>+0</td>
3746 <td>+5:30</td>
3747- <td>+13:00</td>
3748+ <td>+13</td>
3749 </tr>
3750 <tr>
3751 <td>[Z0:00]</td>
3752@@ -19792,12 +20202,14 @@
3753 component.</p>
3754 <p>The <code>$language</code> argument specifies the language to be
3755 used for the result string of the function. The value of the
3756-argument <strong>must</strong> be either the empty sequence or a
3757-value that would be valid for the <code>xml:lang</code> attribute
3758-(see [XML]). Note that this permits the identification of
3759-sublanguages based on country codes (from <a href="#ISO3166">[ISO
3760-3166-1]</a>) as well as identification of dialects and of regions
3761-within a country.</p>
3762+argument <span>
3763+ <strong>should</strong>
3764+ </span> be either the empty
3765+sequence or a value that would be valid for the
3766+<code>xml:lang</code> attribute (see [XML]). Note that this permits
3767+the identification of sublanguages based on country codes (from
3768+<a href="#ISO3166">[ISO 3166-1]</a>) as well as identification of
3769+dialects and of regions within a country.</p>
3770 <p>If the <code>$language</code> argument is omitted or is set to
3771 an empty sequence, or if it is set to an invalid value or a value
3772 that the implementation does not recognize, then the processor uses
3773@@ -19836,14 +20248,19 @@
3774 supplied in the <code>$value</code> argument <strong>must</strong>
3775 be converted to a value in the specified calendar and then
3776 converted to a string using the conventions of that calendar.</p>
3777- <p>A calendar value <strong>must</strong> be a valid lexical QName.
3778-If the QName does not have a prefix, then it identifies a calendar
3779-with the designator specified below. If the QName has a prefix,
3780-then the QName is expanded into an expanded-QName using the
3781-<span>statically known namespaces</span>; the expanded-QName
3782-identifies the calendar; the behavior in this case is <a title="implementation-defined" class="termref" href="#implementation-defined">
3783+ <p>The calendar value if present <strong>must</strong> be a valid
3784+<span>
3785+ <code>EQName</code> (<span>dynamic</span> error: [<a href="#ERRFOFD1340" title="err:FOFD1340">err:FOFD1340</a>])</span>. If
3786+it is a lexical <code>QName</code> then it is expanded into an
3787+expanded QName using the <span>statically known namespaces</span>;
3788+if it has no prefix then it represents an expanded-QName in no
3789+namespace. If the expanded QName is in no namespace, then it
3790+<strong>must</strong> identify a calendar with a designator
3791+specified below (<span>dynamic error: [<a href="#ERRFOFD1340" title="err:FOFD1340">err:FOFD1340</a>])</span>. If the expanded
3792+QName is in a namespace then it identifies the calendar in an
3793+<a title="implementation-defined" class="termref" href="#implementation-defined">
3794 <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
3795- </a>.</p>
3796+ </a> way.</p>
3797 <p>If the <code>$calendar</code> argument is omitted or is set to
3798 an empty sequence then the default calendar defined in the dynamic
3799 context is used.</p>
3800@@ -20018,6 +20435,15 @@
3801 zero-length string (for positive years). For dates before 1
3802 January, AD 1, year numbers in the ISO and AD calendars are off by
3803 one from each other: ISO year 0000 is 1 BC, -0001 is 2 BC, etc.</p>
3804+ <p>ISO 8601 does not define a numbering for weeks within a month.
3805+When the <code>w</code> component is used, the convention to be
3806+adopted is that each Monday-to-Sunday week is considered to fall
3807+within a particular month if its Thursday occurs in that month; the
3808+weeks that fall in a particular month under this definition are
3809+numbered starting from 1. Thus, for example, 29 January 2013 falls
3810+in week 5 because the Thursday of the week (31 January 2013) is the
3811+fifth Thursday in January, and 1 February 2013 is also in week 5
3812+for the same reason.</p>
3813 <div class="note">
3814 <p class="prefix">
3815 <b>Note:</b>
3816@@ -20052,12 +20478,12 @@
3817 numbered zero. In <a href="#xmlschema-2">[XML Schema Part 2:
3818 Datatypes Second Edition]</a> (version 1.0), the value space for
3819 <code>xs:date</code> and <code>xs:dateTime</code> does not include
3820-a year zero: however, a future edition is expected to endorse the
3821-ISO 8601 convention. This means that the date on which Julius
3822-Caesar was assassinated has the ISO 8601 lexical representation
3823--0043-03-13, but will be formatted as 15 March 44 BCE in the Julian
3824-calendar or 13 March 44 BCE in the Gregorian calendar (dependant on
3825-the chosen localization of the names of months and eras).</p>
3826+a year zero: however, <span>XSD 1.1 endorses</span> the ISO 8601
3827+convention. This means that the date on which Julius Caesar was
3828+assassinated has the ISO 8601 lexical representation -0043-03-13,
3829+but will be formatted as 15 March 44 BCE in the Julian calendar or
3830+13 March 44 BCE in the Gregorian calendar (dependant on the chosen
3831+localization of the names of months and eras).</p>
3832 </div>
3833 <p>The intended use of the <code>$place</code> argument is to
3834 identify the place where an event represented by the
3835@@ -20067,8 +20493,10 @@
3836 is set to an empty sequence, then the default place defined in the
3837 dynamic context is used.</span> If the value is supplied, and is
3838 not the empty sequence, then it <strong>should</strong>
3839- <span>either be a country code or an Olson timezone
3840-name.</span>
3841+ <span>either be a country code or an Olson timezone name.</span>
3842+ <span>If the value does not take this form, or if its value is not
3843+recognized by the implementation, then the default place defined in
3844+the dynamic context is used.</span>
3845 </p>
3846 <ul>
3847 <li>
3848@@ -20122,7 +20550,7 @@
3849 Examples of date and time formatting</h4>
3850 <div class="exampleOuter">
3851 <div class="exampleHeader">
3852- <a name="d5e25744" id="d5e25744"/>Example: Gregorian calendar</div>
3853+ <a name="d5e26542" id="d5e26542"/>Example: Gregorian calendar</div>
3854 <p>The following examples show a selection of dates and times and
3855 the way they might be formatted. These examples assume the use of
3856 the Gregorian calendar as the default calendar.</p>
3857@@ -20328,7 +20756,7 @@
3858 </div>
3859 <div class="exampleOuter">
3860 <div class="exampleHeader">
3861- <a name="d5e26000" id="d5e26000"/>Example: Non-Gregorian calendars</div>
3862+ <a name="d5e26798" id="d5e26798"/>Example: Non-Gregorian calendars</div>
3863 <p>The following examples use calendars other than the Gregorian
3864 calendar.</p>
3865 <p>These examples use non-Latin characters which might not display
3866@@ -20495,10 +20923,10 @@
3867 </dd>
3868 <dt class="label">Error Conditions</dt>
3869 <dd>
3870- <p>An error is raised [<a href="#ERRFOCA0002" title="err:FOCA0002">err:FOCA0002</a>] if <code>$qname</code> does not
3871-have the correct lexical form for an instance of
3872+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFOCA0002" title="err:FOCA0002">err:FOCA0002</a>] if <code>$qname</code> does
3873+not have the correct lexical form for an instance of
3874 <code>xs:QName</code>.</p>
3875- <p>An error is raised [<a href="#ERRFONS0004" title="err:FONS0004">err:FONS0004</a>] if <code>$qname</code> has a
3876+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFONS0004" title="err:FONS0004">err:FONS0004</a>] if <code>$qname</code> has a
3877 prefix and there is no namespace binding for <code>$element</code>
3878 that matches this prefix.</p>
3879 </dd>
3880@@ -20578,15 +21006,16 @@
3881 </dd>
3882 <dt class="label">Error Conditions</dt>
3883 <dd>
3884- <p>An error is raised [<a href="#ERRFOCA0002" title="err:FOCA0002">err:FOCA0002</a>] if <code>$paramQName</code> does
3885-not have the correct lexical form for an instance of
3886+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFOCA0002" title="err:FOCA0002">err:FOCA0002</a>] if <code>$paramQName</code>
3887+does not have the correct lexical form for an instance of
3888 <code>xs:QName</code>.</p>
3889- <p>An error is raised [<a href="#ERRFOCA0002" title="err:FOCA0002">err:FOCA0002</a>] if <code>$paramURI</code> is the
3890-zero-length string or the empty sequence, and the value of
3891+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFOCA0002" title="err:FOCA0002">err:FOCA0002</a>] if <code>$paramURI</code> is
3892+the zero-length string or the empty sequence, and the value of
3893 <code>$paramQName</code> contains a colon (<code>:</code>).</p>
3894- <p>An error <strong>may</strong> be raised [<a href="#ERRFOCA0002" title="err:FOCA0002">err:FOCA0002</a>] if <code>$paramURI</code> is
3895-not a valid URI (XML Namespaces 1.0) or IRI (XML Namespaces
3896-1.1).</p>
3897+ <p>A <span>dynamic</span> error <strong>may</strong> be raised
3898+[<a href="#ERRFOCA0002" title="err:FOCA0002">err:FOCA0002</a>] if
3899+<code>$paramURI</code> is not a valid URI (XML Namespaces 1.0) or
3900+IRI (XML Namespaces 1.1).</p>
3901 </dd>
3902 <dt class="label">Notes</dt>
3903 <dt class="label">Examples</dt>
3904@@ -21497,16 +21926,25 @@
3905 <dt class="label">Error Conditions</dt>
3906 <dd>
3907 <p>The following errors may be raised when <code>$arg</code> is
3908-omitted: if the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
3909- <sup>
3910- <small>DM30</small>
3911- </sup>
3912-[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
3913- <small>XP</small>
3914- </sup>; if
3915-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
3916- <small>XP</small>
3917- </sup>.</p>
3918+omitted:</p>
3919+ <ul>
3920+ <li>
3921+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
3922+ <sup>
3923+ <small>DM30</small>
3924+ </sup>,
3925+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
3926+ <small>XP30</small>
3927+ </sup>
3928+ </p>
3929+ </li>
3930+ <li>
3931+ <p>If the context item is not a node, <span>type error</span>
3932+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
3933+ <small>XP30</small>
3934+ </sup>.</p>
3935+ </li>
3936+ </ul>
3937 </dd>
3938 </dl>
3939 </div>
3940@@ -21584,12 +22022,25 @@
3941 <dt class="label">Error Conditions</dt>
3942 <dd>
3943 <p>The following errors may be raised when <code>$arg</code> is
3944-omitted: if the context item is absent [<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
3945- <small>XP</small>
3946- </sup>; if
3947-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
3948- <small>XP</small>
3949- </sup>.</p>
3950+omitted:</p>
3951+ <ul>
3952+ <li>
3953+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
3954+ <sup>
3955+ <small>DM30</small>
3956+ </sup>,
3957+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
3958+ <small>XP30</small>
3959+ </sup>
3960+ </p>
3961+ </li>
3962+ <li>
3963+ <p>If the context item is not a node, <span>type error</span>
3964+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
3965+ <small>XP30</small>
3966+ </sup>.</p>
3967+ </li>
3968+ </ul>
3969 </dd>
3970 </dl>
3971 </div>
3972@@ -21669,12 +22120,25 @@
3973 <dt class="label">Error Conditions</dt>
3974 <dd>
3975 <p>The following errors may be raised when <code>$arg</code> is
3976-omitted: if the context item is absent [<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
3977- <small>XP</small>
3978- </sup>; if
3979-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
3980- <small>XP</small>
3981- </sup>.</p>
3982+omitted:</p>
3983+ <ul>
3984+ <li>
3985+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
3986+ <sup>
3987+ <small>DM30</small>
3988+ </sup>,
3989+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
3990+ <small>XP30</small>
3991+ </sup>
3992+ </p>
3993+ </li>
3994+ <li>
3995+ <p>If the context item is not a node, <span>type error</span>
3996+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
3997+ <small>XP30</small>
3998+ </sup>.</p>
3999+ </li>
4000+ </ul>
4001 </dd>
4002 </dl>
4003 </div>
4004@@ -21774,13 +22238,26 @@
4005 </dd>
4006 <dt class="label">Error Conditions</dt>
4007 <dd>
4008- <p>When <code>$arg</code> is omitted the following errors may be
4009-raised: if the context item is absent [<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4010- <small>XP</small>
4011- </sup>; if
4012-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4013- <small>XP</small>
4014- </sup>.</p>
4015+ <p>The following errors may be raised when <code>$arg</code> is
4016+omitted:</p>
4017+ <ul>
4018+ <li>
4019+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4020+ <sup>
4021+ <small>DM30</small>
4022+ </sup>,
4023+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4024+ <small>XP30</small>
4025+ </sup>
4026+ </p>
4027+ </li>
4028+ <li>
4029+ <p>If the context item is not a node, <span>type error</span>
4030+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4031+ <small>XP30</small>
4032+ </sup>.</p>
4033+ </li>
4034+ </ul>
4035 </dd>
4036 <dt class="label">Examples</dt>
4037 <dd>
4038@@ -22019,13 +22496,26 @@
4039 </dd>
4040 <dt class="label">Error Conditions</dt>
4041 <dd>
4042- <p>When <code>$arg</code> is omitted the following errors may be
4043-raised : if the context item is absent [<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4044- <small>XP</small>
4045- </sup>; if
4046-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4047- <small>XP</small>
4048- </sup>.</p>
4049+ <p>The following errors may be raised when <code>$arg</code> is
4050+omitted:</p>
4051+ <ul>
4052+ <li>
4053+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4054+ <sup>
4055+ <small>DM30</small>
4056+ </sup>,
4057+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4058+ <small>XP30</small>
4059+ </sup>
4060+ </p>
4061+ </li>
4062+ <li>
4063+ <p>If the context item is not a node, <span>type error</span>
4064+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4065+ <small>XP30</small>
4066+ </sup>.</p>
4067+ </li>
4068+ </ul>
4069 </dd>
4070 <dt class="label">Examples</dt>
4071 <dd>
4072@@ -22141,75 +22631,100 @@
4073 the string <code>"/"</code>.</p>
4074 <p>Otherwise, the function constructs a string that consists of a
4075 sequence of steps, one for each ancestor-or-self of
4076-<code>$arg</code> other than the document node. Each step consists
4077-of the character <code>"/"</code> followed by a string whose form
4078+<code>$arg</code> other than the <span>root</span> node. <span>This
4079+string is prefixed by
4080+<code>"Q{http://www.w3.org/2005/xpath-functions}root()"</code> if
4081+the root node is not a document node.</span> Each step consists of
4082+the character <code>"/"</code> followed by a string whose form
4083 depends on the kind of node selected by that step, as follows:</p>
4084 <ol class="enumar">
4085 <li>
4086- <p>For an element node, <code>"{uri}":{local}[{position}]</code>,
4087-where <code>{uri}</code> is the namespace URI of the node name or
4088-the empty string if the node is in no namespace,
4089-<code>{local}</code> is the local part of the node name, and
4090-<code>{position}</code> is an integer representing the position of
4091-the selected node among its like-named siblings.</p>
4092+ <p>For an element node,
4093+<code>Q{<em>uri</em>}<em>local</em>[<em>position</em>]</code>,
4094+where <code>
4095+ <em>uri</em>
4096+ </code> is the namespace URI of the node
4097+name or the empty string if the node is in no namespace,
4098+<code>
4099+ <em>local</em>
4100+ </code> is the local part of the node name, and
4101+<code>
4102+ <em>position</em>
4103+ </code> is an integer representing the
4104+position of the selected node among its like-named siblings.</p>
4105 </li>
4106 <li>
4107 <p>For an attribute node:</p>
4108 <ol class="enumla">
4109 <li>
4110- <p>if the node is in no namespace, <code>@{local}</code>, where
4111-<code>{local}</code> is the local part of the node name</p>
4112+ <p>if the node is in no namespace, <code>@<em>local</em>
4113+ </code>,
4114+where <code>
4115+ <em>local</em>
4116+ </code> is the local part of the node
4117+name</p>
4118 </li>
4119 <li>
4120- <p>otherwise, <code>@"{uri}":{local}</code>, where
4121-<code>{uri}</code> is the namespace URI of the node name, and
4122-<code>{local}</code> is the local part of the node name</p>
4123+ <p>otherwise, <code>@Q{<em>uri</em>}<em>local</em>
4124+ </code>, where
4125+<code>
4126+ <em>uri</em>
4127+ </code> is the namespace URI of the node name,
4128+and <code>
4129+ <em>local</em>
4130+ </code> is the local part of the node
4131+name</p>
4132 </li>
4133 </ol>
4134 </li>
4135 <li>
4136- <p>For a text node: <code>text()[{position}]</code> where
4137-<code>{position}</code> is an integer representing the position of
4138-the selected node among its text node siblings</p>
4139+ <p>For a text node: <code>text()[<em>position</em>]</code> where
4140+<code>
4141+ <em>position</em>
4142+ </code> is an integer representing the
4143+position of the selected node among its text node siblings</p>
4144 </li>
4145 <li>
4146- <p>For a comment node: <code>comment()[{position}]</code> where
4147-<code>{position}</code> is an integer representing the position of
4148-the selected node among its comment node siblings</p>
4149+ <p>For a comment node: <code>comment()[<em>position</em>]</code>
4150+where <code>
4151+ <em>position</em>
4152+ </code> is an integer representing the
4153+position of the selected node among its comment node siblings</p>
4154 </li>
4155 <li>
4156 <p>For a processing-instruction node:
4157-<code>processing-instruction({local})[{position}]</code> where
4158-<code>{local}</code> is the name of the processing instruction node
4159-and <code>{position}</code> is an integer representing the position
4160-of the selected node among its like-named processing-instruction
4161-node siblings</p>
4162+<code>processing-instruction(<em>local</em>)[<em>position</em>]</code>
4163+where <code>
4164+ <em>local</em>
4165+ </code> is the name of the processing
4166+instruction node and <code>
4167+ <em>position</em>
4168+ </code> is an integer
4169+representing the position of the selected node among its like-named
4170+processing-instruction node siblings</p>
4171 </li>
4172 <li>
4173 <p>For a namespace node:</p>
4174 <ol class="enumla">
4175 <li>
4176 <p>If the namespace node has a name:
4177-<code>namespace::{prefix}</code>, where <code>{prefix}</code> is
4178-the local part of the name of the namespace node (which represents
4179-the namespace prefix).</p>
4180+<code>namespace::<em>prefix</em>
4181+ </code>, where
4182+<code>
4183+ <em>prefix</em>
4184+ </code> is the local part of the name of the
4185+namespace node (which represents the namespace prefix).</p>
4186 </li>
4187 <li>
4188 <p>If the namespace node has no name (that is, it represents the
4189 default namespace):
4190-<code>namespace::*["http://www.w3.org/2005/xpath-functions":local-name()=""]</code>
4191+<code>namespace::*[Q{http://www.w3.org/2005/xpath-functions}local-name()=""]</code>
4192 </p>
4193 </li>
4194 </ol>
4195 </li>
4196 </ol>
4197 </dd>
4198- <dt class="label">Error Conditions</dt>
4199- <dd>
4200- <p>An error is raised [<a href="#ERRFODC0001" title="err:FODC0001">err:FODC0001</a>] if <code>$arg</code>, or the
4201-context item if the second argument is absent, is a node in a tree
4202-whose root is not a document node.</p>
4203- </dd>
4204 <dt class="label">Examples</dt>
4205 <dd>
4206 <p>let <code>$e</code> :=</p>
4207@@ -22227,17 +22742,34 @@
4208 <p>The expression <code>fn:path($e)</code> returns
4209 <code>'/'</code>.</p>
4210 <p>The expression <code>fn:path($e/*:p)</code> returns
4211-<code>'/"http://example.com/one":p[1]'</code>.</p>
4212+<code>'/Q{http://example.com/one}p[1]'</code>.</p>
4213 <p>The expression <code>fn:path($e/*:p/@xml:lang)</code> returns
4214-<code>'/"http://example.com/one":p[1]/@"http://www.w3.org/XML/1998/namespace":lang'</code>.</p>
4215+<code>'/Q{http://example.com/one}p[1]/@Q{http://www.w3.org/XML/1998/namespace}lang'</code>.</p>
4216 <p>The expression <code>fn:path($e/*:p/@author)</code> returns
4217-<code>'/"http://example.com/one":p[1]/@author'</code>.</p>
4218+<code>'/Q{http://example.com/one}p[1]/@author'</code>.</p>
4219 <p>The expression <code>fn:path($e/*:p/*:br[2])</code> returns
4220-<code>'/"http://example.com/one":p[1]/"http://example.com/one":br[2]'</code>.</p>
4221+<code>'/Q{http://example.com/one}p[1]/Q{http://example.com/one}br[2]'</code>.</p>
4222 <p>The expression
4223 <code>fn:path($e//text()[starts-with(normalize-space(),
4224 'Tochter')])</code> returns
4225-<code>'/"http://example.com/one":p[1]/text()[2]'</code>.</p>
4226+<code>'/Q{http://example.com/one}p[1]/text()[2]'</code>.</p>
4227+ <p>let <code>$emp</code> :=</p>
4228+ <div class="exampleInner">
4229+ <pre>
4230+ &lt;employee xml:id="ID21256"&gt;
4231+ &lt;empnr&gt;E21256&lt;/empnr&gt;
4232+ &lt;first&gt;John&lt;/first&gt;
4233+ &lt;last&gt;Brown&lt;/last&gt;
4234+ &lt;/employee&gt;
4235+
4236+</pre>
4237+ </div>
4238+ <p>The expression <code>fn:path($emp)</code> returns
4239+<code>'Q{http://www.w3.org/2005/xpath-functions}root()'</code>.</p>
4240+ <p>The expression <code>fn:path($emp/@xml:id)</code> returns
4241+<code>'Q{http://www.w3.org/2005/xpath-functions}root()/@Q{http://www.w3.org/XML/1998/namespace}id'</code>.</p>
4242+ <p>The expression <code>fn:path($emp/empnr)</code> returns
4243+<code>'Q{http://www.w3.org/2005/xpath-functions}root()/Q{}empnr[1]'</code>.</p>
4244 </dd>
4245 </dl>
4246 </div>
4247@@ -22294,25 +22826,36 @@
4248 (<code>.</code>). The behavior of the function if the argument is
4249 omitted is exactly the same as if the context item had been passed
4250 as the argument.</p>
4251- <p>The result of the function call
4252-<code>fn:has-children($node)</code> is defined to be the same as
4253-the result of the expression <a href="#func-exists">
4254+ <p>
4255+ <span>Provided that the supplied argument <code>$node</code>
4256+matches the expected type <code>node()?</code>,</span> the result
4257+of the function call <code>fn:has-children($node)</code> is defined
4258+to be the same as the result of the expression <a href="#func-exists">
4259 <code>fn:exists($node/child::node())</code>
4260 </a>.</p>
4261 </dd>
4262 <dt class="label">Error Conditions</dt>
4263 <dd>
4264 <p>The following errors may be raised when <code>$node</code> is
4265-omitted: if the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4266- <sup>
4267- <small>DM30</small>
4268- </sup>
4269-[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4270- <small>XP</small>
4271- </sup>; if
4272-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4273- <small>XP</small>
4274- </sup>.</p>
4275+omitted:</p>
4276+ <ul>
4277+ <li>
4278+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4279+ <sup>
4280+ <small>DM30</small>
4281+ </sup>,
4282+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4283+ <small>XP30</small>
4284+ </sup>
4285+ </p>
4286+ </li>
4287+ <li>
4288+ <p>If the context item is not a node, <span>type error</span>
4289+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4290+ <small>XP30</small>
4291+ </sup>.</p>
4292+ </li>
4293+ </ul>
4294 </dd>
4295 <dt class="label">Notes</dt>
4296 <dd>
4297@@ -22432,7 +22975,7 @@
4298 <p>The effect of the function call
4299 <code>fn:outermost($nodes)</code> is defined to be equivalent to
4300 the result of the expression <code>$nodes[not(ancestor::node()
4301-intersect $nodes)]</code>.</p>
4302+intersect $nodes)]/.</code>.</p>
4303 <p>That is, the function takes as input a sequence of nodes, and
4304 returns every node within the sequence that <span>does not have
4305 another node within the sequence as an ancestor</span>; the nodes
4306@@ -22445,7 +22988,7 @@
4307 does not correctly account for attribute nodes, as these are not
4308 descendants of their parent element.</p>
4309 <p>The motivation for the function was based on XSLT streaming use
4310-cases; there are cases where the <a href="#xslt-30">[XSL
4311+cases. There are cases where the <a href="#xslt-30">[XSL
4312 Transformations (XSLT) Version 3.0]</a> streaming rules allow the
4313 construct <code>outermost(//section)</code> but do not allow
4314 <code>//section</code>; the function can therefore be useful in
4315@@ -23340,16 +23883,27 @@
4316 </dd>
4317 <dt class="label">Properties</dt>
4318 <dd>
4319- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
4320- <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4321- </a>,
4322-<a title="context-dependent" class="termref" href="#dt-context-dependent">
4323- <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4324- </a>,
4325-and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4326- <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4327- </a>.
4328-It depends on collations.</p>
4329+ <p>The one-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
4330+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4331+ </a>,
4332+<a title="context-dependent" class="termref" href="#dt-context-dependent">
4333+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4334+ </a>,
4335+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4336+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4337+ </a>.
4338+It depends on collations, and implicit timezone.</p>
4339+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
4340+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4341+ </a>,
4342+<a title="context-dependent" class="termref" href="#dt-context-dependent">
4343+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4344+ </a>,
4345+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4346+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4347+ </a>.
4348+It depends on collations, and static base uri, and implicit
4349+timezone.</p>
4350 </dd>
4351 <dt class="label">Rules</dt>
4352 <dd>
4353@@ -23508,16 +24062,27 @@
4354 </dd>
4355 <dt class="label">Properties</dt>
4356 <dd>
4357- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
4358- <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4359- </a>,
4360-<a title="context-dependent" class="termref" href="#dt-context-dependent">
4361- <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4362- </a>,
4363-and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4364- <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4365- </a>.
4366-It depends on collations.</p>
4367+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
4368+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4369+ </a>,
4370+<a title="context-dependent" class="termref" href="#dt-context-dependent">
4371+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4372+ </a>,
4373+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4374+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4375+ </a>.
4376+It depends on collations, and implicit timezone.</p>
4377+ <p>The three-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
4378+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4379+ </a>,
4380+<a title="context-dependent" class="termref" href="#dt-context-dependent">
4381+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4382+ </a>,
4383+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4384+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4385+ </a>.
4386+It depends on collations, and static base uri, and implicit
4387+timezone.</p>
4388 </dd>
4389 <dt class="label">Rules</dt>
4390 <dd>
4391@@ -23635,16 +24200,27 @@
4392 </dd>
4393 <dt class="label">Properties</dt>
4394 <dd>
4395- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
4396- <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4397- </a>,
4398-<a title="context-dependent" class="termref" href="#dt-context-dependent">
4399- <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4400- </a>,
4401-and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4402- <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4403- </a>.
4404-It depends on collations.</p>
4405+ <p>The two-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
4406+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4407+ </a>,
4408+<a title="context-dependent" class="termref" href="#dt-context-dependent">
4409+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4410+ </a>,
4411+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4412+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4413+ </a>.
4414+It depends on collations, and implicit timezone.</p>
4415+ <p>The three-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
4416+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4417+ </a>,
4418+<a title="context-dependent" class="termref" href="#dt-context-dependent">
4419+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4420+ </a>,
4421+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4422+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4423+ </a>.
4424+It depends on collations, and static base uri, and implicit
4425+timezone.</p>
4426 </dd>
4427 <dt class="label">Rules</dt>
4428 <dd>
4429@@ -23695,8 +24271,21 @@
4430 eq node-name($i2))</code>.</p>
4431 </li>
4432 <li>
4433- <p>The two nodes are both annotated as having simple content or
4434-both nodes are annotated as having complex content.</p>
4435+ <p>Either both nodes are both annotated as having simple content or
4436+both nodes are annotated as having complex content. For this
4437+purpose "simple content" means either a simple type or a complex
4438+type with simple content; "complex content" means a complex type
4439+whose variety is mixed, element-only, or empty.</p>
4440+ <div class="note">
4441+ <p class="prefix">
4442+ <b>Note:</b>
4443+ </p>
4444+ <p>It is a consequence of this rule that validating a document
4445+<var>D</var> against a schema will usually (but not necessarily)
4446+result in a document that is not deep-equal to <var>D</var>. The
4447+exception is when the schema allows all elements to have mixed
4448+content.</p>
4449+ </div>
4450 </li>
4451 <li>
4452 <p>The two nodes have the same number of attributes, and for every
4453@@ -23708,25 +24297,27 @@
4454 <p>One of the following conditions holds:</p>
4455 <ul>
4456 <li>
4457- <p>Both element nodes have a type annotation that is simple
4458-content, and the typed value of <code>$i1</code> is deep-equal to
4459-the typed value of <code>$i2</code>.</p>
4460- </li>
4461- <li>
4462- <p>Both element nodes have a type annotation that is complex
4463-content with elementOnly content, and each child element of
4464-<code>$i1</code> is deep-equal to the corresponding child element
4465-of <code>$i2</code>.</p>
4466- </li>
4467- <li>
4468- <p>Both element nodes have a type annotation that is complex
4469-content with mixed content, and the sequence
4470+ <p>Both element nodes are annotated as having simple content
4471+<span>(as defined in 3(b) above)</span>, and the typed value of
4472+<code>$i1</code> is deep-equal to the typed value of
4473+<code>$i2</code>.</p>
4474+ </li>
4475+ <li>
4476+ <p>Both element nodes have a type annotation that is <span>a
4477+complex type with variety element-only, and the sequence
4478+<code>$i1/*</code> is deep-equal to the sequence
4479+<code>$i2/*</code>.</span>
4480+ </p>
4481+ </li>
4482+ <li>
4483+ <p>Both element nodes have a type annotation that is <span>a
4484+complex type with variety mixed</span>, and the sequence
4485 <code>$i1/(*|text())</code> is deep-equal to the sequence
4486 <code>$i2/(*|text())</code>.</p>
4487 </li>
4488 <li>
4489- <p>Both element nodes have a type annotation that is complex
4490-content with empty content.</p>
4491+ <p>Both element nodes have a type annotation that is <span>a
4492+complex type with variety empty</span>.</p>
4493 </li>
4494 </ul>
4495 </li>
4496@@ -23787,8 +24378,8 @@
4497 </dd>
4498 <dt class="label">Error Conditions</dt>
4499 <dd>
4500- <p>An error is raised [<a href="#ERRFOTY0015" title="err:FOTY0015">err:FOTY0015</a>] if either input sequence contains
4501-a function item.</p>
4502+ <p>A <span>type</span> error is raised [<a href="#ERRFOTY0015" title="err:FOTY0015">err:FOTY0015</a>] if either input sequence
4503+contains a function item.</p>
4504 </dd>
4505 <dt class="label">Notes</dt>
4506 <dd>
4507@@ -23950,8 +24541,8 @@
4508 </dd>
4509 <dt class="label">Error Conditions</dt>
4510 <dd>
4511- <p>An error is raised [<a href="#ERRFORG0003" title="err:FORG0003">err:FORG0003</a>] if <code>$arg</code> contains more
4512-than one item.</p>
4513+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORG0003" title="err:FORG0003">err:FORG0003</a>] if <code>$arg</code>
4514+contains more than one item.</p>
4515 </dd>
4516 </dl>
4517 </div>
4518@@ -23994,8 +24585,8 @@
4519 </dd>
4520 <dt class="label">Error Conditions</dt>
4521 <dd>
4522- <p>An error is raised [<a href="#ERRFORG0004" title="err:FORG0004">err:FORG0004</a>] if <code>$arg</code> is an empty
4523-sequence.</p>
4524+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORG0004" title="err:FORG0004">err:FORG0004</a>] if <code>$arg</code> is an
4525+empty sequence.</p>
4526 </dd>
4527 </dl>
4528 </div>
4529@@ -24038,8 +24629,8 @@
4530 </dd>
4531 <dt class="label">Error Conditions</dt>
4532 <dd>
4533- <p>An error is raised [<a href="#ERRFORG0005" title="err:FORG0005">err:FORG0005</a>] if <code>$arg</code> is an empty
4534-sequence or a sequence containing more than one item.</p>
4535+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFORG0005" title="err:FORG0005">err:FORG0005</a>] if <code>$arg</code> is an
4536+empty sequence or a sequence containing more than one item.</p>
4537 </dd>
4538 </dl>
4539 </div>
4540@@ -24546,16 +25137,27 @@
4541 </dd>
4542 <dt class="label">Properties</dt>
4543 <dd>
4544- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
4545- <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4546- </a>,
4547-<a title="context-dependent" class="termref" href="#dt-context-dependent">
4548- <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4549- </a>,
4550-and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4551- <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4552- </a>.
4553-It depends on collations.</p>
4554+ <p>The zero-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
4555+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4556+ </a>,
4557+<a title="context-dependent" class="termref" href="#dt-context-dependent">
4558+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4559+ </a>,
4560+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4561+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4562+ </a>.
4563+It depends on collations, and implicit timezone.</p>
4564+ <p>The one-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
4565+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4566+ </a>,
4567+<a title="context-dependent" class="termref" href="#dt-context-dependent">
4568+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4569+ </a>,
4570+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4571+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4572+ </a>.
4573+It depends on collations, and static base uri, and implicit
4574+timezone.</p>
4575 </dd>
4576 <dt class="label">Rules</dt>
4577 <dd>
4578@@ -24696,16 +25298,27 @@
4579 </dd>
4580 <dt class="label">Properties</dt>
4581 <dd>
4582- <p>This function is <a title="deterministic" class="termref" href="#dt-deterministic">
4583- <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4584- </a>,
4585-<a title="context-dependent" class="termref" href="#dt-context-dependent">
4586- <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4587- </a>,
4588-and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4589- <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4590- </a>.
4591-It depends on collations.</p>
4592+ <p>The zero-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
4593+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4594+ </a>,
4595+<a title="context-dependent" class="termref" href="#dt-context-dependent">
4596+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4597+ </a>,
4598+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4599+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4600+ </a>.
4601+It depends on collations, and implicit timezone.</p>
4602+ <p>The one-argument form of this function is <a title="deterministic" class="termref" href="#dt-deterministic">
4603+ <span class="arrow">·</span>deterministic<span class="arrow">·</span>
4604+ </a>,
4605+<a title="context-dependent" class="termref" href="#dt-context-dependent">
4606+ <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
4607+ </a>,
4608+and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4609+ <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4610+ </a>.
4611+It depends on collations, and static base uri, and implicit
4612+timezone.</p>
4613 </dd>
4614 <dt class="label">Rules</dt>
4615 <dd>
4616@@ -24961,7 +25574,8 @@
4617 <p>The expression <code>fn:sum((1 to 100)[. lt 0], 0)</code>
4618 returns <code>0</code>.</p>
4619 <p>
4620- <code>fn:sum(($d1, 9E1))</code> raises an error [<a href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</a>].</p>
4621+ <code>fn:sum(($d1, 9E1))</code> raises a <span>type</span> error
4622+[<a href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</a>].</p>
4623 <p>The expression <code>fn:sum(($d1, $d2), "ein Augenblick")</code>
4624 returns <code>xs:yearMonthDuration("P20Y10M")</code>. <em>(There is
4625 no requirement that the <code>$zero</code> value should be the same
4626@@ -25174,20 +25788,29 @@
4627 </dd>
4628 <dt class="label">Error Conditions</dt>
4629 <dd>
4630- <p>An error is raised [<a href="#ERRFODC0001" title="err:FODC0001">err:FODC0001</a>] if <code>$node</code>, or the
4631-context item if the second argument is absent, is a node in a tree
4632-whose root is not a document node.</p>
4633- <p>If the second argument is the context item, or is omitted, the
4634-following errors may be raised: if the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4635- <sup>
4636- <small>DM30</small>
4637- </sup>,
4638-[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4639- <small>XP</small>
4640- </sup>; if
4641-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4642- <small>XP</small>
4643- </sup>.</p>
4644+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODC0001" title="err:FODC0001">err:FODC0001</a>] if <code>$node</code>, or
4645+the context item if the second argument is absent, is a node in a
4646+tree whose root is not a document node.</p>
4647+ <p>The following errors may be raised when <code>$node</code> is
4648+omitted:</p>
4649+ <ul>
4650+ <li>
4651+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4652+ <sup>
4653+ <small>DM30</small>
4654+ </sup>,
4655+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4656+ <small>XP30</small>
4657+ </sup>
4658+ </p>
4659+ </li>
4660+ <li>
4661+ <p>If the context item is not a node, <span>type error</span>
4662+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4663+ <small>XP30</small>
4664+ </sup>.</p>
4665+ </li>
4666+ </ul>
4667 </dd>
4668 <dt class="label">Notes</dt>
4669 <dd>
4670@@ -25403,20 +26026,29 @@
4671 </dd>
4672 <dt class="label">Error Conditions</dt>
4673 <dd>
4674- <p>An error is raised [<a href="#ERRFODC0001" title="err:FODC0001">err:FODC0001</a>] if <code>$node</code>, or the
4675-context item if the second argument is omitted, is a node in a tree
4676-whose root is not a document node.</p>
4677- <p>If the second argument is the context item, or is omitted, the
4678-following errors may be raised: if the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4679- <sup>
4680- <small>DM30</small>
4681- </sup>,
4682-[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4683- <small>XP</small>
4684- </sup>; if
4685-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4686- <small>XP</small>
4687- </sup>.</p>
4688+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODC0001" title="err:FODC0001">err:FODC0001</a>] if <code>$node</code>, or
4689+the context item if the second argument is omitted, is a node in a
4690+tree whose root is not a document node.</p>
4691+ <p>The following errors may be raised when <code>$node</code> is
4692+omitted:</p>
4693+ <ul>
4694+ <li>
4695+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4696+ <sup>
4697+ <small>DM30</small>
4698+ </sup>,
4699+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4700+ <small>XP30</small>
4701+ </sup>
4702+ </p>
4703+ </li>
4704+ <li>
4705+ <p>If the context item is not a node, <span>type error</span>
4706+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4707+ <small>XP30</small>
4708+ </sup>.</p>
4709+ </li>
4710+ </ul>
4711 </dd>
4712 <dt class="label">Notes</dt>
4713 <dd>
4714@@ -25606,20 +26238,29 @@
4715 </dd>
4716 <dt class="label">Error Conditions</dt>
4717 <dd>
4718- <p>An error is raised [<a href="#ERRFODC0001" title="err:FODC0001">err:FODC0001</a>] if <code>$node</code>, or the
4719-context item if the second argument is omitted, is a node in a tree
4720-whose root is not a document node.</p>
4721- <p>If the second argument is the context item, or is omitted, the
4722-following errors may be raised: if the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4723- <sup>
4724- <small>DM30</small>
4725- </sup>
4726-[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4727- <small>XP</small>
4728- </sup>; if
4729-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4730- <small>XP</small>
4731- </sup>.</p>
4732+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODC0001" title="err:FODC0001">err:FODC0001</a>] if <code>$node</code>, or
4733+the context item if the second argument is omitted, is a node in a
4734+tree whose root is not a document node.</p>
4735+ <p>The following errors may be raised when <code>$node</code> is
4736+omitted:</p>
4737+ <ul>
4738+ <li>
4739+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4740+ <sup>
4741+ <small>DM30</small>
4742+ </sup>,
4743+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4744+ <small>XP30</small>
4745+ </sup>
4746+ </p>
4747+ </li>
4748+ <li>
4749+ <p>If the context item is not a node, <span>type error</span>
4750+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4751+ <small>XP30</small>
4752+ </sup>.</p>
4753+ </li>
4754+ </ul>
4755 </dd>
4756 <dt class="label">Notes</dt>
4757 <dd>
4758@@ -25727,16 +26368,25 @@
4759 <dt class="label">Error Conditions</dt>
4760 <dd>
4761 <p>The following errors may be raised when <code>$arg</code> is
4762-omitted: if the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4763- <sup>
4764- <small>DM30</small>
4765- </sup>
4766-[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4767- <small>XP</small>
4768- </sup>; if
4769-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4770- <small>XP</small>
4771- </sup>.</p>
4772+omitted:</p>
4773+ <ul>
4774+ <li>
4775+ <p>If the context item is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4776+ <sup>
4777+ <small>DM30</small>
4778+ </sup>,
4779+<span>dynamic error</span> [<a href="http://www.w3.org/TR/xpath-30/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
4780+ <small>XP30</small>
4781+ </sup>
4782+ </p>
4783+ </li>
4784+ <li>
4785+ <p>If the context item is not a node, <span>type error</span>
4786+[<a href="http://www.w3.org/TR/xpath-30/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
4787+ <small>XP30</small>
4788+ </sup>.</p>
4789+ </li>
4790+ </ul>
4791 </dd>
4792 <dt class="label">Notes</dt>
4793 <dd>
4794@@ -25807,15 +26457,15 @@
4795 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4796 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4797 </a>.
4798-It depends on available-documents.</p>
4799+It depends on available documents, and static base uri.</p>
4800 </dd>
4801 <dt class="label">Rules</dt>
4802 <dd>
4803 <p>If <code>$uri</code> is the empty sequence, the result is an
4804 empty sequence.</p>
4805 <p>If <code>$uri</code> is a relative URI reference, it is resolved
4806-relative to the value of the <span>Dynamic Base URI property from
4807-the dynamic context</span>. The resulting absolute URI is promoted
4808+relative to the value of the <span>Static Base URI property from
4809+the static context</span>. The resulting absolute URI is promoted
4810 to an <code>xs:string</code>.</p>
4811 <p>If the <b>Available documents</b> described in <a href="http://www.w3.org/TR/xpath-30/#eval_context">Section 2.1.2 Dynamic
4812 Context</a>
4813@@ -25842,7 +26492,7 @@
4814 determinism. The manner in which any such option is provided is
4815 implementation-defined. If the user has not selected such an
4816 option, a call of the function must either return a deterministic
4817-result or must raise an error [<a href="#ERRFODC0003" title="err:FODC0003">err:FODC0003</a>].</p>
4818+result or must raise a <span>dynamic</span> error [<a href="#ERRFODC0003" title="err:FODC0003">err:FODC0003</a>].</p>
4819 <div class="note">
4820 <p class="prefix">
4821 <b>Note:</b>
4822@@ -25875,14 +26525,15 @@
4823 </a>.</p>
4824 <p>One possible processing model for this function is as follows.
4825 The resource identified by the URI Reference is retrieved. If the
4826-resource cannot be retrieved, an error is raised [<a href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</a>]. The data
4827-resulting from the retrieval action is then parsed as an XML
4828-document and a tree is constructed in accordance with the <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>.
4829+resource cannot be retrieved, a <span>dynamic</span> error is
4830+raised [<a href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</a>]. The data resulting from the
4831+retrieval action is then parsed as an XML document and a tree is
4832+constructed in accordance with the <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>.
4833 If the top-level media type is known and is "text", the content is
4834 parsed in the same way as if the media type were text/xml;
4835 otherwise, it is parsed in the same way as if the media type were
4836-application/xml. If the contents cannot be parsed successfully, an
4837-error is raised [<a href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</a>]. Otherwise, the result of the
4838+application/xml. If the contents cannot be parsed successfully, a
4839+<span>dynamic</span> error is raised [<a href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</a>]. Otherwise, the result of the
4840 function is the document node at the root of the resulting tree.
4841 This tree is then optionally validated against a schema.</p>
4842 <p>Various aspects of this processing are <a title="implementation-defined" class="termref" href="#implementation-defined">
4843@@ -25924,16 +26575,17 @@
4844 </dd>
4845 <dt class="label">Error Conditions</dt>
4846 <dd>
4847- <p>An error <strong>may</strong> be raised [<a href="#ERRFODC0005" title="err:FODC0005">err:FODC0005</a>] if <code>$uri</code> is not
4848-a valid URI.</p>
4849- <p>An error is raised [<a href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</a>] if the <b>available documents</b>
4850-provides no mapping for the absolutized URI.</p>
4851- <p>An error is raised [<a href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</a>] if the resource cannot be
4852+ <p>A <span>dynamic</span> error <strong>may</strong> be raised
4853+[<a href="#ERRFODC0005" title="err:FODC0005">err:FODC0005</a>] if
4854+<code>$uri</code> is not a valid URI.</p>
4855+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</a>] if the <b>available
4856+documents</b> provides no mapping for the absolutized URI.</p>
4857+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</a>] if the resource cannot be
4858 retrieved or cannot be parsed successfully as XML.</p>
4859- <p>An error is raised [<a href="#ERRFODC0003" title="err:FODC0003">err:FODC0003</a>] if the implementation is not able
4860-to guarantee that the result of the function will be deterministic,
4861-and the user has not indicated that an unstable result is
4862-acceptable.</p>
4863+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODC0003" title="err:FODC0003">err:FODC0003</a>] if the implementation is not
4864+able to guarantee that the result of the function will be
4865+deterministic, and the user has not indicated that an unstable
4866+result is acceptable.</p>
4867 </dd>
4868 </dl>
4869 </div>
4870@@ -25972,7 +26624,7 @@
4871 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4872 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4873 </a>.
4874-It depends on collations.</p>
4875+It depends on available documents, and static base uri.</p>
4876 </dd>
4877 <dt class="label">Rules</dt>
4878 <dd>
4879@@ -25983,8 +26635,8 @@
4880 </a>
4881 would return a document node, this function returns
4882 <code>true</code>.</p>
4883- <p>An error is raised [<a href="#ERRFODC0005" title="err:FODC0005">err:FODC0005</a>] if <code>$uri</code> is not a
4884-valid URI according to the rules applied by the implementation of
4885+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODC0005" title="err:FODC0005">err:FODC0005</a>] if <code>$uri</code> is not
4886+a valid URI according to the rules applied by the implementation of
4887 <a href="#func-doc">
4888 <code>fn:doc</code>
4889 </a>.</p>
4890@@ -26044,25 +26696,25 @@
4891 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4892 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4893 </a>.
4894-It depends on available-collections.</p>
4895+It depends on available node collections, and static base uri.</p>
4896 </dd>
4897 <dt class="label">Rules</dt>
4898 <dd>
4899 <p>This function takes an <code>xs:string</code> as argument and
4900 returns a sequence of nodes obtained by interpreting
4901 <code>$arg</code> as an <code>xs:anyURI</code> and resolving it
4902-according to the mapping specified in <b>Available collections</b>
4903-described in <a href="http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components">
4904+according to the mapping specified in <b>Available node
4905+collections</b> described in <a href="http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components">
4906 Section C.2 Dynamic Context Components</a>
4907 <sup>
4908 <small>XP30</small>
4909 </sup>.</p>
4910- <p>If <b>Available collections</b> provides a mapping from this
4911-string to a sequence of nodes, the function returns that sequence.
4912-If <b>Available collections</b> maps the string to an empty
4913-sequence, then the function returns an empty sequence.</p>
4914+ <p>If <b>Available node collections</b> provides a mapping from
4915+this string to a sequence of nodes, the function returns that
4916+sequence. If <b>Available node collections</b> maps the string to
4917+an empty sequence, then the function returns an empty sequence.</p>
4918 <p>If <code>$arg</code> is not specified, the function returns the
4919-sequence of the nodes in the default collection in the dynamic
4920+sequence of the nodes in the default node collection in the dynamic
4921 context. See <a href="http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components">
4922 Section C.2 Dynamic Context Components</a>
4923 <sup>
4924@@ -26084,34 +26736,34 @@
4925 <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
4926 </a>. If the user has not selected such an option,
4927 a call to this function must either return a deterministic result
4928-or must raise an error [<a href="#ERRFODC0003" title="err:FODC0003">err:FODC0003</a>].</p>
4929+or must raise a <span>dynamic</span> error [<a href="#ERRFODC0003" title="err:FODC0003">err:FODC0003</a>].</p>
4930 <p>There is no requirement that the returned nodes should be in
4931 document order, nor is there a requirement that the result should
4932 contain no duplicates.</p>
4933 </dd>
4934 <dt class="label">Error Conditions</dt>
4935 <dd>
4936- <p>An error is raised [<a href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</a>] if no URI is supplied and the
4937-value of the default collection is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4938+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</a>] if no URI is supplied and
4939+the value of the default collection is <a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a>
4940 <sup>
4941 <small>DM30</small>
4942 </sup>.</p>
4943- <p>An error is raised [<a href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</a>] if <b>available collections</b>
4944-provides no mapping for the absolutized URI.</p>
4945- <p>An error is raised [<a href="#ERRFODC0004" title="err:FODC0004">err:FODC0004</a>] if <code>$arg</code> is not a
4946-valid <code>xs:anyURI</code>.</p>
4947+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</a>] if <b>available node
4948+collections</b> provides no mapping for the absolutized URI.</p>
4949+ <p>A <span>dynamic</span> error is raised [<a href="#ERRFODC0004" title="err:FODC0004">err:FODC0004</a>] if <code>$arg</code> is not
4950+a valid <code>xs:anyURI</code>.</p>
4951 </dd>
4952 <dt class="label">Notes</dt>
4953 <dd>
4954 <p>This function provides a facility for users to work with a
4955-collection of documents which may be contained in a directory or
4956-rows of a Relational table or other implementation-specific
4957-construct. An implementation may also use external variables to
4958-identify external resources, but <code>fn:collection</code>
4959-provides functionality not provided by external variables.
4960-Specifying resources using URIs is useful because URIs are dynamic,
4961-can be parameterized, and do not rely on an external
4962-environment.</p>
4963+collection of documents which may be contained in a directory, or
4964+in the rows of a relational table, or in some other
4965+implementation-specific construct. An implementation may also use
4966+external variables to identify external resources, but
4967+<code>fn:collection</code> provides functionality not provided by
4968+external variables. Specifying resources using URIs is useful
4969+because URIs are dynamic, can be parameterized, and do not rely on
4970+an external environment.</p>
4971 </dd>
4972 </dl>
4973 </div>
4974@@ -26122,7 +26774,7 @@
4975 <dt class="label">Summary</dt>
4976 <dd>
4977 <p>Returns a sequence of <code>xs:anyURI</code> values representing
4978-the document URIs of the documents in a collection.</p>
4979+the URIs in a resource collection.</p>
4980 </dd>
4981 <dt class="label">Signatures</dt>
4982 <dd>
4983@@ -26152,66 +26804,63 @@
4984 and <a title="focus-dependent" class="termref" href="#dt-focus-independent">
4985 <span class="arrow">·</span>focus-independent<span class="arrow">·</span>
4986 </a>.
4987-It depends on available-collections.</p>
4988+It depends on available resource collections, and static base
4989+uri.</p>
4990 </dd>
4991 <dt class="label">Rules</dt>
4992 <dd>
4993- <p>A collection, as returned by the <code>fn:collection</code>
4994-function, is in general a sequence of nodes. Some of these nodes
4995-may be document nodes, and some of these document nodes may have a
4996-non-empty document URI, accessible using the
4997-<code>fn:document-uri</code> function. The
4998-<code>fn:uri-collection</code> function returns a sequence of URIs,
4999-being the document URIs of those nodes in the collection that are
5000-document nodes and that have a document URI (other nodes in the
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches