[Bug 29080] New: array:members

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

            Bug ID: 29080
           Summary: array:members
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 3.2 Use Cases and Requirements
          Assignee: jonathan.robie@gmail.com
          Reporter: christian.gruen@gmail.com
        QA Contact: public-qt-comments@w3.org
  Target Milestone: ---

People are frequently asking us how to iterate through array entries. A future
helper function "array:members" would be convenient, which wraps each array
member into a new array:

Example query:

  (: Current representation in XQuery :)
  declare function array:members(
    $array as array(*)
  ) as array(*)* {
    for $i in 1 to array:size($array)
    return [ $array($i) ]
  };

  let $array := [ 1 to 2, 3, () ]
  for $member in array:members($array)
  return <hit>{ $member }</hit>

Result:

  <hit>1 2</hit>
  <hit>3</hit>
  <hit/>

A similar function could be provided for map entries.

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

Received on Monday, 24 August 2015 13:55:26 UTC