W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2015

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

From: <bugzilla@jessica.w3.org>
Date: Wed, 30 Sep 2015 02:11:47 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-29153-523-5QwKLCg7DY@http.www.w3.org/Bugs/Public/>

--- 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.

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

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

If the input stream is something like:

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

Then the output should be something like:


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:


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

This archive was generated by hypermail 2.3.1 : Wednesday, 30 September 2015 02:11:54 UTC