This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 5716 - [XPath] An error in XPath grammar
Summary: [XPath] An error in XPath grammar
Status: RESOLVED INVALID
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XPath 2.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows XP
: P2 major
Target Milestone: ---
Assignee: Don Chamberlin
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL: http://www.w3.org/TR/xpath20
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-24 06:37 UTC by Mukul Gandhi
Modified: 2008-05-24 11:00 UTC (History)
0 users

See Also:


Attachments

Description Mukul Gandhi 2008-05-24 06:37:25 UTC
Hi all,
  In the XPath 2.0 grammar specified at, http://www.w3.org/TR/xpath20/#nt-bnf I find some problems.

I have difficulty understanding the production named, IfExpr (shown below): 

IfExpr ::= "if" "(" Expr ")" "then" ExprSingle "else" ExprSingle

Where as, ExprSingle is defined as:

ExprSingle ::= ForExpr
| QuantifiedExpr
| IfExpr
| OrExpr

The following XPath 2.0 expressions are reported legal by Saxon 9.

if (x = '1') then 'hello' else 'world'

and

if (x = '1') then 'hello' else ()

I think these expressions should be legal from user's point of view (and Saxon is right), but the XPath 2.0 grammar doesn't cater to these cases.

Regards,
Mukul
Comment 1 Michael Kay 2008-05-24 08:49:58 UTC
If you follow the expansion of OrExpr you will see that 'string' and () are both legal instances of OrExpr.
Comment 2 Mukul Gandhi 2008-05-24 11:00:54 UTC
(In reply to comment #1)
> If you follow the expansion of OrExpr you will see that 'string' and () are
> both legal instances of OrExpr.
>

Sorry, I didn't follow the rules quite deeply. Thanks for pointing this to me.

Regards,
Mukul