Project

Profile

Help

Bug #6519

closed

Confusing documentation for otherwise

Added by Norm Tovey-Walsh 5 months ago. Updated 8 days ago.

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

100%

Estimated time:
Legacy ID:
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
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 4 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 4 months ago

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

Updated by Debbie Lockett 8 days ago

  • 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