Re: [xsl] A beautiful way to populate a variable with N blanks?

Subject: Re: [xsl] A beautiful way to populate a variable with N blanks?
From: "Toshihiko Makita tmakita@xxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 24 Feb 2023 14:59:18 -0000
How about the following?

<xsl:variable name="blanks" as="xs:string" select="string-join(for $i in 1 to $N return (' '), '')"/>

On 2/24/2023 11:44 PM, Roger L Costello costello@xxxxxxxxx wrote:
Hi Folks,

$N contains an integer.

$blanks is a string variable. The string is to consist of $N blanks (space characters).

Below is one way to populate $blanks. It's an awful solution. Is there a beautiful (simple) solution?

<xsl:variable name="tmp" as="xs:string+">
     <xsl:sequence select="''" />
     <xsl:sequence select="for $i in 1 to $N return (' ')"/>
</xsl:variable>

<xsl:variable name="blanks" as="xs:string">
     <xsl:value-of select="$tmp" separator=""/>
</xsl:variable>


Toshihiko Makita
Antenna House, Ina Branch.

Current Thread