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>
18.221.232.187