Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xslt30] Streamable functions: streaming parameter used twice #15

Open
michaelhkay opened this issue Sep 14, 2020 · 1 comment
Open

Comments

@michaelhkay
Copy link
Contributor

michaelhkay commented Sep 14, 2020

Consider the function:

<xsl:function name="x" streamability="absorbing">
  <xsl:param name="p" as="element(*)*">
  <xsl:for-each select="$p">
    <xsl:variable name="i" select="position()"/>
    <xsl:value-of select="name($p[$i + 1])"/>
  </xsl:for-each>
</xsl:function>

This clearly isn't streamable, because it involves jumping around within the sequence $p more than once. But it seems to satisfy the streamability rules in the spec.

Most constructs don't allow more than one operand to be consuming. But xsl:for-each does. The streamability rules for xsl:for-each weren't written with streamable stylesheet functions in mind; it was assumed that if the select expression selected streamed nodes, the body of the xsl:for-each would process them one at a time, with only downward selections allowed.

So there's a rule missing: possibly a rule that the function body must contain at most one reference to the streaming parameter (with a caveat allowing use in multiple choice branches).

@michaelhkay
Copy link
Contributor Author

A possible fix is to say that if the declaration of a streaming parameter allows multiple nodes, then a variable reference (to the streaming parameter) that appears within a high-order operand of any construct is roaming and free-ranging.

rhdunn pushed a commit to rhdunn/qtspecs that referenced this issue Dec 17, 2020
Fix errors in stylesheet execution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant