@@ -33,20 +33,20 @@ XPathSequence _xsStringConstructor(XPathContext context, [Object? value]) {
3333/// https://www.w3.org/TR/xpath-functions-31/#func-boolean
3434const xsBooleanConstructor = XPathFunctionDefinition (
3535 name: XmlName .qualified ('xs:boolean' ),
36- requiredArguments : [
36+ optionalArguments : [
3737 XPathArgumentDefinition (
3838 name: 'value' ,
39- type: xsSequence ,
40- cardinality: XPathCardinality .zeroOrMore ,
39+ type: xsAny ,
40+ cardinality: XPathCardinality .zeroOrOne ,
4141 ),
4242 ],
4343 function: _xsBooleanConstructor,
4444);
4545
46- XPathSequence _xsBooleanConstructor (
47- XPathContext context,
48- XPathSequence value,
49- ) => XPathSequence . single (xsBoolean. cast (value));
46+ XPathSequence _xsBooleanConstructor (XPathContext context, [ Object ? value]) {
47+ if (value == null ) return XPathSequence .empty;
48+ return XPathSequence . single (xsBoolean. cast ( value));
49+ }
5050
5151/// https://www.w3.org/TR/xpath-functions-31/#func-integer
5252const xsIntegerConstructor = XPathFunctionDefinition (
@@ -78,7 +78,7 @@ const xsDecimalConstructor = XPathFunctionDefinition(
7878);
7979
8080XPathSequence _xsDecimalConstructor (XPathContext context, Object value) =>
81- XPathSequence .single (xsNumeric .cast (value));
81+ XPathSequence .single (xsDecimal .cast (value));
8282
8383/// https://www.w3.org/TR/xpath-functions-31/#func-double
8484const xsDoubleConstructor = XPathFunctionDefinition (
@@ -138,9 +138,12 @@ const xsByteConstructor = XPathFunctionDefinition(
138138 cardinality: XPathCardinality .exactlyOne,
139139 ),
140140 ],
141- function: _xsIntegerConstructor ,
141+ function: _xsByteConstructor ,
142142);
143143
144+ XPathSequence _xsByteConstructor (XPathContext context, Object value) =>
145+ XPathSequence .single (xsByte.cast (value));
146+
144147/// https://www.w3.org/TR/xpath-functions-31/#func-integer
145148const xsIntConstructor = XPathFunctionDefinition (
146149 name: XmlName .qualified ('xs:int' ),
@@ -151,9 +154,12 @@ const xsIntConstructor = XPathFunctionDefinition(
151154 cardinality: XPathCardinality .exactlyOne,
152155 ),
153156 ],
154- function: _xsIntegerConstructor ,
157+ function: _xsIntConstructor ,
155158);
156159
160+ XPathSequence _xsIntConstructor (XPathContext context, Object value) =>
161+ XPathSequence .single (xsInt.cast (value));
162+
157163/// https://www.w3.org/TR/xpath-functions-31/#func-integer
158164const xsLongConstructor = XPathFunctionDefinition (
159165 name: XmlName .qualified ('xs:long' ),
@@ -164,9 +170,12 @@ const xsLongConstructor = XPathFunctionDefinition(
164170 cardinality: XPathCardinality .exactlyOne,
165171 ),
166172 ],
167- function: _xsIntegerConstructor ,
173+ function: _xsLongConstructor ,
168174);
169175
176+ XPathSequence _xsLongConstructor (XPathContext context, Object value) =>
177+ XPathSequence .single (xsLong.cast (value));
178+
170179/// https://www.w3.org/TR/xpath-functions-31/#func-integer
171180const xsNegativeIntegerConstructor = XPathFunctionDefinition (
172181 name: XmlName .qualified ('xs:negativeInteger' ),
@@ -177,9 +186,14 @@ const xsNegativeIntegerConstructor = XPathFunctionDefinition(
177186 cardinality: XPathCardinality .exactlyOne,
178187 ),
179188 ],
180- function: _xsIntegerConstructor ,
189+ function: _xsNegativeIntegerConstructor ,
181190);
182191
192+ XPathSequence _xsNegativeIntegerConstructor (
193+ XPathContext context,
194+ Object value,
195+ ) => XPathSequence .single (xsNegativeInteger.cast (value));
196+
183197/// https://www.w3.org/TR/xpath-functions-31/#func-integer
184198const xsNonNegativeIntegerConstructor = XPathFunctionDefinition (
185199 name: XmlName .qualified ('xs:nonNegativeInteger' ),
@@ -190,9 +204,14 @@ const xsNonNegativeIntegerConstructor = XPathFunctionDefinition(
190204 cardinality: XPathCardinality .exactlyOne,
191205 ),
192206 ],
193- function: _xsIntegerConstructor ,
207+ function: _xsNonNegativeIntegerConstructor ,
194208);
195209
210+ XPathSequence _xsNonNegativeIntegerConstructor (
211+ XPathContext context,
212+ Object value,
213+ ) => XPathSequence .single (xsNonNegativeInteger.cast (value));
214+
196215/// https://www.w3.org/TR/xpath-functions-31/#func-integer
197216const xsNonPositiveIntegerConstructor = XPathFunctionDefinition (
198217 name: XmlName .qualified ('xs:nonPositiveInteger' ),
@@ -203,9 +222,14 @@ const xsNonPositiveIntegerConstructor = XPathFunctionDefinition(
203222 cardinality: XPathCardinality .exactlyOne,
204223 ),
205224 ],
206- function: _xsIntegerConstructor ,
225+ function: _xsNonPositiveIntegerConstructor ,
207226);
208227
228+ XPathSequence _xsNonPositiveIntegerConstructor (
229+ XPathContext context,
230+ Object value,
231+ ) => XPathSequence .single (xsNonPositiveInteger.cast (value));
232+
209233/// https://www.w3.org/TR/xpath-functions-31/#func-integer
210234const xsPositiveIntegerConstructor = XPathFunctionDefinition (
211235 name: XmlName .qualified ('xs:positiveInteger' ),
@@ -216,9 +240,14 @@ const xsPositiveIntegerConstructor = XPathFunctionDefinition(
216240 cardinality: XPathCardinality .exactlyOne,
217241 ),
218242 ],
219- function: _xsIntegerConstructor ,
243+ function: _xsPositiveIntegerConstructor ,
220244);
221245
246+ XPathSequence _xsPositiveIntegerConstructor (
247+ XPathContext context,
248+ Object value,
249+ ) => XPathSequence .single (xsPositiveInteger.cast (value));
250+
222251/// https://www.w3.org/TR/xpath-functions-31/#func-integer
223252const xsShortConstructor = XPathFunctionDefinition (
224253 name: XmlName .qualified ('xs:short' ),
@@ -229,9 +258,12 @@ const xsShortConstructor = XPathFunctionDefinition(
229258 cardinality: XPathCardinality .exactlyOne,
230259 ),
231260 ],
232- function: _xsIntegerConstructor ,
261+ function: _xsShortConstructor ,
233262);
234263
264+ XPathSequence _xsShortConstructor (XPathContext context, Object value) =>
265+ XPathSequence .single (xsShort.cast (value));
266+
235267/// https://www.w3.org/TR/xpath-functions-31/#func-integer
236268const xsUnsignedByteConstructor = XPathFunctionDefinition (
237269 name: XmlName .qualified ('xs:unsignedByte' ),
@@ -242,9 +274,12 @@ const xsUnsignedByteConstructor = XPathFunctionDefinition(
242274 cardinality: XPathCardinality .exactlyOne,
243275 ),
244276 ],
245- function: _xsIntegerConstructor ,
277+ function: _xsUnsignedByteConstructor ,
246278);
247279
280+ XPathSequence _xsUnsignedByteConstructor (XPathContext context, Object value) =>
281+ XPathSequence .single (xsUnsignedByte.cast (value));
282+
248283/// https://www.w3.org/TR/xpath-functions-31/#func-integer
249284const xsUnsignedIntConstructor = XPathFunctionDefinition (
250285 name: XmlName .qualified ('xs:unsignedInt' ),
@@ -255,9 +290,12 @@ const xsUnsignedIntConstructor = XPathFunctionDefinition(
255290 cardinality: XPathCardinality .exactlyOne,
256291 ),
257292 ],
258- function: _xsIntegerConstructor ,
293+ function: _xsUnsignedIntConstructor ,
259294);
260295
296+ XPathSequence _xsUnsignedIntConstructor (XPathContext context, Object value) =>
297+ XPathSequence .single (xsUnsignedInt.cast (value));
298+
261299/// https://www.w3.org/TR/xpath-functions-31/#func-integer
262300const xsUnsignedLongConstructor = XPathFunctionDefinition (
263301 name: XmlName .qualified ('xs:unsignedLong' ),
@@ -268,9 +306,12 @@ const xsUnsignedLongConstructor = XPathFunctionDefinition(
268306 cardinality: XPathCardinality .exactlyOne,
269307 ),
270308 ],
271- function: _xsIntegerConstructor ,
309+ function: _xsUnsignedLongConstructor ,
272310);
273311
312+ XPathSequence _xsUnsignedLongConstructor (XPathContext context, Object value) =>
313+ XPathSequence .single (xsUnsignedLong.cast (value));
314+
274315/// https://www.w3.org/TR/xpath-functions-31/#func-integer
275316const xsUnsignedShortConstructor = XPathFunctionDefinition (
276317 name: XmlName .qualified ('xs:unsignedShort' ),
@@ -281,9 +322,12 @@ const xsUnsignedShortConstructor = XPathFunctionDefinition(
281322 cardinality: XPathCardinality .exactlyOne,
282323 ),
283324 ],
284- function: _xsIntegerConstructor ,
325+ function: _xsUnsignedShortConstructor ,
285326);
286327
328+ XPathSequence _xsUnsignedShortConstructor (XPathContext context, Object value) =>
329+ XPathSequence .single (xsUnsignedShort.cast (value));
330+
287331/// https://www.w3.org/TR/xpath-functions-31/#func-date
288332const xsDateConstructor = XPathFunctionDefinition (
289333 name: XmlName .qualified ('xs:date' ),
0 commit comments