Incorrect optimization of saxon:stream()
During optimization of a stylesheet, an incorrect rewrite may be applied to the "StreamingCopy" instruction, which is normally used as the compiled representation of a call on saxon:stream() (but may also represent an <xsl:copy-of saxon:read-once> instruction). The effect is to replace the "filter" part of the expression with a copy of the call on the doc instruction. So, for example, the expression saxon:stream(doc('a.xml')//elements) is rewritten as saxon:stream(doc('a.xml')//elements[doc('a.xml')]. In this example the predicate is always true, so it does not affect the results, but it does inhibit streaming.