[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
Hi Chiris > That being said, I still enjoy seeing clever uses of the "!" operator! Yes, I also agreed! On 2/25/2023 12:05 AM, Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx wrote: > Hi Makita-san, > > > > That is the form I was about to post too. Martin's suggestion is a novel use of the "!" operator, but my OCD seems to not like generating data that is never meaningfully used. Although longer, I feel the "for" loop's intent is a bit easier for future novices to follow. > > > > That being said, I still enjoy seeing clever uses of the "!" operator! > > > > - Chris > > > > -----Original Message----- > > From: Toshihiko Makitatmakita@xxxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> > > Sent: Friday, February 24, 2023 9:59 AM > > To:xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > Subject: Re: A beautiful way to populate a variable with N blanks? > > > > 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 Costellocostello@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. > > > > > > > -- tys125fToshihiko Makita Development Group. Antenna House, Inc. Ina Branch tmakita@xxxxxxxxxxxxx 8077-1 Horikita Minamiminowa Vil. Kamiina Co. Nagano Pref. 399-4511 Japan Tel +81-265-76-9300 Fax +81-265-78-1668 http://www.antenna.co.jp/ http://www.antennahouse.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|