Re: Processiing arrays in XSLT 4

That seems to be no better than

<xsl:for-each select="1 to array:size($array)">
   <xsl:variable name="member" select="$array(.)"/>

which you can do today, and which seems a rather clumsy solution to me. Surely iteratiing over the members of an array can be expressed more declaratively than this?

Michael Kay
Saxonica

> On 9 Jan 2021, at 21:15, Liam R. E. Quin <liam@fromoldbooks.org> wrote:
> 
> On Sat, 2021-01-09 at 16:38 +0000, Michael Kay wrote:
>> It seems a no-brainer to provide an XSLT instruction along the lines
>> 
>> <xsl:for-each-member select="array">
>>   ....
>> </xsl:for-each>
>> 
>> to process the members of a supplied array.
>> 
>> The question is: within the body of this instruction, how should one
>> refer to the current member of the array?
> 
> How about,
> <xsl:at-each-member at="pos" select="array" as="xs:integer*">
>  <!--* now $pos is avaiable as type xs:integer* *-->
> and do the same for for-each
> ?
> 
> Liam
> 
> -- 
> Liam Quin, https://www.delightfulcomputing.com/
> Available for XML/Document/Information Architecture/XSLT/
> XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
> Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org
> 
> 

Received on Saturday, 9 January 2021 21:56:08 UTC