diff --git a/src/expressions/functions/builtInFunctions_sequences.ts b/src/expressions/functions/builtInFunctions_sequences.ts index 96ff37abb..b54f342bb 100644 --- a/src/expressions/functions/builtInFunctions_sequences.ts +++ b/src/expressions/functions/builtInFunctions_sequences.ts @@ -8,7 +8,10 @@ import ISequence from '../dataTypes/ISequence'; import isSubtypeOf from '../dataTypes/isSubtypeOf'; import sequenceFactory from '../dataTypes/sequenceFactory'; import Value, { SequenceMultiplicity, SequenceType, ValueType } from '../dataTypes/Value'; +import DynamicContext from '../DynamicContext'; +import ExecutionParameters from '../ExecutionParameters'; import { valueCompare } from '../operators/compares/ValueCompare'; +import StaticContext from '../StaticContext'; import { BUILT_IN_NAMESPACE_URIS } from '../staticallyKnownNamespaces'; import { DONE_TOKEN, IIterator, IterationHint, ready } from '../util/iterators'; import zipSingleton from '../util/zipSingleton'; @@ -690,6 +693,105 @@ const fnFoldRight: FunctionDefinitionType = ( ); }; +function compareKeys(keysA: Value[], keysB: Value[], dynamicContext: DynamicContext): number { + const maxLen = Math.max(keysA.length, keysB.length); + for (let i = 0; i < maxLen; i++) { + const a = i < keysA.length ? keysA[i] : null; + const b = i < keysB.length ? keysB[i] : null; + + if (a === null && b === null) continue; + // Empty sequences sort first (least) + if (a === null) return -1; + if (b === null) return 1; + + const aIsNaN = typeof a.value === 'number' && isNaN(a.value); + const bIsNaN = typeof b.value === 'number' && isNaN(b.value); + + if (aIsNaN && bIsNaN) continue; + // NaN sorts last (greatest) + if (aIsNaN) return 1; + if (bIsNaN) return -1; + + if (valueCompare('gtOp', a.type, b.type)(a, b, dynamicContext)) return 1; + if (valueCompare('ltOp', a.type, b.type)(a, b, dynamicContext)) return -1; + } + return 0; +} + +function doSort( + dynamicContext: DynamicContext, + executionParameters: ExecutionParameters, + staticContext: StaticContext, + sequence: ISequence, + keyFn: FunctionValue | null, +): ISequence { + return sequence.mapAll((items) => { + if (items.length === 0) { + return sequenceFactory.empty(); + } + + // Compute raw sort keys (sequence of atomic values) for each item + const rawKeys: Value[][] = items.map((item) => { + if (keyFn) { + const argTypes = keyFn.getArgumentTypes(); + const arg = performFunctionConversion( + argTypes[0] as SequenceType, + sequenceFactory.singleton(item), + executionParameters, + 'fn:sort', + false, + ); + return keyFn.value + .call(undefined, dynamicContext, executionParameters, staticContext, arg) + .getAllValues(); + } + return atomize(sequenceFactory.singleton(item), executionParameters).getAllValues(); + }); + + // Cast xs:untypedAtomic to xs:string per spec + const castKeys: Value[][] = rawKeys.map((keys) => + keys.map((key) => + isSubtypeOf(key.type, ValueType.XSUNTYPEDATOMIC) + ? castToType(key, ValueType.XSSTRING) + : key, + ), + ); + + // For each key position, convert all values at that position to a common type + const maxKeyLen = castKeys.reduce((max, k) => Math.max(max, k.length), 0); + const finalKeys: Value[][] = castKeys.map((k) => [...k]); + + for (let pos = 0; pos < maxKeyLen; pos++) { + const entries: { itemIndex: number; value: Value }[] = []; + castKeys.forEach((keys, itemIndex) => { + if (keys.length > pos) { + entries.push({ itemIndex, value: keys[pos] }); + } + }); + + const converted = convertItemsToCommonType(entries.map((e) => e.value)); + if (!converted) { + throw new Error('XPTY0004: fn:sort key values must be comparable'); + } + + entries.forEach(({ itemIndex }, idx) => { + finalKeys[itemIndex][pos] = converted[idx]; + }); + } + + const sortable = items.map((item, i) => ({ item, keys: finalKeys[i] })); + sortable.sort((a, b) => compareKeys(a.keys, b.keys, dynamicContext)); + return sequenceFactory.create(sortable.map((s) => s.item)); + }); +} + +const fnSort: FunctionDefinitionType = ( + dynamicContext, + executionParameters, + staticContext, + sequence, +) => doSort(dynamicContext, executionParameters, staticContext, sequence, null); + const fnSerialize: FunctionDefinitionType = ( _dynamicContext, executionParameters, @@ -1086,6 +1188,60 @@ const declarations: BuiltinDeclarationType[] = [ namespaceURI: BUILT_IN_NAMESPACE_URIS.FUNCTIONS_NAMESPACE_URI, returnType: { type: ValueType.XSSTRING, mult: SequenceMultiplicity.EXACTLY_ONE }, }, + + { + argumentTypes: [{ type: ValueType.ITEM, mult: SequenceMultiplicity.ZERO_OR_MORE }], + callFunction: fnSort, + localName: 'sort', + namespaceURI: BUILT_IN_NAMESPACE_URIS.FUNCTIONS_NAMESPACE_URI, + returnType: { type: ValueType.ITEM, mult: SequenceMultiplicity.ZERO_OR_MORE }, + }, + + { + argumentTypes: [ + { type: ValueType.ITEM, mult: SequenceMultiplicity.ZERO_OR_MORE }, + { type: ValueType.XSSTRING, mult: SequenceMultiplicity.ZERO_OR_ONE }, + ], + callFunction: (dynamicContext, executionParameters, staticContext, sequence, collation) => { + if (!collation.isEmpty()) { + throw new Error('FOCH0002: No collations are supported'); + } + return doSort(dynamicContext, executionParameters, staticContext, sequence, null); + }, + localName: 'sort', + namespaceURI: BUILT_IN_NAMESPACE_URIS.FUNCTIONS_NAMESPACE_URI, + returnType: { type: ValueType.ITEM, mult: SequenceMultiplicity.ZERO_OR_MORE }, + }, + + { + argumentTypes: [ + { type: ValueType.ITEM, mult: SequenceMultiplicity.ZERO_OR_MORE }, + { type: ValueType.XSSTRING, mult: SequenceMultiplicity.ZERO_OR_ONE }, + { type: ValueType.FUNCTION, mult: SequenceMultiplicity.EXACTLY_ONE }, + ], + callFunction: ( + dynamicContext, + executionParameters, + staticContext, + sequence, + collation, + keySeq, + ) => { + if (!collation.isEmpty()) { + throw new Error('FOCH0002: No collations are supported'); + } + return doSort( + dynamicContext, + executionParameters, + staticContext, + sequence, + keySeq.first() as FunctionValue, + ); + }, + localName: 'sort', + namespaceURI: BUILT_IN_NAMESPACE_URIS.FUNCTIONS_NAMESPACE_URI, + returnType: { type: ValueType.ITEM, mult: SequenceMultiplicity.ZERO_OR_MORE }, + }, ]; export default { diff --git a/test/assets/runnableTestSets.csv b/test/assets/runnableTestSets.csv index f864b73d6..c76a32b98 100644 --- a/test/assets/runnableTestSets.csv +++ b/test/assets/runnableTestSets.csv @@ -160,7 +160,7 @@ fn-seconds-from-duration,true fn-seconds-from-time,true fn-serialize,true fn-serialize-json,false -fn-sort,false +fn-sort,true fn-starts-with,true fn-static-base-uri,false fn-string,true diff --git a/test/assets/unrunnableTestCases.csv b/test/assets/unrunnableTestCases.csv index 886601f44..adaa57a86 100644 --- a/test/assets/unrunnableTestCases.csv +++ b/test/assets/unrunnableTestCases.csv @@ -652,12 +652,6 @@ fn-function-lookup-720,AssertionError: Expected XPath exists(function-lookup(fn: fn-function-lookup-721,Error: XPTY0004: Expected base expression of a function call to evaluate to a sequence of single function item fn-function-lookup-724,AssertionError: Expected XPath exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'apply'), 2)) to resolve to true: expected false to be true fn-function-lookup-725,Error: XPTY0004: Expected base expression of a function call to evaluate to a sequence of single function item -fn-function-lookup-726,AssertionError: Expected XPath exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'sort'), 1)) to resolve to true: expected false to be true -fn-function-lookup-727,Error: XPTY0004: Expected base expression of a function call to evaluate to a sequence of single function item -fn-function-lookup-728,AssertionError: Expected XPath exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'sort'), 2)) to resolve to true: expected false to be true -fn-function-lookup-729,Error: XPTY0004: Expected base expression of a function call to evaluate to a sequence of single function item -fn-function-lookup-730,AssertionError: Expected XPath exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'sort'), 1)) to resolve to true: expected false to be true -fn-function-lookup-731,Error: XPTY0004: Expected base expression of a function call to evaluate to a sequence of single function item fn-function-lookup-732,AssertionError: Expected XPath exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'contains-token'), 2)) to resolve to true: expected false to be true fn-function-lookup-733,Error: XPTY0004: Expected base expression of a function call to evaluate to a sequence of single function item fn-function-lookup-734,AssertionError: Expected XPath exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'default-language'), 0)) to resolve to true: expected false to be true @@ -1115,7 +1109,6 @@ fn-random-number-generator-14,Error: No selector counterpart for: typedMapTest. fn-random-number-generator-17,AssertionError: Skipped test, it was a assert-permutation fn-random-number-generator-18,AssertionError: Skipped test, it was a assert-permutation fn-random-number-generator-21,Error: 1: ( 2: declare namespace r="http://example.com/random/"; ^ 3: declare %public function r:random-sequence($length as xs:integer) as xs:double* { 4: r:random-sequence($length, fn:random-number-generator()) Error: XPST0003: Failed to parse script. Expected -,+,validate,(#,(,#,parent::,ancestor::,preceding-sibling::,preceding::,ancestor-or-self::,..,child::,descendant::,attribute::,self::,descendant-or-self::,following-sibling::,following::,document-node(,element,attribute,schema-element,schema-attribute(,processing-instruction(,processing-instruction(),comment(),text(),namespace-node(),node(),:*,Q,[A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD],[\uD800-\uDB7F],/,// at <>:2:21 - 2:22 -fn-random-number-generator-22,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}sort with arity of 1 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}sort (array(*))", "Q{http://www.w3.org/2001/XMLSchema}short (xs:anyAtomicType?)" or "Q{http://www.w3.org/2005/xpath-functions/math}sqrt (xs:double?)"? fn-random-number-generator-30,Error: XPST0017: Function fn:apply with arity of 2 not registered. No similar functions found. fn-random-number-generator-32,Error: No selector counterpart for: typedMapTest. fn-random-number-generator-35,Error: No selector counterpart for: anyFunctionTest. @@ -1384,6 +1377,18 @@ serialize-adaptive-001,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath- serialize-adaptive-002,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}serialize with arity of 2 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions}serialize (item()*)"? serialize-adaptive-003,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}serialize with arity of 2 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions}serialize (item()*)"? serialize-adaptive-004,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}serialize with arity of 2 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions}serialize (item()*)"? +fn-sort-10,Error: 1: let $r := fn:sort( (17, 5, 14) ) return (count($r) eq 3 and $r[1] eq 5 and $r[2] eq 14 2: and$r[3] eq 17) ^ Error: XPST0003: Failed to parse script. Expected -,+,validate,(#,(,#,parent::,ancestor::,preceding-sibling::,preceding::,ancestor-or-self::,..,child::,descendant::,attribute::,self::,descendant-or-self::,following-sibling::,following::,document-node(,element,attribute,schema-element,schema-attribute(,processing-instruction(,processing-instruction(),comment(),text(),namespace-node(),node(),:*,Q,[A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD],[\uD800-\uDB7F],/,// at <>:2:10 - 2:11 +fn-sort-spec-4,Error: XPST0017: Function default-collation with arity of 0 not registered. No similar functions found. +fn-sort-spec-5,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}default-collation with arity of 0 not registered. No similar functions found. +fn-sort-spec-6,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}parse-xml with arity of 1 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions}parse-json (xs:string)"? +fn-sort-collation-1,Error: 1: deep-equal(( ^ 2: declare default collation "http://www.w3.org/2010/09/qt-fots-catalog/collation/caseblind"; 3: fn:sort(("Red", "green", "blUE", "PINK", "ORanGE")) Error: XPST0003: Failed to parse script. Expected end of input at <>:1:11 - 1:12 +fn-sort-collation-2,Error: 1: deep-equal(( ^ 2: declare default collation "http://www.w3.org/2010/09/qt-fots-catalog/collation/caseblind"; 3: fn:sort(("Red", "green", "blUE", "PINK", "ORanGE"), ()) Error: XPST0003: Failed to parse script. Expected end of input at <>:1:11 - 1:12 +fn-sort-collation-3,Error: 1: deep-equal(( ^ 2: declare default collation "http://www.w3.org/2010/09/qt-fots-catalog/collation/caseblind"; 3: fn:sort(("Red", "green", "blUE", "PINK", "ORanGE"), (), string#1) Error: XPST0003: Failed to parse script. Expected end of input at <>:1:11 - 1:12 +fn-sort-collation-4,Error: FOCH0002: No collations are supported +fn-sort-collation-5,Error: FOCH0002: No collations are supported +fn-sort-collation-6,Error: FOCH0002: No collations are supported +fn-sort-collation-7,Error: FOCH0002: No collations are supported +fn-sort-collation-8,Error: 1: deep-equal(( ^ 2: declare function local:key($n as xs:integer) as xs:string { 3: ("Red", "green", "blUE", "PINK", "ORanGE")[$n] Error: XPST0003: Failed to parse script. Expected end of input at <>:1:11 - 1:12 fn-starts-with-17,Error: FOCH0002: No collations are supported fn-starts-with-18,Error: FOCH0002: No collations are supported fn-starts-with-19,Error: FOCH0002: No collations are supported @@ -2424,8 +2429,8 @@ cbcl-cast-gYearMonth-003,AssertionError: expected [Function] to throw an error XQueryComment014,Error: 3: 4: 5: "10" cast as (: type comment :) xs:integer ? ^ 6: 7: = 10 Error: XPST0003: Failed to parse script. Expected end of input at <>:5:44 - 5:45 Constr-compattr-compname-20,Error: XQDY0074: The value "Q{http://example.com/x}y" of a name expressions cannot be converted to an expanded QName. Constr-compattr-compname-21,Error: XQDY0074: The value " Q{}y " of a name expressions cannot be converted to an expanded QName. -Constr-compattr-compname-22,Error: XQDY0074: The value " Q{http://example.com/x}y2025" of a name expressions cannot be converted to an expanded QName. -Constr-compattr-compname-23,Error: XQDY0074: The value "Q{}y2025" of a name expressions cannot be converted to an expanded QName. +Constr-compattr-compname-22,Error: XQDY0074: The value " Q{http://example.com/x}y2026" of a name expressions cannot be converted to an expanded QName. +Constr-compattr-compname-23,Error: XQDY0074: The value "Q{}y2026" of a name expressions cannot be converted to an expanded QName. Constr-compattr-id-2,AssertionError: Expected executing the XPath "element elem {attribute xml:id {" ab c d "}}" to resolve to one of the expected results, but got AssertionError: Expected XPath element elem {attribute xml:id {" ab c d "}} to resolve to the given XML. Expected to equal , AssertionError: expected [Function] to throw an error. K2-ComputeConAttr-34,AssertionError: Expected XPath { attribute name {xs:hexBinary("ff")}, attribute name2 {"content"} } to resolve to the given XML. Expected to equal K2-ComputeConAttr-48,AssertionError: Expected executing the XPath "string(attribute xml:id {" ab c d "})" to resolve to one of the expected results, but got AssertionError: string(attribute xml:id {" ab c d "}): expected ' ab c d ' to equal 'ab c d', AssertionError: expected [Function] to throw an error. @@ -2511,8 +2516,8 @@ cbcl-constr-compcomment-001,AssertionError: expected [Function] to throw an erro cbcl-constr-compcomment-002,AssertionError: expected [Function] to throw an error Constr-compelem-name-20,Error: XQDY0074: The value "Q{http://example.com/x}x" of a name expressions cannot be converted to an expanded QName. Constr-compelem-name-21,Error: XQDY0074: The value "Q{}x" of a name expressions cannot be converted to an expanded QName. -Constr-compelem-name-22,Error: XQDY0074: The value " Q{http://example.com/x}x2025" of a name expressions cannot be converted to an expanded QName. -Constr-compelem-name-23,Error: XQDY0074: The value " Q{}x2025 " of a name expressions cannot be converted to an expanded QName. +Constr-compelem-name-22,Error: XQDY0074: The value " Q{http://example.com/x}x2026" of a name expressions cannot be converted to an expanded QName. +Constr-compelem-name-23,Error: XQDY0074: The value " Q{}x2026 " of a name expressions cannot be converted to an expanded QName. Constr-compelem-name-24,AssertionError: element {" x" || year-from-date(current-date()) || " "} {}: expected false to be true Constr-compelem-constrmod-3,AssertionError: expected [Function] to throw error matching /FORG0001/ but got 'Not implemented: only module imports,…' Constr-compelem-constrmod-4,AssertionError: Expected executing the XPath "declare construction preserve; (element elem {xs:decimal((//decimal[1]))}) cast as xs:integer" to resolve to one of the expected results, but got Error: Not implemented: only module imports, namespace declarations, and function declarations are implemented in XQuery modules, AssertionError: expected [Function] to throw error matching /FORG0001/ but got 'Not implemented: only module imports,…'. @@ -3799,7 +3804,7 @@ UseCaseR31-033,Error: 1: deep-equal(( ^ 2: declare namespac UseCaseR31-034-err,AssertionError: expected [Function] to throw error matching /XPTY0004/ but got 'XPST0017: Function Q{http://www.w3.or…' xmp-queries-results-q4,Error: More than one order spec is not supported for the order by clause. xmp-queries-results-q12,Error: More than one order spec is not supported for the order by clause. -d1e11215,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}sort with arity of 1 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}sort (array(*))", "Q{http://www.w3.org/2001/XMLSchema}short (xs:anyAtomicType?)" or "Q{http://www.w3.org/2005/xpath-functions/math}sqrt (xs:double?)"? +d1e11215,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}doc with arity of 1 not registered. No similar functions found. d1e20420,Error: 1: deep-equal(( ^ 2: xquery version "3.1" encoding "UTF-8"; "inserted for testing prolog only examples"), ("inserted for testing prolog only examples")) Error: XPST0003: Failed to parse script. Expected end of input at <>:1:11 - 1:12 d1e41029,Error: XPST0017: Function doc with arity of 1 not registered. No similar functions found. d1e41041,Error: 1: deep-equal(( ^ 2: declare variable $deptnames := map { 3: "ACC" : "Accessories", Error: XPST0003: Failed to parse script. Expected end of input at <>:1:11 - 1:12 @@ -3904,12 +3909,10 @@ d1e71531,Error: 1: deep-equal((declare variable $array1 := ["abc","def","ghi","j d1e71542,Error: 1: deep-equal((declare variable $array1 := ["abc","def","ghi","jkl"]; ^ 2: array:remove(["abc"],1)), ([ ])) Error: XPST0003: Failed to parse script. Expected end of input at <>:1:11 - 1:12 d1e74388,Error: 1: deep-equal((declare variable $map1 := map {1:"first", 2:"second"}; ^ 2: declare variable $map2 := map {}; 3: map:size( $map1 )), (2)) Error: XPST0003: Failed to parse script. Expected end of input at <>:1:11 - 1:12 d1e74399,Error: 1: deep-equal((declare variable $map1 := map {1:"first", 2:"second"}; ^ 2: declare variable $map2 := map {}; 3: map:size( $map2 )), (0)) Error: XPST0003: Failed to parse script. Expected end of input at <>:1:11 - 1:12 -d1e74563,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}sort with arity of 1 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}sort (array(*))", "Q{http://www.w3.org/2001/XMLSchema}short (xs:anyAtomicType?)" or "Q{http://www.w3.org/2005/xpath-functions/math}sqrt (xs:double?)"? -d1e74585,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}sort with arity of 1 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}sort (array(*))", "Q{http://www.w3.org/2001/XMLSchema}short (xs:anyAtomicType?)" or "Q{http://www.w3.org/2005/xpath-functions/math}sqrt (xs:double?)"? -d1e74596,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}sort with arity of 3 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}sort (array(*))", "Q{http://www.w3.org/2001/XMLSchema}short (xs:anyAtomicType?)" or "Q{http://www.w3.org/2005/xpath-functions/math}sqrt (xs:double?)"? -d1e74610,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}sort with arity of 3 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}sort (array(*))", "Q{http://www.w3.org/2001/XMLSchema}short (xs:anyAtomicType?)" or "Q{http://www.w3.org/2005/xpath-functions/math}sqrt (xs:double?)"? -d1e74627,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}sort with arity of 3 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}sort (array(*))", "Q{http://www.w3.org/2001/XMLSchema}short (xs:anyAtomicType?)" or "Q{http://www.w3.org/2005/xpath-functions/math}sqrt (xs:double?)"? -d1e74820,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions/array}sort with arity of 3 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}sort (array(*))", "Q{http://www.w3.org/2001/XMLSchema}short (xs:anyAtomicType?)" or "Q{http://www.w3.org/2005/xpath-functions/math}sqrt (xs:double?)"? +d1e74585,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}doc with arity of 1 not registered. No similar functions found. +d1e74596,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}doc with arity of 1 not registered. No similar functions found. +d1e74610,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}doc with arity of 1 not registered. No similar functions found. +d1e74820,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions/array}sort with arity of 3 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}sort (array(*))", "Q{http://www.w3.org/2005/xpath-functions}sort (item()*)", "Q{http://www.w3.org/2005/xpath-functions}sort (item()*, xs:string?)", "Q{http://www.w3.org/2005/xpath-functions}sort (item()*, xs:string?, function(*))" or "Q{http://www.w3.org/2001/XMLSchema}short (xs:anyAtomicType?)"? d1e76034,Error: 1: deep-equal((declare variable $array1 := ["abc","def","ghi","jkl"]; ^ 2: array:subarray($array1,2)), (["def","ghi","jkl"])) Error: XPST0003: Failed to parse script. Expected end of input at <>:1:11 - 1:12 d1e76045,Error: 1: deep-equal((declare variable $array1 := ["abc","def","ghi","jkl"]; ^ 2: array:subarray($array1,2,2)), (["def","ghi"])) Error: XPST0003: Failed to parse script. Expected end of input at <>:1:11 - 1:12 d1e76056,Error: 1: deep-equal((declare variable $array1 := ["abc","def","ghi","jkl"]; ^ 2: array:subarray($array1,2,1)), (["def"])) Error: XPST0003: Failed to parse script. Expected end of input at <>:1:11 - 1:12 @@ -4038,8 +4041,6 @@ fo-test-fn-serialize-002,Error: XPST0017: Function Q{http://www.w3.org/2005/xpat fo-test-fn-for-each-pair-001,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}for-each-pair with arity of 3 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}for-each-pair (array(*), array(*), function(*))", "Q{http://www.w3.org/2005/xpath-functions/array}for-each (array(*), function(*))", "Q{http://www.w3.org/2005/xpath-functions/map}for-each (map(*), item()*)" or "Q{http://www.w3.org/2005/xpath-functions}for-each (item()*, function(*))"? fo-test-fn-for-each-pair-002,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}for-each-pair with arity of 3 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}for-each-pair (array(*), array(*), function(*))", "Q{http://www.w3.org/2005/xpath-functions/array}for-each (array(*), function(*))", "Q{http://www.w3.org/2005/xpath-functions/map}for-each (map(*), item()*)" or "Q{http://www.w3.org/2005/xpath-functions}for-each (item()*, function(*))"? fo-test-fn-for-each-pair-003,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}for-each-pair with arity of 3 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}for-each-pair (array(*), array(*), function(*))", "Q{http://www.w3.org/2005/xpath-functions/array}for-each (array(*), function(*))", "Q{http://www.w3.org/2005/xpath-functions/map}for-each (map(*), item()*)" or "Q{http://www.w3.org/2005/xpath-functions}for-each (item()*, function(*))"? -fo-test-fn-sort-001,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}sort with arity of 1 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}sort (array(*))", "Q{http://www.w3.org/2001/XMLSchema}short (xs:anyAtomicType?)" or "Q{http://www.w3.org/2005/xpath-functions/math}sqrt (xs:double?)"? -fo-test-fn-sort-002,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}sort with arity of 3 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}sort (array(*))", "Q{http://www.w3.org/2001/XMLSchema}short (xs:anyAtomicType?)" or "Q{http://www.w3.org/2005/xpath-functions/math}sqrt (xs:double?)"? fo-test-fn-apply-001,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions}apply with arity of 2 not registered. No similar functions found. fo-test-map-keys-001,AssertionError: Skipped test, it was a assert-permutation fo-test-map-find-001,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions/map}find with arity of 2 not registered. No similar functions found. @@ -4062,4 +4063,4 @@ fo-test-array-subarray-002,Error: FOAY0001: subarray start out of bounds. fo-test-array-subarray-006,Error: FOAY0001: subarray start out of bounds. fo-test-array-subarray-007,Error: FOAY0001: subarray start out of bounds. fo-test-array-fold-right-003,AssertionError: Expected XPath array:fold-right([1,2,3], [], function($x, $y){[$x, $y]}) to (deep equally) resolve to [1, [2, [3, []]]]: expected false to be true -fo-test-array-sort-002,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions/array}sort with arity of 3 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}sort (array(*))", "Q{http://www.w3.org/2001/XMLSchema}short (xs:anyAtomicType?)" or "Q{http://www.w3.org/2005/xpath-functions/math}sqrt (xs:double?)"? \ No newline at end of file +fo-test-array-sort-002,Error: XPST0017: Function Q{http://www.w3.org/2005/xpath-functions/array}sort with arity of 3 not registered. Did you mean "Q{http://www.w3.org/2005/xpath-functions/array}sort (array(*))", "Q{http://www.w3.org/2005/xpath-functions}sort (item()*)", "Q{http://www.w3.org/2005/xpath-functions}sort (item()*, xs:string?)", "Q{http://www.w3.org/2005/xpath-functions}sort (item()*, xs:string?, function(*))" or "Q{http://www.w3.org/2001/XMLSchema}short (xs:anyAtomicType?)"? \ No newline at end of file