I have the following map:

```
let $input := map { 'a-key': 'a-value', 'b-key': ['b-value-1', 'b-value-2'] }

```

(the length of the `b-key` array can vary, or be absent; `a-key` can be present or absent)

I need to create the following array:

```
[ ('a', 'b', 'b'), 'a-value', 'b-value-1', 'b-value-2' ]

```

The number of `b`s in the first sequence should correspond to the number of `b-value`s.

I've tried just about every combination of iterating/map:for-each, etc., and the array either ends up with too much nesting or completely flat...

(n.b. the array is to be passed to a function -- not mine!-- using `fn:apply`, so needs to be in this form)