In section 8.2.3.1.1 it states "For example, if $v is bound to an element with a computed name, the type of $v is element. The static type computed for the expression $v/self::foo is element foo of type xs:anyType, which makes use of foo in the name test to compute a more specific type." The static typing rules in this section reflect this behaviour. But I do not think the quantifier is correct. If $v is an element (so has static type element * of type xs:anyType) then it may or may not satisfy self::foo, as when evaluated the name might not be "foo", in which case an empty sequence is returned. Therefore I think the static type should be "(element foo of type xs:anyType)?". So therefore the type inferences for "element of element *" and "attribute of attribute *" should be: statEnv |- test QName2 with element of element * OptTypeSpecifier : element QName2 OptTypeSpecifier ?
I agree, but this is a duplicate of Bug 4242 and Bug 4261 (a).
Sorry. My fault for not searching closed bugs. *** This bug has been marked as a duplicate of bug 4242 ***
This issue has been incorporated into FS erratum E018, whose fix has been committed to the source files for the next edition of the FS document.