This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The "natural" XqueryX encoding of the Xquery <a/>/(for $x in 1 return $x) is translated by the stylesheet to <a></a>/ for $x in 1 return $x which is a syntax error. As xqx:parenthesizedExpr does not cause () to be added and (unlike xqx:addOp etc) xqx:filterExpr does not put a () group around its argument. To be specific about the xqueryx, it's included at the end of this message. A workaround would be to use xqx:sequenceExpr instead of xqx:parenthesizedExpr as that always translates to () but parenthesizedExpr is more natural here (and corresponds to the production in the EBNF for this expression). I accept that this will probably be deferred until the next round, but I wanted to post it now anyway so it didn't get lost. I think simplest fix would be to add a template for xqx:filterExpr/xqx:parenthesizedExpr that adds (). David <xqx:module xmlns:xqx="http://www.w3.org/2005/XQueryX"> <xqx:mainModule> <xqx:queryBody> <xqx:pathExpr> <xqx:stepExpr> <xqx:filterExpr> <xqx:elementConstructor> <xqx:tagName>a</xqx:tagName> </xqx:elementConstructor> </xqx:filterExpr> </xqx:stepExpr> <xqx:stepExpr> <xqx:filterExpr> <xqx:parenthesizedExpr> <xqx:flworExpr> <xqx:forClause> <xqx:forClauseItem> <xqx:typedVariableBinding> <xqx:varName>x</xqx:varName> </xqx:typedVariableBinding> <xqx:forExpr> <xqx:integerConstantExpr> <xqx:value>1</xqx:value> </xqx:integerConstantExpr> </xqx:forExpr> </xqx:forClauseItem> </xqx:forClause> <xqx:returnClause> <xqx:pathExpr> <xqx:stepExpr> <xqx:filterExpr> <xqx:varRef> <xqx:name>x</xqx:name> </xqx:varRef> </xqx:filterExpr> </xqx:stepExpr> </xqx:pathExpr> </xqx:returnClause> </xqx:flworExpr> </xqx:parenthesizedExpr> </xqx:filterExpr> </xqx:stepExpr> </xqx:pathExpr> </xqx:queryBody> </xqx:mainModule> </xqx:module>
Thanks once again for your careful reviews. We have made the change that you suggested -- to put parens around parenthesized expressions. If you agree with this action, please change the status of this bug to CLOSED.
(In reply to comment #1) > Thanks once again for your careful reviews. We have made the change that you > suggested -- to put parens around parenthesized expressions. > > If you agree with this action, please change the status of this bug to CLOSED. I'm closing the report but could you say (here or in mail) whether you are adding it to all xqx:parenthesizedExpr or just xqx:filterExpr/xqx:parenthesizedExpr (So I can change my local copy) either way is fine by me. If you do all xqx:parenthesizedExpr you'll get a lot of doubled parenthesis when translating infix expressions as the infix template fully parenthesises its arguments anyway. That's safe if a bit untidy. If you just do it in filterexpressions then there may be other places that need doing as well (I haven't done a full check) David
Apologies for failing to provide the solution in my earlier response. The solution chosen was to add the parens to all instances of xqx:parenthesizedExpr. As you observe, that will sometimes be untidy (polite word for "ugly"), but at least it is safe and covers all possibilities. Had it been limited to only xqx:filterExpr/xqx:parenthesizedExpr, there would perhaps be other xqx:???/xqx:parenthesizedExpr that should have been covered. The broad, but less elegant, solution seemed preferable at this stage of processing.