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

Re: Processiing arrays in XSLT 4

From: Mukul Gandhi <gandhi.mukul@gmail.com>
Date: Mon, 11 Jan 2021 12:29:39 +0530
Message-ID: <CABuuzNMn=hbrYE7BwUofPZkhfZE9_uLbrWOATLN+U5+9cwyKTQ@mail.gmail.com>
To: Michael Kay <mike@saxonica.com>
Cc: public-xslt-40@w3.org
On Sat, Jan 9, 2021 at 10:08 PM 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">
>   ....
> </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?
>
> Recall that a member of an array can be any sequence, not just a single
> item.
>

I think that, we could even utilize following XSLT idiom for this,

<xsl:for-each select="array">
     <xsl:choose>
           <xsl:when test="count(.) gt 1">
                <!-- multi item array member. do something -->
           </xsl:when>
           <xsl:otherwise>
                <!-- do something -->
           </xsl:otherwise>
     </xsl:choose>
</xsl:for-each>



-- 
Regards,
Mukul Gandhi
Received on Monday, 11 January 2021 07:00:08 UTC

This archive was generated by hypermail 2.4.0 : Monday, 11 January 2021 07:00:09 UTC