Support #2009
closedsaxon:stream not causing streaming
0%
Description
I mentioned this on the Saxon list, and based on M. Kay's response there, I thought I should post here with a snippet of my source code.
When using the following code, Saxon successfully streams the source file snippet.xml:
<xsl:for-each select="saxon:stream(doc($path||'snippet.xml')//item[@model.error ne ''])">
<i bin1="{round(@model.error div $bin.width)}" bin2="{round(@current.error div $bin.width)}"/>
</xsl:for-each>
However, including an extra step in the path: /day, causes Saxon to switch to non-streaming mode:
<xsl:for-each select="saxon:stream(doc($path||'snippet.xml')//day/item[@model.error ne ''])">
<i bin1="{round(@model.error div $bin.width)}" bin2="{round(@current.error div $bin.width)}"/>
</xsl:for-each>
Files
Updated by Michael Kay over 10 years ago
The explanation for this is that the expression //item is "naturally sorted" - it gets optimized to /descendant::item, which selects nodes in document order without needing any sorting; while //day/item is not - see section 19.1 of the Dec 2013 XSLT 3.0 specification to see why. Saxon evaluates //day/item as sort(/descedant::day ! child::item), and the presence of the sort() prevents streaming.
Saxon 9.6 solves this one in the way described in section 19.1 of the spec. In fact some paths in Saxon handle this better than the XSLT 3.0 spec (e.g. for-each and apply-templates), but not saxon:stream().
Updated by Michael Kay over 10 years ago
- Tracker changed from Bug to Support
- Category changed from Saxon extensions to Streaming
- Status changed from New to Won't fix
- Assignee set to Michael Kay
- Found in version changed from 9.5.1.3 to 9.5
Please register to edit this issue