Hi Rob,

The spec allows processors to optimize code by taking advantage the supplied type information. For example, the following code…

  let $a as element() := <a/>[. = 'x']
  return empty($a)

…can (and will) be simplified to a static false() – both by BaseX and Saxon, and possibly other processors – because $a is typed to be a single element.

Hope this helps,
Christian