This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
I could not find a place where to register my desire for map:map in xquery/xpath so I entered here ... apologies if this is a dupe, etc. I have been using Saxon and MarkLogic implementation of map:map for the past few months and am convinced of its usefulness. some adhoc usage scenarios; controller: keeping routing in memory makes things zippy, and a very common map for me nowadays is one where the keys are uri's and values whatever I need (think url rewriting) or even functions to be passed ala HOX (higher order xquery) memoize: maps makes it easy to provide inline func caching ala https://gist.github.com/954816 working with json: maps make life a bit easier in this respect there are more ....
XQuery and/or XPath need either a map or a nested sequence. An extremely common use case is to load a coded value map which is used across a complex xquery program. Today you need to put this into an XML object and use xpath hoping it is optimized. By providing either a map or a nested sequence then processors have the necessary hints to optimize the access. These are actually subtly 2 separate use cases. Maps: provide a guaranteed (or at least implied) efficient mapping of key->value pair for xquery processors. Example: mapping codes to values. (say ICD9 codes to descriptions. So instead of of using collection("IDC9")/value[@code eq 'value'] you could preload the map so you could use map:map( $icd9 , 'value' ). Agreed this is primarily a hint to optimizers. In theory any implementation should be able to index arbitrary XML as maps. But in practice it is very difficult and rarely done. As for sub-sequences. This is a similar but not identical problem. Maps *could* be implemented as sub-sequences such as ( "key" , ( "value1" , "value2" , "value3" ) , "key2" ,( "value1" , "value2" , "value3" ) ) but this requires a major change in xquery semantics which would be not backwards compatible. I feel that sub-sequences should have been implemented from the start (aka Lisp) but as they were initially flattened into single level sequences it may be a hard step to implement them without backwards comparability problems. A Map as a top level object would solve most sub-sequence use cases without backwards compatibility problems.
*** This bug has been marked as a duplicate of bug 11493 ***