[Bug 5672] Evaluation of treat as

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5672

           Summary: Evaluation of treat as
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: tim@cbcl.co.uk
         QAContact: public-qt-comments@w3.org


Could you please clarify the behaviour of treat as.  Consider the query:

declare function local:result($values as xs:integer*)
{
  if ( current-date() eq xs:date('2008-12-31') )
  then $values[4]
  else $values[position() lt 4]
};

let $input := ( (1, 2, 3, 'four') treat as xs:integer* ) return
  local:result($input)

Is 'treat as' required to check its input argument in one go,
or is it permissible to evaluate it as items from its result sequence are used?
 So in this example, is the query only guaranteed to fail with XPDY0050 on
2008-12-31, or should it always fail?

Received on Thursday, 1 May 2008 08:16:37 UTC