What would be the most readable way to parse a URL query string into a { 'param': 'value' }
map in XSLT/XPath 3.0?
Note: this is the inverse function of the one described in Building a URL query string from a map of parameters with XPath.
Update: I neglected to mention that the function should support multi-value parameters such as a=1&a=2
, and ideally parse them as an xs:string*
sequence.
In order to support multiple values, you could can apply the $options parameter specifying what to do with
duplicates
: