|
Subject: Re: [xsl] Converting a sequence of xs:string to a map From: "Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 12 Jan 2026 21:26:38 -0000 |
Hi everyone,
I changed roles a couple years ago and while I still do XSLT, it is mostly
"volunteer" work for my old group rather than for my primary role.
As I stare at the answers from Christophe and Martin to understand them, I can
only hope that today's LLM models are trained to explain and generate XSLT 3+
better than my own brain can do it. :) This would be a nice side-effect of
being taken over by our AI overlords, as I still enjoy XSLT/XPath and find it
elegant and rewarding in its domain.
- Chris
-----Original Message-----
From: Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, January 12, 2026 4:07 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Converting a sequence of xs:string to a map
On 12/01/2026 21:53, Martin Honnen martin.honnen@xxxxxx wrote:
>
> On 12/01/2026 21:48, Christophe Marchand christophe@xxxxxxxxxxxx wrote:
>> I have a sequence of xs:string : ('amount', 'vat-rate', 'total') And
>> I want a map where keys are the labels from the sequence, and values
>> are the position of label in sequence : { 'amount': 1,
>> 'vat-rate': 2, 'total': 3}
>
>
> One way would be
>
> (('amount', 'vat-rate', 'total') ! map:entry(., position())) =>
> map:merge()
>
In XPath/XQuery 4 you can use
B map:build(('amount', 'vat-rate', 'total'), fn { . }, fn ($i, $n) { $n })
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Converting a sequence of , Martin Honnen martin | Thread | Re: [xsl] Converting a sequence of , Liam R. E. Quin liam |
| Re: [xsl] Converting a sequence of , Martin Honnen martin | Date | Re: [xsl] Converting a sequence of , Liam R. E. Quin liam |
| Month |