[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Sort List of Maps By Key Value
Using XPath 3 maps: I have a list of maps where all the maps have a key on whose value I want to sort the list of maps. Brute force I can do: let $sortedKeys := $maps ! map:get(., 'sortonme') => sort() for $key in $sortedKeys let $key := . let $map := $maps ! if (map:get(., 'sortonme') eq $key) then . else () return func:operate-on-map($map) But this seems unnecessarily brutish. I'm still trying to get my head around how to use the "?" operator as well as functional mappings and whatnot. So is there a more compact or clearer way to order a set of maps based on an order applied to the values of a given entry that exists in each map? Thanks, Eliot -- Eliot Kimber http://contrext.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|