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

[Bug 29080] New: array:members

From: <bugzilla@jessica.w3.org>
Date: Mon, 24 Aug 2015 13:55:23 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-29080-523@http.www.w3.org/Bugs/Public/>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:55 UTC