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 30230 - [XSLT30] Pattern grammar requires at least one argument for rooted expressions, but root() must be used without any
Summary: [XSLT30] Pattern grammar requires at least one argument for rooted expression...
Status: NEW
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-17 22:52 UTC by Abel Braaksma
Modified: 2019-02-15 12:20 UTC (History)
0 users

See Also:


Attachments

Description Abel Braaksma 2018-03-17 22:52:46 UTC
I'm refactoring parts of the pattern parser, which lead to this and the previous report.

We define a rooted pattern with a function call as:

FunctionCallP     ::= OuterFunctionName ArgumentListP
OuterFunctionName ::= "doc" | "id" | "element-with-id" | "key" | "root" | ...

And arguments as:

ArgumentListP     ::= "(" (ArgumentP ("," ArgumentP)*)? ")"

But in the text we say:

"In the case of a call to the rootFO30 function, the argument list must be empty: that is, only the zero-arity form of the function is allowed."

So I think the prose is not in line with the grammar, or vice versa.

Since I was curious where this ArgumentListP grammar came from, I traced the cause of this back to a mail from March 2013 [1], which fixed an ambiguity issue with the grammar parser by requiring at least one argument. This was fine at the time, because the fn:root() function wasn't allowed yet.

However, after we added the fn:root() function, this fix doesn't work anymore.

I don't think there's a really big issue here, except that a literal interpretation of the grammar (which is what it is supposed to be used for, I think), would make a valid call like match="root()/x" invalid.

I propose we add a note and a proposed fix to an erratum.


[1] https://lists.w3.org/Archives/Member/w3c-xsl-query/2013Mar/0070.html
Comment 1 Michael Kay 2019-02-15 12:20:12 UTC
I don't see a bug here. The grammar

ArgumentListP ::= "(" (ArgumentP ("," ArgumentP)*)? ")"

permits an empty argument list.

(Sadly, I no longer have access to the member-only email archive)