Project

Profile

Help

Bug #5035

closed

SXST0067 Component cannot be streamed, although it is guaranteed streamable according to W3C rules. No watch implemented for locVarRef

Added by Martin Honnen over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Streaming
Sprint/Milestone:
-
Start date:
2021-07-05
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
10, trunk
Fix Committed on Branch:
10, trunk
Fixed in Maintenance Release:
Platforms:

Description

I was trying to be creative and tried to write a generic function to use positional grouping and streaming, the code runs fine without streaming but gives the error

  SXST0067  Component cannot be streamed, although it is guaranteed streamable according to
  W3C rules. No watch implemented for locVarRef

when trying to compile and run the stylesheet.

Sample code inline and attached:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="3.0"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:mf="http://example.com/mf"
    xmlns:ex="http://example.com/ex"
    exclude-result-prefixes="#all"
    expand-text="yes">
    
    <xsl:function name="mf:group-chunks" as="item()*" streamability="absorbing">
        <xsl:param name="items" as="item()*"/>
        <xsl:param name="chunk-size" as="xs:integer"/>
        <xsl:param name="handle-chunk" as="function(item()*) as item()*"/>
        <xsl:for-each-group select="$items" group-adjacent="(position() - 1) idiv $chunk-size">
            <xsl:sequence select="$handle-chunk(current-group())"/>
        </xsl:for-each-group>
    </xsl:function>
    
    <xsl:function name="ex:wrap-rows" as="element()" streamability="absorbing">
        <xsl:param name="group" as="element()*"/>
        <xsl:param name="wrapper-name" as="xs:QName"/>
        <xsl:element name="{$wrapper-name}" namespace="{namespace-uri-from-QName($wrapper-name)}">
            <xsl:sequence select="$group"/>
        </xsl:element>
    </xsl:function>
    
    <xsl:output method="xml" indent="yes"/>
    
    <xsl:mode streamable="yes"/>
    
    <xsl:template match="root">
        <xsl:copy>
            <xsl:sequence select="mf:group-chunks(item, 3, ex:wrap-rows(?, QName((), 'chunk')))"/>      
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="/">
        <xsl:next-match/>
        <xsl:comment xmlns:saxon="http://saxon.sf.net/">Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('Q{http://saxon.sf.net/}platform')}</xsl:comment>
    </xsl:template>
    
</xsl:stylesheet>

Sample input:

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <item>item 01</item>
    <item>item 02</item>
    <item>item 03</item>
    <item>item 04</item>
    <item>item 05</item>
    <item>item 06</item>
    <item>item 07</item>
    <item>item 08</item>
    <item>item 09</item>
    <item>item 10</item>
    <item>item 11</item>
    <item>item 12</item>
    <item>item 13</item>
    <item>item 14</item>
    <item>item 15</item>
    <item>item 16</item>
    <item>item 17</item>
    <item>item 18</item>
    <item>item 19</item>
    <item>item 20</item>
    <item>item 21</item>
    <item>item 22</item>
    <item>item 23</item>
</root>

Full output with Saxon EE 10.5 Java:

Saxon-EE 10.5J from Saxonica
Java version 1.8.0_272
Using license serial number Vxxxxx
Error on line 22 column 99 of passing-current-group-to-function-test1.xsl:
  SXST0067  Component cannot be streamed, although it is guaranteed streamable according to
  W3C rules. No watch implemented for locVarRef
Errors were reported during stylesheet compilation

Files

Please register to edit this issue

Also available in: Atom PDF