This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The expression X treat as document-node(element(X)) has the same streaming difficulties as X[. instance of document-node(element(X))] We discuss these difficulties in the analysis for "instance of" expressions (19.8.8.5) but there is no mention under "treat as" expressions (which do not even merit a special section).
I think the rule for the streamability of treat expressions (B treat as T) is: if the item type of T is document-node(E) where E is a node-test of the form element(N) or schema-element(N) node-test, then roaming and free-ranging otherwise the posture and sweep of B. This might seem a bit severe. But it's the same as the result we get for the (essentially) equivalent expression B[. instance of T]. (The instance of expression here is consuming, therefore the predicate is not motionless, therefore the filter expression is roaming and free-ranging.)
The changes were agreed and have been applied.