W3C home > Mailing lists > Public > www-xpath-comments@w3.org > January to March 2002

RE: Parentheses may be used for grouping

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Thu, 3 Jan 2002 17:16:43 +0100
Message-ID: <DFF2AC9E3583D511A21F0008C7E6210622B8AD@softwareag.com>
To: "'James Swift'" <Swift@altova.com>, www-xpath-comments@w3.org
> Since parentheses may be used for grouping this is obviously allowed, 
> /foo/bar[ ( fish or cow ) and dog ]
> however am I correct in assuming that the following example 
> supplied in the spec is not allowed according to the grammar?
> (preceding::foo)[1]
> I do understand what it means etc. I just can't work out how 
> (Expr)Predicate is allowed.

This expression is allowed, I think. An Expr can be a StepExpr, which can be
a GeneralStep; a GeneralStep is a PrimaryExpr followed by a StepQualifiers;
a parenthesized expression is a PrimaryExpr, and "[1]" is a StepQualifiers.

> It's not allowed to have '(' or ')' ina Step either.

Again, a StepExpr can be a GeneralStep which can be a Primary. 

Mike Kay 
Received on Thursday, 3 January 2002 11:16:47 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:09:42 UTC