- From: Reece Dunn <msclrhd@googlemail.com>
- Date: Thu, 17 Dec 2020 20:24:22 +0000
- To: public-xslt-40@w3.org
- Message-ID: <CAGdtn24X06bjieEJ2MAshCq-rkGTMw+fzP7_=q6h2fW3fhdavA@mail.gmail.com>
Given the new `for member` syntax support for enumerating over the items in an array, it would be useful to have an easy way of enumerating over the key/value pairs in a map. This could be done through the same `for member` syntax, but the members for a map would be a 2-item sequence or a map of the key/value pairs in the map in an implementation-defined stable order. If the variant of this proposal to use a map for the key/value pairs is used, then given a map of type `map(K, V)` the member RecordTest would be `record(key as K, value as V)`. For a `map(*)` type, the member RecordTest would be `record(key, value)`. Combined with sequence/map/array decomposition, this would allow a user to write expressions like: for member ${key, value} in $map return ``[`{$key}`=`{value}`]`` It may be useful to have a different keyword to denote maps, such as `entry` like JavaScript and Java, or `item` like Python, but using `member` for both arrays and maps would be more consistent with the user wanting to enumerate over the content of those data structures. Kind regards, Reece
Received on Thursday, 17 December 2020 20:24:45 UTC