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

[Bug 29161] New: [XSLT30] setting the context size with xsl:apply-templates during streaming

From: <bugzilla@jessica.w3.org>
Date: Wed, 30 Sep 2015 01:45:15 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-29161-523@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=29161

            Bug ID: 29161
           Summary: [XSLT30] setting the context size with
                    xsl:apply-templates during streaming
           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
  Target Milestone: ---

We write in 6.3 Applying Template Rules:

<quote>
The rule that matches the Nth item in the sorted sequence is evaluated with
that item as the context item, with N as the context position, and with the
length of the sorted sequence as the context size.
</quote>

With streaming, we won't be able to set the context size without look-ahead.

This does not matter with patterns (they cannot access the context size of the
match selection), but it matters to template bodies. There are essentially two
issues here:

1) Using the context-size with windowed streaming (bug 29153)
2) Setting the context-size during normal streaming.

Example of (1):

<xsl:template match="/">
    <xsl:apply-templates select="*/copy-of(foo)" mode="no-stream" />
</xsl:template>

<xsl:template match="foo" mode="no-stream">
    <xsl:value-of select="last()" />
</xsl:template>

Example of (2):

<xsl:template match="/">
    <xsl:apply-templates select="*" />
</xsl:template>

In the second example, we cannot access the fn:last() function without penalty,
but the prose in the spec still mentions that we should set the context size,
which is not possible. In fact, the context size is undefined while applying
templates while streaming.

I am not sure how to fix this for situation (1). I don't see a simple way to
statically determine the use of fn:last() in a non-streaming mode that is
accessed by windowed streaming.

One solution might be to define that the context size is not available until
the last item is processed (to allow for the use-case from bug 29153). Another
solution is to always raise a dynamic error, or a static if possible (which
follows from the fact that the size of the input stream is not known).

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Wednesday, 30 September 2015 01:45:19 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 30 September 2015 01:45:22 UTC