- From: Dimitre Novatchev <dnovatchev@gmail.com>
- Date: Sat, 9 Jan 2021 09:25:49 -0800
- To: Michael Kay <mike@saxonica.com>
- Cc: public-xslt-40@w3.org
- Message-ID: <CAK4KnZdRVNNSgy+Jn8=jKq71=+6PwipF=FLH5XSfCN-ODSE5uQ@mail.gmail.com>
On Sat, Jan 9, 2021 at 8:38 AM Michael Kay <mike@saxonica.com> wrote:
> It seems a no-brainer to provide an XSLT instruction along the lines
>
>
>
. . . . .
> <xsl:for-each-member select="array" bind-to="member" position="pos">
> <xsl:if test="$pos ne 1">,</xsl:if>
> <xsl:for-each select="$member">
> ...
>
>
+1
> That's the way I would do it if it weren't so inconsistent with the way
> other things are done. Also, many arrays in practice have members that are
> single items (or perhaps zero-or-one items), and binding "." in those cases
> seems more intuitive.
>
> Another possibility is to bind "." to a zero-arity function that returns
> the current member: so to access the current member you write select=".()".
> Is that just too weird, or would people get used to it? The attraction is
> that it doesn't involve inventing any new machinery - no new functions, no
> additions to the dynamic context, and position() and last() work nicely.
>
> Related to this is how array construction works. I'm currently proposing
>
> <xsl:array>
> <xsl:for-each select="1 to 10">
> <xsl:array-member select=". * 2"/>
> </xsl:for-each>
> </xsl:array>
>
>
This seems very complicated and ugly.
Why not just:
<xsl:array select ="{expressionProducingAnArray}"/>
Thanks,
Dimitre
Received on Saturday, 9 January 2021 17:26:12 UTC