Re: [xsl] xsl:for-each is not a loop <-- right?

Subject: Re: [xsl] xsl:for-each is not a loop <-- right?
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 Feb 2025 23:04:37 -0000
On Thu, 20 Feb 2025 at 22:12, Roger L Costello costello@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Folks,
>
> Suppose that I create a parameterized boolean function which tests its
> parameter to see if it is greater than zero:
>
> <xsl:function name="f:GT_Zero" as="xs:boolean">
>     <xsl:param name="value"/>
>     <xsl:sequence select="$value gt 0"/>
> </xsl:function>
>
> I call it with a list of values:
>
> <xsl:sequence select="f:GT_Zero(1)"/>
> <xsl:sequence select="f:GT_Zero(2)"/>
> <xsl:sequence select="f:GT_Zero(3)"/>
>
> Here is a shorthand for that:
>
> <xsl:for-each select="(1,2,3)">
>     <xsl:sequence select=". gt 0"/>
> </xsl:for-each>
>
> xsl:for-each is not a loop.
>

that depends how you define loop.


>
> xsl:for-each is a shorthand for applying an expression to each item in a
> list.
>

that's one way to define a loop


>
> In this example, the Boolean expression $value gt 0 is applied to each
> item in the list (1, 2, 3).
>
> Do you agree?


Not really.


>
> /Roger

Current Thread