This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Consider <xsl:for-each-group select="x" group-by="@y"> <a b="{@b}"/> <xsl:copy-of select="current-group()"/> <a b="{@b}"/> </xsl:for-each-group> This is streamable according to current rules. During evaluation of xsl:for-each-group, the context item is the FIRST item in the group. So both references to @b access the b attribute of the FIRST x element. Clearly, after processing current-group(), we are no longer positioned on the first x element so we can only achieve this by remembering details of the x element (or perhaps by evaluating the post-descent instructions before we process the group, and remembering the result). So it can't be done without buffering. I think we should (somehow) ban inspection access to the context item in the post-descent phase of a streaming xsl:for-each-group.
I should of course have used group-adjacent rather than group-by. I added a test case si-group-027, and rather to my surprise, Saxon passes it. It seems that it does so by retaining enough information about the context item to evaluate inspection expressions for the duration of the group: that it it retains the context-item's start tag and ancestor stack. This seems acceptable within the definition of streaming. I'm therefore withdrawing the bug.