Skip to content

How to handle parameters that resolve to multiple values in functions? #11

@ekaats

Description

@ekaats

The following expression is giving me trouble:
number($param_that_resolves_to_list_of_values) eq number($param_that_resolves_to_one_value)
XPath itself is pretty clear about how 'eq' works. Each operand should be evaluated seperately:
https://www.w3.org/TR/xpath-3/#id-value-comparisons

problem is though, that the number() function is implemented as a partial that contains the list of values. An obvious solution would be to implement this as a generator, but is this generalizable? Furthermore, the number() function should take one input, and give one output:
https://www.w3.org/TR/xpath-functions-31/#func-number

Returns the value indicated by $arg or, if $arg is not specified, the context item after atomization, converted to an xs:double.
and
Otherwise, $arg is converted to an xs:double following the rules of 19.1.2.2 Casting to xs:double. If the conversion to xs:double fails, the xs:double value NaN is returned.

So the following should actually fail:

number($param_that_resolves_to_list_of_values)

Unless it is implied that looping through the list is the same as calling the function for each value as the ContextItem.

But how would the following function work?

max($param_that_resolves_to_list_of_values)

I would expect it to just return the highest value in the list. Same as something like the following:

max(1,4,2,63) -> 63

or would each list be seen as an iterable list? Such as:
max(1,4,2,63[3,4,2],[7,3,2]) -> 63, 4, 7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions