Bug #6519
closed
Confusing documentation for otherwise
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:
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
?
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.
- Category set to Documentation
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Applies to branch 12, trunk added
- Fix Committed on Branch 12, trunk added
Saxon 12 documentation fix pushed to www-saxonica-com
repo: XML and HTML versions of documentation12.
Please register to edit this issue
Also available in: Atom
PDF