1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtXmlPatterns module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#include "qanyuri_p.h"
41#include "qatomizer_p.h"
42#include "qbuiltintypes_p.h"
43#include "qcardinalityverifier_p.h"
44#include "qcommonsequencetypes_p.h"
45#include "qcommonvalues_p.h"
46#include "qemptysequence_p.h"
47#include "qcommonnamespaces_p.h"
48#include "qxmlname.h"
49#include "qatomicstring_p.h"
50
51/* Functions */
52#include "qaccessorfns_p.h"
53#include "qaggregatefns_p.h"
54#include "qassemblestringfns_p.h"
55#include "qbooleanfns_p.h"
56#include "qcomparestringfns_p.h"
57#include "qcomparingaggregator_p.h"
58#include "qcontextfns_p.h"
59#include "qdatetimefn_p.h"
60#include "qdatetimefns_p.h"
61#include "qdeepequalfn_p.h"
62#include "qerrorfn_p.h"
63#include "qnodefns_p.h"
64#include "qnumericfns_p.h"
65#include "qpatternmatchingfns_p.h"
66#include "qqnamefns_p.h"
67#include "qresolveurifn_p.h"
68#include "qsequencefns_p.h"
69#include "qsequencegeneratingfns_p.h"
70#include "qstringvaluefns_p.h"
71#include "qsubstringfns_p.h"
72#include "qtimezonefns_p.h"
73#include "qtracefn_p.h"
74
75#include "qxpath20corefunctions_p.h"
76
77QT_BEGIN_NAMESPACE
78
79using namespace QPatternist;
80
81Expression::Ptr XPath20CoreFunctions::retrieveExpression(const QXmlName name,
82 const Expression::List &args,
83 const FunctionSignature::Ptr &sign) const
84{
85 Q_ASSERT(sign);
86
87 Expression::Ptr fn;
88#define testFN(ln, cname) else if(name.localName() == StandardLocalNames::ln) fn = Expression::Ptr(new cname())
89
90 if(false) /* Dummy for the macro handling. Will be optimized away anyway. */
91 return Expression::Ptr();
92 /* Alphabetic order. */
93 testFN(QName, QNameFN);
94 testFN(abs, AbsFN);
95 testFN(adjust_date_to_timezone, AdjustDateToTimezoneFN);
96 testFN(adjust_dateTime_to_timezone, AdjustDateTimeToTimezoneFN);
97 testFN(adjust_time_to_timezone, AdjustTimeToTimezoneFN);
98 testFN(avg, AvgFN);
99 testFN(base_uri, BaseURIFN);
100 testFN(codepoint_equal, CodepointEqualFN);
101 testFN(codepoints_to_string, CodepointsToStringFN);
102 testFN(collection, CollectionFN);
103 testFN(compare, CompareFN);
104 testFN(current_date, CurrentDateFN);
105 testFN(current_dateTime, CurrentDateTimeFN);
106 testFN(current_time, CurrentTimeFN);
107 testFN(dateTime, DateTimeFN);
108 testFN(day_from_date, DayFromAbstractDateTimeFN);
109 testFN(day_from_dateTime, DayFromAbstractDateTimeFN);
110 testFN(days_from_duration, DaysFromDurationFN);
111 testFN(deep_equal, DeepEqualFN);
112 testFN(default_collation, DefaultCollationFN);
113 testFN(distinct_values, DistinctValuesFN);
114 testFN(doc, DocFN);
115 testFN(doc_available, DocAvailableFN);
116 testFN(document_uri, DocumentURIFN);
117 testFN(empty, Existence<Expression::IDEmptyFN>);
118 testFN(encode_for_uri, EncodeForURIFN);
119 testFN(ends_with, EndsWithFN);
120 testFN(error, ErrorFN);
121 testFN(escape_html_uri, EscapeHtmlURIFN);
122 testFN(exists, Existence<Expression::IDExistsFN>);
123 testFN(hours_from_dateTime, HoursFromAbstractDateTimeFN);
124 testFN(hours_from_duration, HoursFromDurationFN);
125 testFN(hours_from_time, HoursFromAbstractDateTimeFN);
126 testFN(idref, IdrefFN);
127 testFN(implicit_timezone, ImplicitTimezoneFN);
128 testFN(in_scope_prefixes, InScopePrefixesFN);
129 testFN(index_of, IndexOfFN);
130 testFN(insert_before, InsertBeforeFN);
131 testFN(iri_to_uri, IriToURIFN);
132 testFN(local_name_from_QName, LocalNameFromQNameFN);
133 testFN(lower_case, LowerCaseFN);
134 testFN(matches, MatchesFN);
135 testFN(max, MaxFN);
136 testFN(min, MinFN);
137 testFN(minutes_from_dateTime, MinutesFromAbstractDateTimeFN);
138 testFN(minutes_from_duration, MinutesFromDurationFN);
139 testFN(minutes_from_time, MinutesFromAbstractDateTimeFN);
140 testFN(month_from_date, MonthFromAbstractDateTimeFN);
141 testFN(month_from_dateTime, MonthFromAbstractDateTimeFN);
142 testFN(months_from_duration, MonthsFromDurationFN);
143 testFN(namespace_uri_for_prefix, NamespaceURIForPrefixFN);
144 testFN(namespace_uri_from_QName, NamespaceURIFromQNameFN);
145 testFN(nilled, NilledFN);
146 testFN(node_name, NodeNameFN);
147 testFN(normalize_unicode, NormalizeUnicodeFN);
148 testFN(prefix_from_QName, PrefixFromQNameFN);
149 testFN(remove, RemoveFN);
150 testFN(replace, ReplaceFN);
151 testFN(resolve_QName, ResolveQNameFN);
152 testFN(resolve_uri, ResolveURIFN);
153 testFN(generic_string_join, StringJoinFN);
154 testFN(reverse, ReverseFN);
155 testFN(root, RootFN);
156 testFN(round_half_to_even, RoundHalfToEvenFN);
157 testFN(seconds_from_dateTime, SecondsFromAbstractDateTimeFN);
158 testFN(seconds_from_duration, SecondsFromDurationFN);
159 testFN(seconds_from_time, SecondsFromAbstractDateTimeFN);
160 testFN(static_base_uri, StaticBaseURIFN);
161 testFN(string_join, StringJoinFN);
162 testFN(string_to_codepoints, StringToCodepointsFN);
163 testFN(subsequence, SubsequenceFN);
164 testFN(timezone_from_date, TimezoneFromAbstractDateTimeFN);
165 testFN(timezone_from_dateTime, TimezoneFromAbstractDateTimeFN);
166 testFN(timezone_from_time, TimezoneFromAbstractDateTimeFN);
167 testFN(tokenize, TokenizeFN);
168 testFN(trace, TraceFN);
169 testFN(upper_case, UpperCaseFN);
170 testFN(year_from_date, YearFromAbstractDateTimeFN);
171 testFN(year_from_dateTime, YearFromAbstractDateTimeFN);
172 testFN(years_from_duration, YearsFromDurationFN);
173#undef testFN
174
175 if(fn)
176 {
177 fn->setOperands(args);
178 fn->as<FunctionCall>()->setSignature(sign);
179 }
180 else
181 {
182 /* Do the ones which are not FunctionCall sub-classes. The effect is
183 * that FunctionCall sub-classes has "automatic" type checking in the base
184 * class done from the background of their function signature, while
185 * these special classes are on their own, and must do it manually. */
186 if(name.localName() == StandardLocalNames::data)
187 fn = Expression::Ptr(new Atomizer(args.first()));
188 else if(name.localName() == StandardLocalNames::zero_or_one)
189 fn = Expression::Ptr(new CardinalityVerifier(args.first(), Cardinality::zeroOrOne(),
190 ReportContext::FORG0003));
191 else if(name.localName() == StandardLocalNames::one_or_more)
192 fn = Expression::Ptr(new CardinalityVerifier(args.first(), Cardinality::oneOrMore(),
193 ReportContext::FORG0004));
194 else if(name.localName() == StandardLocalNames::exactly_one)
195 fn = Expression::Ptr(new CardinalityVerifier(args.first(), Cardinality::exactlyOne(),
196 ReportContext::FORG0005));
197 else if(name.localName() == StandardLocalNames::unordered)
198 /* We don't make use of the unordered() function, so just pop in
199 * the arg. */
200 fn = args.first();
201 }
202
203 return fn;
204}
205
206FunctionSignature::Ptr XPath20CoreFunctions::retrieveFunctionSignature(const NamePool::Ptr &np,
207 const QXmlName name)
208{
209 if(StandardNamespaces::fn != name.namespaceURI() && name.namespaceURI() != StandardNamespaces::InternalXSLT)
210 return FunctionSignature::Ptr();
211
212 FunctionSignature::Ptr s(functionSignatures().value(akey: name));
213
214 if(!s)
215 {
216 const QXmlName::LocalNameCode localName = name.localName();
217
218 /* Alphabetic order. */
219 if(StandardLocalNames::QName == localName)
220 {
221 s = addFunction(localName: StandardLocalNames::QName, minArgs: 2, maxArgs: 2, returnType: CommonSequenceTypes::ExactlyOneQName);
222 s->appendArgument(name: argument(np, name: "paramURI"), type: CommonSequenceTypes::ZeroOrOneString);
223 s->appendArgument(name: argument(np, name: "paramQName"), type: CommonSequenceTypes::ExactlyOneString);
224 }
225 else if(StandardLocalNames::abs == localName)
226 {
227 s = addFunction(localName: StandardLocalNames::abs, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneNumeric,
228 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
229 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneNumeric);
230 }
231 else if(StandardLocalNames::adjust_date_to_timezone == localName)
232 {
233 s = addFunction(localName: StandardLocalNames::adjust_date_to_timezone, minArgs: 1, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrOneDate,
234 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
235 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDate);
236 s->appendArgument(name: argument(np, name: "timezone"), type: CommonSequenceTypes::ZeroOrOneDayTimeDuration);
237 }
238 else if(StandardLocalNames::adjust_dateTime_to_timezone == localName)
239 {
240 s = addFunction(localName: StandardLocalNames::adjust_dateTime_to_timezone, minArgs: 1, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrOneDateTime,
241 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
242 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDateTime);
243 s->appendArgument(name: argument(np, name: "timezone"), type: CommonSequenceTypes::ZeroOrOneDayTimeDuration);
244 }
245 else if(StandardLocalNames::adjust_time_to_timezone == localName)
246 {
247 s = addFunction(localName: StandardLocalNames::adjust_time_to_timezone, minArgs: 1, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrOneTime,
248 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
249 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneTime);
250 s->appendArgument(name: argument(np, name: "timezone"), type: CommonSequenceTypes::ZeroOrOneDayTimeDuration);
251 }
252 else if(StandardLocalNames::avg == localName)
253 {
254 s = addFunction(localName: StandardLocalNames::avg, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneAtomicType,
255 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
256 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrMoreAtomicTypes);
257 }
258 else if(StandardLocalNames::base_uri == localName)
259 {
260 s = addFunction(localName: StandardLocalNames::base_uri, minArgs: 0, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneAnyURI,
261 props: Expression::UseContextItem);
262 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneNode);
263 }
264 else if(StandardLocalNames::codepoint_equal == localName)
265 {
266 s = addFunction(localName: StandardLocalNames::codepoint_equal, minArgs: 2, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrOneBoolean);
267 s->appendArgument(name: argument(np, name: "comparand1"), type: CommonSequenceTypes::ZeroOrOneString);
268 s->appendArgument(name: argument(np, name: "comparand2"), type: CommonSequenceTypes::ZeroOrOneString);
269 }
270 else if(StandardLocalNames::codepoints_to_string == localName)
271 {
272 s = addFunction(localName: StandardLocalNames::codepoints_to_string, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ExactlyOneString);
273 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrMoreIntegers);
274 }
275 else if(StandardLocalNames::collection == localName)
276 {
277 s = addFunction(localName: StandardLocalNames::collection, minArgs: 0, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrMoreNodes);
278 s->appendArgument(name: argument(np, name: "uri"), type: CommonSequenceTypes::ZeroOrOneString);
279 }
280 else if(StandardLocalNames::compare == localName)
281 {
282 s = addFunction(localName: StandardLocalNames::compare, minArgs: 2, maxArgs: 3, returnType: CommonSequenceTypes::ZeroOrOneInteger,
283 props: Expression::LastOperandIsCollation);
284 s->appendArgument(name: argument(np, name: "comparand1"), type: CommonSequenceTypes::ZeroOrOneString);
285 s->appendArgument(name: argument(np, name: "comparand2"), type: CommonSequenceTypes::ZeroOrOneString);
286 s->appendArgument(name: argument(np, name: "collation"), type: CommonSequenceTypes::ExactlyOneString);
287 }
288 else if(StandardLocalNames::current_date == localName)
289 {
290 s = addFunction(localName: StandardLocalNames::current_date, minArgs: 0, maxArgs: 0, returnType: CommonSequenceTypes::ExactlyOneDate,
291 props: Expression::DisableElimination);
292 }
293 else if(StandardLocalNames::current_dateTime == localName)
294 {
295 s = addFunction(localName: StandardLocalNames::current_dateTime, minArgs: 0, maxArgs: 0, returnType: CommonSequenceTypes::ExactlyOneDateTime,
296 props: Expression::DisableElimination);
297 }
298 else if(StandardLocalNames::current_time == localName)
299 {
300 s = addFunction(localName: StandardLocalNames::current_time, minArgs: 0, maxArgs: 0, returnType: CommonSequenceTypes::ExactlyOneTime,
301 props: Expression::DisableElimination);
302 }
303 else if(StandardLocalNames::data == localName)
304 {
305 s = addFunction(localName: StandardLocalNames::data, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrMoreAtomicTypes);
306 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrMoreItems);
307 }
308 else if(StandardLocalNames::dateTime == localName)
309 {
310 s = addFunction(localName: StandardLocalNames::dateTime, minArgs: 2, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrOneDateTime);
311 s->appendArgument(name: argument(np, name: "arg1"), type: CommonSequenceTypes::ZeroOrOneDate);
312 s->appendArgument(name: argument(np, name: "arg2"), type: CommonSequenceTypes::ZeroOrOneTime);
313 }
314 else if(StandardLocalNames::day_from_date == localName)
315 {
316 s = addFunction(localName: StandardLocalNames::day_from_date, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
317 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
318 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDate);
319 }
320 else if(StandardLocalNames::day_from_dateTime == localName)
321 {
322 s = addFunction(localName: StandardLocalNames::day_from_dateTime, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
323 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
324 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDateTime);
325 }
326 else if(StandardLocalNames::days_from_duration == localName)
327 {
328 s = addFunction(localName: StandardLocalNames::days_from_duration, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
329 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
330 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDuration);
331 }
332 else if(StandardLocalNames::deep_equal == localName)
333 {
334 s = addFunction(localName: StandardLocalNames::deep_equal, minArgs: 2, maxArgs: 3, returnType: CommonSequenceTypes::ExactlyOneBoolean,
335 props: Expression::LastOperandIsCollation);
336 s->appendArgument(name: argument(np, name: "arg1"), type: CommonSequenceTypes::ZeroOrMoreItems);
337 s->appendArgument(name: argument(np, name: "arg2"), type: CommonSequenceTypes::ZeroOrMoreItems);
338 s->appendArgument(name: argument(np, name: "collation"), type: CommonSequenceTypes::ExactlyOneString);
339 }
340 else if(StandardLocalNames::default_collation == localName)
341 {
342 s = addFunction(localName: StandardLocalNames::default_collation, minArgs: 0, maxArgs: 0, returnType: CommonSequenceTypes::ExactlyOneString);
343 }
344 else if(StandardLocalNames::distinct_values == localName)
345 {
346 s = addFunction(localName: StandardLocalNames::distinct_values, minArgs: 1, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrMoreAtomicTypes,
347 props: Expression::LastOperandIsCollation |
348 Expression::EmptynessFollowsChild |
349 Expression::RewriteToEmptyOnEmpty);
350 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrMoreAtomicTypes);
351 s->appendArgument(name: argument(np, name: "collation"), type: CommonSequenceTypes::ExactlyOneString);
352 }
353 else if(StandardLocalNames::doc == localName)
354 {
355 s = addFunction(localName: StandardLocalNames::doc, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneDocumentNode, props: Expression::DisableElimination);
356 s->appendArgument(name: argument(np, name: "uri"), type: CommonSequenceTypes::ZeroOrOneString);
357 }
358 else if(StandardLocalNames::doc_available == localName)
359 {
360 s = addFunction(localName: StandardLocalNames::doc_available, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ExactlyOneBoolean, props: Expression::DisableElimination);
361 s->appendArgument(name: argument(np, name: "uri"), type: CommonSequenceTypes::ZeroOrOneString);
362 }
363 else if(StandardLocalNames::document_uri == localName)
364 {
365 s = addFunction(localName: StandardLocalNames::document_uri, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneAnyURI);
366 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneNode);
367 }
368 else if(StandardLocalNames::empty == localName)
369 {
370 s = addFunction(localName: StandardLocalNames::empty, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ExactlyOneBoolean, id: Expression::IDEmptyFN);
371 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrMoreItems);
372 }
373 else if(StandardLocalNames::encode_for_uri == localName)
374 {
375 s = addFunction(localName: StandardLocalNames::encode_for_uri, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ExactlyOneString);
376 s->appendArgument(name: argument(np, name: "uriPart"), type: CommonSequenceTypes::ZeroOrOneString);
377 }
378 else if(StandardLocalNames::ends_with == localName)
379 {
380 s = addFunction(localName: StandardLocalNames::ends_with, minArgs: 2, maxArgs: 3, returnType: CommonSequenceTypes::ExactlyOneBoolean,
381 props: Expression::LastOperandIsCollation);
382 s->appendArgument(name: argument(np, name: "arg1"), type: CommonSequenceTypes::ZeroOrOneString);
383 s->appendArgument(name: argument(np, name: "arg2"), type: CommonSequenceTypes::ZeroOrOneString);
384 s->appendArgument(name: argument(np, name: "collation"), type: CommonSequenceTypes::ExactlyOneString);
385 }
386 else if(StandardLocalNames::error == localName)
387 {
388 s = addFunction(localName: StandardLocalNames::error, minArgs: 0, maxArgs: 3, returnType: CommonSequenceTypes::None,
389 props: Expression::DisableElimination | Expression::DisableTypingDeduction);
390 s->appendArgument(name: argument(np, name: "error"), type: CommonSequenceTypes::ZeroOrOneQName);
391 s->appendArgument(name: argument(np, name: "description"), type: CommonSequenceTypes::ExactlyOneString);
392 s->appendArgument(name: argument(np, name: "errorObject"), type: CommonSequenceTypes::ZeroOrMoreItems);
393 }
394 else if(StandardLocalNames::escape_html_uri == localName)
395 {
396 s = addFunction(localName: StandardLocalNames::escape_html_uri, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ExactlyOneString);
397 s->appendArgument(name: argument(np, name: "uri"), type: CommonSequenceTypes::ZeroOrOneString);
398 }
399 else if(StandardLocalNames::exactly_one == localName)
400 {
401 s = addFunction(localName: StandardLocalNames::exactly_one, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ExactlyOneItem);
402 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ExactlyOneItem);
403 }
404 else if(StandardLocalNames::exists == localName)
405 {
406 s = addFunction(localName: StandardLocalNames::exists, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ExactlyOneBoolean, id: Expression::IDExistsFN);
407 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrMoreItems);
408 }
409 else if(StandardLocalNames::hours_from_dateTime == localName)
410 {
411 s = addFunction(localName: StandardLocalNames::hours_from_dateTime, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
412 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
413 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDateTime);
414 }
415 else if(StandardLocalNames::hours_from_duration == localName)
416 {
417 s = addFunction(localName: StandardLocalNames::hours_from_duration, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
418 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
419 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDuration);
420 }
421 else if(StandardLocalNames::hours_from_time == localName)
422 {
423 s = addFunction(localName: StandardLocalNames::hours_from_time, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
424 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
425 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneTime);
426 }
427 else if(StandardLocalNames::idref == localName)
428 {
429 s = addFunction(localName: StandardLocalNames::idref, minArgs: 1, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrMoreElements,
430 props: Expression::UseContextItem);
431 s->appendArgument(name: argument(np, name: "idrefs"), type: CommonSequenceTypes::ZeroOrMoreStrings);
432 s->appendArgument(name: argument(np, name: "node"), type: CommonSequenceTypes::ExactlyOneNode);
433 }
434 else if(StandardLocalNames::implicit_timezone == localName)
435 {
436 s = addFunction(localName: StandardLocalNames::implicit_timezone, minArgs: 0, maxArgs: 0, returnType: CommonSequenceTypes::ExactlyOneDayTimeDuration,
437 props: Expression::DisableElimination);
438 }
439 else if(StandardLocalNames::in_scope_prefixes == localName)
440 {
441 s = addFunction(localName: StandardLocalNames::in_scope_prefixes, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrMoreStrings);
442 s->appendArgument(name: argument(np, name: "element"), type: CommonSequenceTypes::ExactlyOneElement);
443 }
444 else if(StandardLocalNames::index_of == localName)
445 {
446 s = addFunction(localName: StandardLocalNames::index_of, minArgs: 2, maxArgs: 3, returnType: CommonSequenceTypes::ZeroOrMoreIntegers,
447 props: Expression::LastOperandIsCollation);
448 s->appendArgument(name: argument(np, name: "seqParam"), type: CommonSequenceTypes::ZeroOrMoreAtomicTypes);
449 s->appendArgument(name: argument(np, name: "searchParam"), type: CommonSequenceTypes::ExactlyOneAtomicType);
450 s->appendArgument(name: argument(np, name: "collation"), type: CommonSequenceTypes::ExactlyOneString);
451 }
452 else if(StandardLocalNames::insert_before == localName)
453 {
454 s = addFunction(localName: StandardLocalNames::insert_before, minArgs: 3, maxArgs: 3, returnType: CommonSequenceTypes::ZeroOrMoreItems);
455 s->appendArgument(name: argument(np, name: "target"), type: CommonSequenceTypes::ZeroOrMoreItems);
456 s->appendArgument(name: argument(np, name: "position"), type: CommonSequenceTypes::ExactlyOneInteger);
457 s->appendArgument(name: argument(np, name: "insert"), type: CommonSequenceTypes::ZeroOrMoreItems);
458 }
459 else if(StandardLocalNames::iri_to_uri == localName)
460 {
461 s = addFunction(localName: StandardLocalNames::iri_to_uri, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ExactlyOneString);
462 s->appendArgument(name: argument(np, name: "uri_part"), type: CommonSequenceTypes::ZeroOrOneString);
463 }
464 else if(StandardLocalNames::local_name_from_QName == localName)
465 {
466 s = addFunction(localName: StandardLocalNames::local_name_from_QName, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneNCName,
467 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
468 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneQName);
469 }
470 else if(StandardLocalNames::lower_case == localName)
471 {
472 s = addFunction(localName: StandardLocalNames::lower_case, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ExactlyOneString,
473 id: Expression::IDLowerCaseFN);
474 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneString);
475 }
476 else if(StandardLocalNames::matches == localName)
477 {
478 s = addFunction(localName: StandardLocalNames::matches, minArgs: 2, maxArgs: 3, returnType: CommonSequenceTypes::ExactlyOneBoolean);
479 s->appendArgument(name: argument(np, name: "input"), type: CommonSequenceTypes::ZeroOrOneString);
480 s->appendArgument(name: argument(np, name: "pattern"), type: CommonSequenceTypes::ExactlyOneString);
481 s->appendArgument(name: argument(np, name: "flags"), type: CommonSequenceTypes::ExactlyOneString);
482 }
483 else if(StandardLocalNames::max == localName)
484 {
485 s = addFunction(localName: StandardLocalNames::max, minArgs: 1, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrOneAtomicType,
486 props: Expression::LastOperandIsCollation |
487 Expression::EmptynessFollowsChild |
488 Expression::RewriteToEmptyOnEmpty);
489 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrMoreAtomicTypes);
490 s->appendArgument(name: argument(np, name: "collation"), type: CommonSequenceTypes::ExactlyOneString);
491 }
492 else if(StandardLocalNames::min == localName)
493 {
494 s = addFunction(localName: StandardLocalNames::min, minArgs: 1, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrOneAtomicType,
495 props: Expression::LastOperandIsCollation |
496 Expression::EmptynessFollowsChild |
497 Expression::RewriteToEmptyOnEmpty);
498 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrMoreAtomicTypes);
499 s->appendArgument(name: argument(np, name: "collation"), type: CommonSequenceTypes::ExactlyOneString);
500 }
501 else if(StandardLocalNames::minutes_from_dateTime == localName)
502 {
503 s = addFunction(localName: StandardLocalNames::minutes_from_dateTime, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
504 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
505 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDateTime);
506 }
507 else if(StandardLocalNames::minutes_from_duration == localName)
508 {
509 s = addFunction(localName: StandardLocalNames::minutes_from_duration, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
510 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
511 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDuration);
512 }
513 else if(StandardLocalNames::minutes_from_time == localName)
514 {
515 s = addFunction(localName: StandardLocalNames::minutes_from_time, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
516 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
517 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneTime);
518 }
519 else if(StandardLocalNames::month_from_date == localName)
520 {
521 s = addFunction(localName: StandardLocalNames::month_from_date, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
522 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
523 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDate);
524 }
525 else if(StandardLocalNames::month_from_dateTime == localName)
526 {
527 s = addFunction(localName: StandardLocalNames::month_from_dateTime, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
528 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
529 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDateTime);
530 }
531 else if(StandardLocalNames::months_from_duration == localName)
532 {
533 s = addFunction(localName: StandardLocalNames::months_from_duration, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
534 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
535 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDuration);
536 }
537 else if(StandardLocalNames::namespace_uri_for_prefix == localName)
538 {
539 s = addFunction(localName: StandardLocalNames::namespace_uri_for_prefix, minArgs: 2, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrOneAnyURI);
540 s->appendArgument(name: argument(np, name: "prefix"), type: CommonSequenceTypes::ZeroOrOneString);
541 s->appendArgument(name: argument(np, name: "element"), type: CommonSequenceTypes::ExactlyOneElement);
542 }
543 else if(StandardLocalNames::namespace_uri_from_QName == localName)
544 {
545 s = addFunction(localName: StandardLocalNames::namespace_uri_from_QName, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneAnyURI,
546 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
547 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneQName);
548 }
549 else if(StandardLocalNames::nilled == localName)
550 {
551 s = addFunction(localName: StandardLocalNames::nilled, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneBoolean);
552 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneNode);
553 }
554 else if(StandardLocalNames::node_name == localName)
555 {
556 s = addFunction(localName: StandardLocalNames::node_name, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneQName);
557 s->appendArgument(name: argument(np, name: "theNode"), type: CommonSequenceTypes::ZeroOrOneNode);
558 }
559 else if(StandardLocalNames::normalize_unicode == localName)
560 {
561 s = addFunction(localName: StandardLocalNames::normalize_unicode, minArgs: 1, maxArgs: 2, returnType: CommonSequenceTypes::ExactlyOneString);
562 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneString);
563 s->appendArgument(name: argument(np, name: "normalizationForm"), type: CommonSequenceTypes::ExactlyOneString);
564 }
565 else if(StandardLocalNames::one_or_more == localName)
566 {
567 s = addFunction(localName: StandardLocalNames::one_or_more, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::OneOrMoreItems);
568 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrMoreItems);
569 }
570 else if(StandardLocalNames::prefix_from_QName == localName)
571 {
572 s = addFunction(localName: StandardLocalNames::prefix_from_QName, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneNCName,
573 props: Expression::RewriteToEmptyOnEmpty);
574 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneQName);
575 }
576 else if(StandardLocalNames::remove == localName)
577 {
578 s = addFunction(localName: StandardLocalNames::remove, minArgs: 2, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrMoreItems,
579 props: Expression::RewriteToEmptyOnEmpty);
580 s->appendArgument(name: argument(np, name: "target"), type: CommonSequenceTypes::ZeroOrMoreItems);
581 s->appendArgument(name: argument(np, name: "position"), type: CommonSequenceTypes::ExactlyOneInteger);
582 }
583 else if(StandardLocalNames::replace == localName)
584 {
585 s = addFunction(localName: StandardLocalNames::replace, minArgs: 3, maxArgs: 4, returnType: CommonSequenceTypes::ExactlyOneString);
586 s->appendArgument(name: argument(np, name: "input"), type: CommonSequenceTypes::ZeroOrOneString);
587 s->appendArgument(name: argument(np, name: "pattern"), type: CommonSequenceTypes::ExactlyOneString);
588 s->appendArgument(name: argument(np, name: "replacement"), type: CommonSequenceTypes::ExactlyOneString);
589 s->appendArgument(name: argument(np, name: "flags"), type: CommonSequenceTypes::ExactlyOneString);
590 }
591 else if(StandardLocalNames::resolve_QName == localName)
592 {
593 s = addFunction(localName: StandardLocalNames::resolve_QName, minArgs: 2, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrOneQName,
594 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
595 s->appendArgument(name: argument(np, name: "qname"), type: CommonSequenceTypes::ZeroOrOneString);
596 s->appendArgument(name: argument(np, name: "element"), type: CommonSequenceTypes::ExactlyOneElement);
597 }
598 else if(StandardLocalNames::resolve_uri == localName)
599 {
600 s = addFunction(localName: StandardLocalNames::resolve_uri, minArgs: 1, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrOneAnyURI,
601 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
602 s->appendArgument(name: argument(np, name: "relative"), type: CommonSequenceTypes::ZeroOrOneString);
603 s->appendArgument(name: argument(np, name: "base"), type: CommonSequenceTypes::ExactlyOneString);
604 }
605 else if(StandardLocalNames::reverse == localName)
606 {
607 s = addFunction(localName: StandardLocalNames::reverse, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrMoreItems);
608 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrMoreItems);
609 }
610 else if(StandardLocalNames::root == localName)
611 {
612 s = addFunction(localName: StandardLocalNames::root, minArgs: 0, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneNode,
613 props: Expression::EmptynessFollowsChild |
614 Expression::RewriteToEmptyOnEmpty |
615 Expression::UseContextItem);
616 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneNode);
617 }
618 else if(StandardLocalNames::round_half_to_even == localName)
619 {
620 s = addFunction(localName: StandardLocalNames::round_half_to_even, minArgs: 1, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrOneNumeric,
621 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
622 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneNumeric);
623 s->appendArgument(name: argument(np, name: "precision"), type: CommonSequenceTypes::ExactlyOneInteger);
624 }
625 else if(StandardLocalNames::seconds_from_dateTime == localName)
626 {
627 s = addFunction(localName: StandardLocalNames::seconds_from_dateTime, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneDecimal,
628 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
629 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDateTime);
630 }
631 else if(StandardLocalNames::seconds_from_duration == localName)
632 {
633 s = addFunction(localName: StandardLocalNames::seconds_from_duration, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneDecimal,
634 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
635 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDuration);
636 }
637 else if(StandardLocalNames::seconds_from_time == localName)
638 {
639 s = addFunction(localName: StandardLocalNames::seconds_from_time, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneDecimal,
640 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
641 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneTime);
642 }
643 else if(StandardLocalNames::static_base_uri == localName)
644 {
645 s = addFunction(localName: StandardLocalNames::static_base_uri, minArgs: 0, maxArgs: 0, returnType: CommonSequenceTypes::ExactlyOneAnyURI, props: Expression::EmptynessFollowsChild);
646 }
647 else if(StandardLocalNames::string_join == localName)
648 {
649 s = addFunction(localName: StandardLocalNames::string_join, minArgs: 2, maxArgs: 2, returnType: CommonSequenceTypes::ExactlyOneString);
650 s->appendArgument(name: argument(np, name: "arg1"), type: CommonSequenceTypes::ZeroOrMoreStrings);
651 s->appendArgument(name: argument(np, name: "separator"), type: CommonSequenceTypes::ExactlyOneString);
652 }
653 else if(StandardLocalNames::generic_string_join == localName)
654 {
655 s = addFunction(localName: StandardLocalNames::generic_string_join, minArgs: 2, maxArgs: 2, returnType: CommonSequenceTypes::ExactlyOneString,
656 id: Expression::IDIgnorableExpression,
657 props: Expression::Properties(),
658 ns: StandardNamespaces::InternalXSLT);
659 s->appendArgument(name: argument(np, name: "arg1"), type: CommonSequenceTypes::ZeroOrMoreAtomicTypes);
660 s->appendArgument(name: argument(np, name: "separator"), type: CommonSequenceTypes::ExactlyOneString);
661 }
662 else if(StandardLocalNames::string_to_codepoints == localName)
663 {
664 s = addFunction(localName: StandardLocalNames::string_to_codepoints, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrMoreIntegers);
665 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneString);
666 }
667 else if(StandardLocalNames::subsequence == localName)
668 {
669 s = addFunction(localName: StandardLocalNames::subsequence, minArgs: 2, maxArgs: 3, returnType: CommonSequenceTypes::ZeroOrMoreItems);
670 s->appendArgument(name: argument(np, name: "sourceSeq"), type: CommonSequenceTypes::ZeroOrMoreItems);
671 s->appendArgument(name: argument(np, name: "startingLoc"), type: CommonSequenceTypes::ExactlyOneDouble);
672 s->appendArgument(name: argument(np, name: "length"), type: CommonSequenceTypes::ExactlyOneDouble);
673 }
674 else if(StandardLocalNames::timezone_from_date == localName)
675 {
676 s = addFunction(localName: StandardLocalNames::timezone_from_date, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneDayTimeDuration,
677 props: Expression::RewriteToEmptyOnEmpty);
678 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDate);
679 }
680 else if(StandardLocalNames::timezone_from_dateTime == localName)
681 {
682 s = addFunction(localName: StandardLocalNames::timezone_from_dateTime, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneDayTimeDuration,
683 props: Expression::RewriteToEmptyOnEmpty);
684 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDateTime);
685 }
686 else if(StandardLocalNames::timezone_from_time == localName)
687 {
688 s = addFunction(localName: StandardLocalNames::timezone_from_time, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneDayTimeDuration,
689 props: Expression::RewriteToEmptyOnEmpty);
690 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneTime);
691 }
692 else if(StandardLocalNames::tokenize == localName)
693 {
694 s = addFunction(localName: StandardLocalNames::tokenize, minArgs: 2, maxArgs: 3, returnType: CommonSequenceTypes::ZeroOrMoreStrings);
695 s->appendArgument(name: argument(np, name: "input"), type: CommonSequenceTypes::ZeroOrOneString);
696 s->appendArgument(name: argument(np, name: "pattern"), type: CommonSequenceTypes::ExactlyOneString);
697 s->appendArgument(name: argument(np, name: "flags"), type: CommonSequenceTypes::ExactlyOneString);
698 }
699 else if(StandardLocalNames::trace == localName)
700 {
701 s = addFunction(localName: StandardLocalNames::trace, minArgs: 2, maxArgs: 2, returnType: CommonSequenceTypes::ZeroOrMoreItems,
702 props: Expression::DisableElimination);
703 s->appendArgument(name: argument(np, name: "value"), type: CommonSequenceTypes::ZeroOrMoreItems);
704 s->appendArgument(name: argument(np, name: "label"), type: CommonSequenceTypes::ExactlyOneString);
705 }
706 else if(StandardLocalNames::unordered == localName)
707 {
708 s = addFunction(localName: StandardLocalNames::unordered, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrMoreItems);
709 s->appendArgument(name: argument(np, name: "sourceSeq"), type: CommonSequenceTypes::ZeroOrMoreItems);
710 }
711 else if(StandardLocalNames::upper_case == localName)
712 {
713 s = addFunction(localName: StandardLocalNames::upper_case, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ExactlyOneString,
714 id: Expression::IDUpperCaseFN);
715 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneString);
716 }
717 else if(StandardLocalNames::year_from_date == localName)
718 {
719 s = addFunction(localName: StandardLocalNames::year_from_date, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
720 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
721 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDate);
722 }
723 else if(StandardLocalNames::year_from_dateTime == localName)
724 {
725 s = addFunction(localName: StandardLocalNames::year_from_dateTime, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
726 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
727 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDateTime);
728 }
729 else if(StandardLocalNames::years_from_duration == localName)
730 {
731 s = addFunction(localName: StandardLocalNames::years_from_duration, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneInteger,
732 props: Expression::EmptynessFollowsChild | Expression::RewriteToEmptyOnEmpty);
733 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrOneDuration);
734 }
735 else if(StandardLocalNames::zero_or_one == localName)
736 {
737 s = addFunction(localName: StandardLocalNames::zero_or_one, minArgs: 1, maxArgs: 1, returnType: CommonSequenceTypes::ZeroOrOneItem);
738 s->appendArgument(name: argument(np, name: "arg"), type: CommonSequenceTypes::ZeroOrMoreItems);
739 }
740 }
741
742 return s;
743}
744
745
746QT_END_NAMESPACE
747

source code of qtxmlpatterns/src/xmlpatterns/functions/qxpath20corefunctions.cpp