Can't format XQuery with group by clause using ":="
Posted: Mon Oct 16, 2017 2:32 pm
I have the following as an ".xq" file in oXygen XML Editor 19.1, build 2017092911
When I try to format that code with the format and indent button I get an error
Looking at https://www.w3.org/TR/xquery-30/#id-group-by and the grammar
it appears to me the syntax is fine. And oXygen runs the query without problems, the problem is simply that it does not manage to format it.
Code: Select all
for $item in Base/Item
group by $id := $item/Id
order by $id
return <Item>
<Id>{$id}</Id>
{for $marked in $item[Mark]
group by $mark := $marked/Mark
return <Marked name="{$mark}">
{sum($marked/Qty)}
</Marked>
}
<Total>{sum($item/Qty)}</Total>
</Item>
Code: Select all
System ID: C:\SomePath\test2017101602.xq
Severity: error
Description: Cannot format the document. Encountered " ":=" ":= "" at line 2, column 14.
Was expecting one of:
<WS> ...
"," ...
"stable" ...
"order" ...
"collation" ...
"count" ...
"where" ...
"return" ...
"as" ...
"for" ...
"let" ...
"group" ...
":)" ...
Start location: 2:13
Length: 1
Code: Select all
GroupingSpec ::= GroupingVariable (TypeDeclaration? ":=" ExprSingle)? ("collation" URILiteral)?
it appears to me the syntax is fine. And oXygen runs the query without problems, the problem is simply that it does not manage to format it.