Re: [xsl] Where in the XPath 2.0 is the text stating that a function can be used as the location step?

Subject: Re: [xsl] Where in the XPath 2.0 is the text stating that a function can be used as the location step?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 29 Jul 2010 10:00:16 +0100
XPath 2.0 changed the syntax so that "/" behaved like a proper orthogonal binary operator by allowing any expression (subject only to precedence and type rules) as its operands. It is of course a higher-order operator in that it evaluates the right-hand operand repeatedly.

Quite properly, the semantics of E1/E2 are explained in terms that are independent of the syntactic form of E1 and E2, and it's the grammar rules that tell you what kind of expressions are allowed in E1 and E2. This is in my view the correct way to describe an orthogonal functional language.

I don't think there's anywhere in the spec that says "in natural language" that with the expression E1 < E2, the operand E2 can be a function call; and I don't think there should be. People should expect to be able to use function calls anywhere an expression is allowed, and the spec should only draw notice to something that's an exception to the general rule.

When writing a tutorial, of course, different rules apply. In my book, there's extensive discussion of the binary "/" operator on pages 602-604. But the spec is not a tutorial.

Michael Kay
Saxonica


On 29/07/2010 06:11, Dimitre Novatchev wrote:
I can see from the productions of the XPAth 2.0 grammar that:

A StepExpr can be a FilterExpr (27)

and

A FilterExpr can be PrimaryExpr (38)

and

A PrimaryExpr can be FunctionCall (41)


However I cant see anywhere a description in natural language that a step can be a function call, and I think it is important that this fact be stated clearly enough.

Am I missing this text?

Current Thread