[Bug 16034] New: [QT3] extvardef-016a & 016b

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

           Summary: [QT3] extvardef-016a & 016b
           Product: XPath / XQuery / XSLT
           Version: Member-only Editors Drafts
          Platform: PC
               URL: https://www.w3.org/XML/Group/qtspecs/specifications/xq
                    uery-30/html/xquery-30.html#id-context-item-declaratio
                    ns
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 3 & XPath 3 Test Suite
        AssignedTo: benjie.nguyen@gmail.com
        ReportedBy: tim@cbcl.co.uk
         QAContact: public-qt-comments@w3.org


I can't see anything in the specification to justify the expected behaviours of
test extvar-def-016a & 016b.  Specifically, I'm looking at text in 4.17 Context
Item Declaration.

extvar-def-016a:

        declare variable $y :=
(<a>1</a>,<a>2</a>,<a>3</a>,<a>4</a>,<a>5</a>,<a>6</a>,<a>7</a>,<a>8</a>,<a>9</a>,<a>10</a>);
        declare context item := $y[3];
        declare variable $x external := fn:position();
        $x

The test expects fn:position() to be 3.  While I can see where the expected
result comes from (the context item points to the third item in $y), I can find
no text which persuades me that evaluating $y[3] leaves the formatl semantics
variable $fs:position as 3.

extvar-def-016b:

        declare variable $y :=
(<a>1</a>,<a>2</a>,<a>3</a>,<a>4</a>,<a>5</a>,<a>
6</a>,<a>7</a>,<a>8</a>,<a>9</a>,<a>10</a>);
        declare context item := $y;
        declare variable $x external := fn:last();
        $x

The test expects fn:last() to be 10.  Again, it's clear where this expected
result comes from (count($y)), but I can find no text which leads me to believe
that assigning $y to the context item will leave the formatl semantics variable
$fs:last as 10.

This test also contains a type check error.  The context item's type may only
be an ItemType, i.e. quantifier 1.  In this test, $y is bound to a sequence of
10 elements.  Therefore evaluating the context item would result in a type
check error.  Thus this query should expect XPTY0004.

I believe that in the above, fn:position() and fn:last() can only ever return 1
(if the context item is defined) or raise an error (if the context item is not
defined).

However, since the query doesn't require the evaluation of the context item, it
may also expect 1.  Perhaps it might be preferable to consider the context item
as undefined, and therefore fn:last() would raise XPDY0002.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Monday, 20 February 2012 17:03:35 UTC