Project

Profile

Help

Bug #6519

closed

Confusing documentation for otherwise

Added by Norm Tovey-Walsh 3 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Low
Assignee:
Category:
Documentation
Sprint/Milestone:
-
Start date:
2024-08-29
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

By way of a question on the. XML.com slack, on the page about otherwise we find:

The precedence of the operator is greater than arithmetic operators (so $n div $m otherwise 1 means $n div ($m otherwise 1)), but less than the "union" operator (so a/b/c otherwise 0 means (a/b/c) otherwise 0).

But there isn't an obvious use of the union operator there. Was that meant to be (a|b|c) otherwise 0?

Actions #1

Updated by Michael Kay 3 months ago

Rephrasing this for 12.x as

As defined in the current XPath 4.0 draft (September 2024), arithmetic operators such as + bind more tightly than otherwise, so $a + $b otherwise $c means ($a + $b) otherwise $c. However, Saxon 12 implements an earlier draft of the specification in which it means $a + ($b otherwise $c). Use parentheses to make your intended meaning clear and to avoid compatibility problems in the future.

This deliberately avoids describing the exact implemented precedence in 12.x; what people need to know is that it's going to change so they need to use parentheses.

Actions #2

Updated by Michael Kay 3 months ago

  • Category set to Documentation
  • Status changed from New to Resolved
  • Assignee set to Michael Kay

Please register to edit this issue

Also available in: Atom PDF