[Bug 29153] [XSLT30] have we created a loop-hole with windowed streaming and copy-of or snapshot?

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

--- Comment #5 from Abel Braaksma <abel.braaksma@xs4all.nl> ---
> "a value comparison or general comparison is allowed if one operand is 
> position() and the other is last()" is easy enough to state,

Yes, I think you are right. Unfortunately, while pondering over it again, I
think it cannot be done (I hope to be wrong though) because of accumulators.
Consider:

<xsl:accumulator name="count" initial-value="0">
    <xsl:accumulator-rule match="*" select="$value + 1" />
</xsl:accumulator>

<xsl:template match="/">
    <xsl:for-each select="*/special/copy-of()">
        <xsl:if test="position() = last()">
            <last>{accumulator-after()}</last>
        </xsl:if>
        <xsl:if test="position() != last()">
            <elem>accumulator-after()</elem>
        </xsl:if>
    </xsl:for-each>
</xsl:template>

If the input stream is something like:

<root>
  <special />
  <foo />
  <special />
  <foo />
  <foo />
  ... 1000's more w/o special ...
  <foo />
  <special />
</root>

Then the output should be something like:

<elem>2</elem>
<elem>4</elem>
<last>2038543</last>

However, upon visiting each <special>, the input stream must proceed to the
next <special> to peek whether or not the element is the last in the selection.
By doing so, the accumulator function is called, leading to a different
outcome, something like:

<elem>4</elem>
<elem>2038543</elem>
<last>2038543</last>

With non-streaming, this is not a problem, but with streaming, we lose the
accumulator value after visiting the node, to prevent that we have to keep
track of each and every accumulated value along the way (iirc).

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

Received on Wednesday, 30 September 2015 02:11:53 UTC