- From: Michael Kay <mike@saxonica.com>
- Date: Tue, 20 Sep 2022 19:54:07 +0100
- To: Norm Tovey-Walsh <norm@saxonica.com>
- Cc: public-xslt-40@w3.org
It seems to be fairly tricky to do this, because (a) we need different comparison rules depending on whether the values are strings or non-strings, and (b) we need to catch the error where values cannot be compared because of their types, without catching other errors. I considered defining the comparison of values using deep-equal(), but that gives the wrong result for NaN. I think it would be something like index-where($input, ->{$item){deep-equal($item, $search) and not (is-NaN($item))) but that requires careful checking. It's actually easier to do it the other way around: index-where($input, $predicate) can be expressed as index-of($input ! $predicate(.), true()) But it might be better to formulate index-where as for $item at $position in $input where $predicate($item) return $position Michael Kay
Received on Tuesday, 20 September 2022 18:54:23 UTC