Re: Processiing arrays in XSLT 4

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
predicates)

-- 
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