Hi Markus,
Possibly the below is helpful to you
/Andy

declare function local:foo($item as array(*)){
  let $f:=$item(1)
  let $v:=$item(2)
  return array:for-each($v, function($q){ [$f,$q] }) ?*  
};

(["f", [1, 2, 3]], ["g", [4, 5]]) ! local:foo(.)

On Fri, 13 May 2022 at 11:47, Markus Elfring <Markus.Elfring@web.de> wrote:
Hello,

It seems that I am still not familiar enough with the programming language “XQuery”
for the quick specification of a bit of code for a general data processing task.
Thus I hope that the following use case can be clarified better.


A sequence like “(["f" [1 2 3]], ["g" [4, 5]])” might be an interesting test example.
It contains two nested arrays.

* One part refers to fixed data.

* Another part refers to some items with a varying number.


I would like to convert the varying items into a data representation like the following.

f,1
f,2
f,3
g,4
g,5


Can any customised functions help for the desired transformation?

Regards,
Markus