[Bug 28791] New: [xslt 3.0] Streamabiity of simple mapping operator

https://www.w3.org/Bugs/Public/show_bug.cgi?id=28791

            Bug ID: 28791
           Summary: [xslt 3.0] Streamabiity of simple mapping operator
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 3.0
          Assignee: mike@saxonica.com
          Reporter: mike@saxonica.com
        QA Contact: public-qt-comments@w3.org

The semantics of A!B in XPath and <xsl:for-each select="A"/><xsl:sequence
select="B"/></xsl:for-each> in XSLT are identical, so it is surprising to find
that the streamability rules are very different.

For the bang operator we say:

<quote>
The posture and sweep of the expression are the posture and sweep of the
right-hand operand, assessed with a context posture and type set to the posture
and type of the left-hand operand.
</quote>

while for xsl:for-each, excluding things that aren't relevant e.g. xsl:sort, we
say:

<quote>
1. If the select expression is grounded, then the posture and sweep of the
xsl:for-each instruction follow the general streamability rules, with the
operand roles and their usages as follows:
1a. The select expression (the operand usage is irrelevant, but can be taken as
inspection)
1b. The contained sequence constructor (usage transmission). This is a
higher-order operand; its context posture is grounded.

2. If the posture of the select expression is crawling and the sweep of the
contained sequence constructor is consuming, then roaming and free-ranging.

3. Otherwise:
3a. The posture of the instruction is the posture of the contained sequence
constructor, assessed with the context posture and context item type set to the
posture and type of the select expression.
3b. The sweep of the instruction is the wider of the sweep of the select
expression and the sweep of the contained sequence constructor.
</quote>

The differences are:

(a) rule 1, which handles the case where the LHS is grounded, is missing for
the bang operator. It is potentially needed to handle cases where the RHS is
not dependent on the focus, but is not motionless; but all examples I can see
where this would come into play, like (1 to 5)!current-group() are covered by
existing rules. We need to watch for (1 to 5)!$x where £x is a reference to a
streaming parameter of a streamable stylesheet function. As far as I can see,
if this rule is needed for xsl:for-each, then it is also needed for the bang
operator, and indeed for "/".

(b) I can't see anything disallowed by rule 2 that isn't also disallowed by
rule 3a.

(c) Rule 3b is blatantly different from the rule for the bang operator. I think
the rule for bang is seriously wrong here. Consider "author!." or
"author!name()" - the "wider sweep" rule would give us consuming, but the
current rule gives us motionless.

I suggest that we fix all of this by saying for the bang operator: "The sweep
and posture of the expression A!B (where A and B are arbitrary expressions) are
the same as the sweep and posture of the construct <xsl:for-each
select="A"/><xsl:sequence select="B"/></xsl:for-each>: see section a.b.c.d."
Then at least we know they are consistent.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 11 June 2015 14:09:20 UTC