XQTY0024

In element constructor content, enclosed expressions that evaluate to attributes must appear first in the element constructor content, before any other kinds of nodes. For example, the following query is not valid because the second enclosed expression, {$prod/@dept}, appears after an enclosed expression that returns element nodes.

for $prod in doc("catalog.xml")/catalog/product
return <li>{$prod/number}{$prod/@dept}</li>

Get XQuery now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.