W3C home > Mailing lists > Public > public-qt-comments@w3.org > February 2014

[Bug 24534] New: Streamability of the following-sibling axis with numbered predicates

From: <bugzilla@jessica.w3.org>
Date: Wed, 05 Feb 2014 21:41:53 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-24534-523@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=24534

            Bug ID: 24534
           Summary: Streamability of the following-sibling axis with
                    numbered predicates
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 3.0
          Assignee: mike@saxonica.com
          Reporter: abel.braaksma@xs4all.nl
        QA Contact: public-qt-comments@w3.org

Currently, the following-sibling axis is not streamable at all when applied to
a streamable node. However, I think we can apply the same rules as for path
expressions here if (and only if?) there is a predicate that is numeric.

We already define the notion of a numeric predicate, so we could reuse that.

It is quite easy to recognize this is streamable. Consider a counter-example
first:

<xsl:template match="foo">
  <xsl:apply-templates select="following-sibling::bar" />
</xsl:template>

<xsl:template match="bar">
   <xsl:copy-of select="following-sibling::bar" />
</xsl:template>

This example is clearly _not_ streamable, because it travels the same nodes
multiple times because of the two select statements using an unspecified
following-sibling axis.

However, if we change it to use numeric predicates, this changes drastically:

<xsl:template match="foo">
  <xsl:apply-templates select="following-sibling::bar[1]" />
</xsl:template>

<xsl:template match="bar">
   <xsl:copy-of select="following-sibling::bar[2]" />
</xsl:template>

Now there is no potential for overlap. And it doesn't matter what positive
numeric value is used, as it will always select only one following-sibling
node.

The same does not apply to the following axis, in which case there can be
overlapping nodes even when using numeric predicates as above.

There's a page by Michael Kay that I currently cannot find that mentions a
similar scenario to be streamable in the Saxon processor. Not sure his scenario
required the numeric predicate. I think it worthwhile to investigate whether we
can add this to our toolset of streamable expressions, because it covers quite
a few use-cases.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Wednesday, 5 February 2014 21:41:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:45 UTC