#50 Non-integer predicates are rounded

v6.5
closed
5
2012-10-08
2002-01-03
Michael Kay
No

Given an expression like items[1.7], Saxon truncates
the numeric predicate 1.7 to the integer 1, and
returns the first item in the sequence. The XPath 1.0
specification says that the position of the item must
be equal to the value of the predicate for the item to
be selected, it does not specify any rounding; so the
above expression should return an empty node-set.

Present in Saxon 6.5 and all previous releases. Source
code fixed and tested; test case is expr74.

The XPath 2.0 WD (20 Dec 2001) specifies that the
predicate should be rounded (to 2 in the above
example), and Saxon 7.0 implements this correctly.
(However, the spec may change...)

Discussion

  • Michael Kay

    Michael Kay - 2002-02-20

    Logged In: YES
    user_id=251681

    Cleared in 6.5.1

     
  • Michael Kay

    Michael Kay - 2002-11-11

    Logged In: YES
    user_id=251681

    Note that Saxon 7.2 does rounding of predicates, however the
    spec has indeed changed so XPath 2.0 behaves the same way as
    XPath 1.0. Saxon 7.3 will therefore not do rounding.