[Bug 24385] New: Unclarity in last-line resolution for fn:unparsed-text-lines()

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

            Bug ID: 24385
           Summary: Unclarity in last-line resolution for
                    fn:unparsed-text-lines()
           Product: XPath / XQuery / XSLT
           Version: Proposed Recommendation
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XPath 3.0
          Assignee: jonathan.robie@gmail.com
          Reporter: abel.braaksma@xs4all.nl
        QA Contact: public-qt-comments@w3.org

The last sentence under fn:unparsed-text-lines() [1] reads:

"but if the external resource ends with a newline sequence, no zero-length
string will be returned as the last item in the result."

and the example given is:

fn:tokenize(fn:unparsed-text($href), '\r\n|\r|\n')[not(position()=last() and
.='')]

The explanation and the example create a slight ambiguity when dealing with
multiple empty lines at the end of the input. The text seems to imply that
empty lines are removed, i.e. "no zero-length string will be returned as the
last item in the result". But the normative code snippet only strips the last
empty line.

We've currently implemented this to only strip at most one line from the end,
if it is empty. I think this is correct. But another interpretation of the
above may mean that all empty lines at the end should be removed.

This also raises the question on the corner case of input consisting solely of
empty lines. From the example code, zero or one empty line will return the
empty sequence, more empty lines will return a sequence of empty strings, one
less than the number of empty lines in the input.

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

Received on Friday, 24 January 2014 16:33:23 UTC