Re: [xsl] Converting a sequence of xs:string to a map

Subject: Re: [xsl] Converting a sequence of xs:string to a map
From: "Michael Kay michaelkay90@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 12 Jan 2026 22:50:27 -0000
If you want an XSLT 3.0 solution rather than an XPath solution then you could
do

<xsl:map>
   <xsl:for-each select="$strings">
      <xsl:map-entry key="." select="position()"/>
   </xsl:for-each>
</xsl:map>

Michael Kay
Saxonica

> On 12 Jan 2026, at 20:53, Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> 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()

Current Thread