W3C home > Mailing lists > Public > public-xslt-40@w3.org > January 2021

Re: Processiing arrays in XSLT 4

From: Liam R. E. Quin <liam@fromoldbooks.org>
Date: Sat, 09 Jan 2021 17:38:35 -0500
Message-ID: <fa1dd30b754a3a12bcbe856b35004f5088082cbc.camel@fromoldbooks.org>
To: Michael Kay <mike@saxonica.com>, public-xslt-40@w3.org
On Sat, 2021-01-09 at 21:55 +0000, Michael Kay wrote:
> 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?

Strictly speaking we are still no more nor less declarative :) but it
seems less clumsy to allow users to declare $pos than to have it
imposed on them (as in try/catch).

It also feels closer to,
  for $i at $pos in $sequence
in XQuery.

(i'd like "at $pos" in XPath as it saves having to put position() in a
temporary variable and avoids the error of trying to use it in

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 22:39:11 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 January 2021 22:39:11 UTC