Project

Profile

Help

Getting SXST0060 "No streamable path found in expression" when trying to push a map with grounded nodes to a template of a streamable mode

Added by Martin Honnen over 5 years ago

I have run into an odd error while trying to find an elegant way to pass some grounded nodes on from a streamed xsl:iterate to a template to create a secondary result, I tried to write a template matching on .[. instance of map(xs:string, element()?)] and then to construct a result-document in there, however, while executing the code Saxon 9.9.0.1 EE gives me an error

SXST0060: Component cannot be streamed, although it is guaranteed streamable according to W3C rules. No streamable path found in expression ($current-item, ...) Component cannot be streamed, although it is guaranteed streamable according to W3C rules. No streamable path found in expression ($current-item, ...)

Here are the details, the XSLT is

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="#all" expand-text="yes"
    version="3.0">
    
    <xsl:param name="STREAMABLE" static="yes" as="xs:boolean" select="true()"/>
    
    <xsl:mode _streamable="{$STREAMABLE}"/>
    
    <xsl:output method="html" indent="yes" version="5.0"/>
    
    <xsl:template match=".[. instance of map(xs:string, element()?)]">
        <xsl:param name="current-item" as="element()" select="?current-item"/>
        <xsl:param name="previous-item" as="element()?" select="?previous-item"/>
        <xsl:param name="next-item" as="element()?" select="?next-item"/>
        <xsl:message select="'item-doc', ., $current-item, $previous-item, $next-item"/>
        <xsl:for-each select="$current-item">
            
            <xsl:result-document href="item_{@id}.html">
                <html>
                    <head>
                        <title>Item {@id}</title>
                    </head>
                    <body>
                        <h1>Item {@id}</h1>
                        <nav>
                            <xsl:if test="$previous-item">
                                <a href="item_{$previous-item/@id}.html">prev</a>
                            </xsl:if>
                            <xsl:if test="$next-item">
                                <a href="item_{$next-item/@id}.html">next</a>
                            </xsl:if>
                        </nav>
                    </body>
                </html>
            </xsl:result-document>
        </xsl:for-each>
    </xsl:template>
    
    <xsl:template match="/">
        <html>
            <head>
                <title>Testing xsl:iterate</title>
            </head>
            <body>
                <h1>Testing xsl:iterate</h1>
                <section>
                    <h2>Results</h2>
                    <xsl:apply-templates/>
                </section>
            </body>
        </html>
    </xsl:template>
    
    <xsl:template match="items">
        <ul>
            <xsl:fork>
                <xsl:sequence>
                    <xsl:apply-templates select="item"/>
                </xsl:sequence>
                <xsl:sequence>
                    <xsl:iterate select="item">
                        <xsl:param name="previous-item" as="element(item)?" select="()"/>
                        <xsl:param name="current-item" as="element(item)*" select="()"/>
                        
                        <xsl:on-completion>
                            <xsl:message select="'remaing'"/>
                            <xsl:apply-templates select="map { 'current-item' : $current-item, 'previous-item' : $previous-item }"/>
                        </xsl:on-completion>
                        
                        <xsl:variable name="this-item" select="copy-of()"/>
                        
                        <xsl:if test="position() gt 1">
                            <xsl:apply-templates select="map { 'current-item' : $current-item, 'previous-item' : $previous-item, 'next-item' : $this-item }"/>
                        </xsl:if>
                        
                        <xsl:next-iteration>
                            <xsl:with-param name="current-item" select="$this-item"/>
                            <xsl:with-param name="previous-item" select="$current-item"/>
                        </xsl:next-iteration>
                        
                    </xsl:iterate>
                </xsl:sequence>
            </xsl:fork>
        </ul>
    </xsl:template>
    
    <xsl:template match="item">
        <li>Item {@id}, position: {position()}, attribute pos: {@pos}</li>
    </xsl:template>
    
</xsl:stylesheet>

A sample XML input is

<?xml version="1.0" encoding="UTF-8"?>
<items>
   <item id="i1" pos="1">
      <data>data 1</data>
   </item>
   <item id="i2" pos="2">
      <data>data 2</data>
   </item>
   <item id="i3" pos="3">
      <data>data 3</data>
   </item>
   <item id="i4" pos="4">
      <data>data 4</data>
   </item>
   <item id="i5" pos="5">
      <data>data 5</data>
   </item>
</items>

Full error message I get is

Error evaluating ((if(fn:position() gt 1) then ... else ..., ...)) in xsl:param/@select on line 13 column 79 of iterate-test5.xsl: SXST0060: Component cannot be streamed, although it is guaranteed streamable according to W3C rules. No streamable path found in expression ($current-item, ...) Component cannot be streamed, although it is guaranteed streamable according to W3C rules. No streamable path found in expression ($current-item, ...)

I can work around the problem by putting that template matching the map into a non-streamable mode and applying that when I push the map to the template but I would like to know whether the above should work or whether the streamability analysis failed to reject the approach.


Replies (1)

Getting SXST0060 "No streamable path found in expression" when trying to push a map with grounded nodes to a template of a streamable mode - Added by Community Admin over 5 years ago

Problem reproduced. Saved as XSLT3 test case si-fork-119. Entered as bug 3934.

I'm not currently sure whether this should be streamable or not. But the diagnostics in both 9.8 and 9.9 could be improved.

Michael Kay Saxonica

On 2 Oct 2018, at 10:41, Saxonica Developer Community wrote:

    (1-1/1)

    Please register to reply