On 18 Feb 2014, at 11:58, David Rudel <fwqhgads@gmail.com> wrote:

I'm having difficulty using burst-mode streaming using either of the standard methods detailed in the 9.5 documentation.

I've used burst-mode-streaming in the past with saxon:stream, but now it does not appear to be working. When I try

    <xsl:for-each select="saxon:stream(doc($path||'Mock_Echo_Test_1.xml')//day[+@session-day gt 1]/item[@model.error ne ''])">
                <i bin1="{round(@model.error div $bin.width)}" bin2="{round(@current.error div $bin.width)}"/>
            </xsl:for-each>

Saxon does not process using streaming. -t shows an effort at building a tree for a 2GB document.

Notably, modifying the path statement fixes this. When I try:
<xsl:for-each select="saxon:stream(doc($path||'Mock_Echo_Test_1.xml')//item[@model.error ne ''])">
                <i bin1="{round(@model.error div $bin.width)}" bin2="{round(@current.error div $bin.width)}"/>
            </xsl:for-each>

Saxon does process using streaming. I don't see why the inclusion of "/day[+@session-day gt 1]" into the path should prevent streaming.

I can't see why immediately either, I'll look into it.

Perhaps more importantly, I get errors when trying the "proper" XSLT3 syntax, copying and pasting code directly from the Saxon documentation page:

<xsl:stream href='employees.xml'> <xsl:apply-templates select="copy-of(*/employee)"/> </xsl:stream>

When I put this into oXygen, processing using 9.5.1.3, I get the following errors:

Engine name: Saxon-EE 9.5.1.3
Severity: warning
Description: The body of the xsl:stream instruction is not guaranteed streamable according to W3C rules * There is an xsl:apply-templates instruction using a non-streamable mode
Start location: 33:37

Engine name: Saxon-EE 9.5.1.3
Severity: warning
Description: Evaluation will always throw a dynamic error: Expression xsl:apply-templates is free-ranging * There is an xsl:apply-templates instruction using a non-streamable mode
Start location: 33:0

Engine name: Saxon-EE 9.5.1.3
Severity: fatal
Description: SXST0060: Expression xsl:apply-templates is free-ranging * There is an xsl:apply-templates instruction using a non-streamable mode
Start location: 33:0
URL: http://www.saxonica.com/html/documentation/javadoc/net/sf/saxon/trans/SaxonErrorCode.html#SXST0060

The basic problem here is a major bug in the streamability rules in the 2012 XSLT 3.0 spec, which Saxon 9.5 faithfully implemented. It basically means that the rules take no account of the "copy-of". Retrofitting the corrected 2013 rules into 9.5 doesn't look feasible, so I don't think it's going to be possible to fix this before 9.6, which is still some months away. It might be worth trying a workaround of binding the result of "copy-of" to a variable.

Michael Kay
Saxonica