[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: A beautiful way to populate a variable with N blan

Subject: Re: A beautiful way to populate a variable with N blanks?
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 24 Feb 2023 14:48:35 -0000
Re:  A beautiful way to populate a variable with N blan
Am 2/24/2023 um 3:44 PM schrieb Roger L Costello costello@xxxxxxxxx:
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>


I would think using a select attribute e.g.

B <xsl:param name="blanks" select="string-join((1 to $N)!' ', '')"/>

is more appropriate than using a nested xsl:param/xsl:value-of.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.