[ADD] XQuery optimizations: add leading root expression. Closes #955
[MIN] merged