Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ekaats opened this issue Oct 14, 2021 · 0 comments
Open

Comments

@ekaats
Copy link
Owner

ekaats commented Oct 14, 2021

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

@ekaats ekaats mentioned this issue Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant