RE: [xsl] Re: RE: creating a string of repeated charactors

Subject: RE: [xsl] Re: RE: creating a string of repeated charactors
From: "Tim Watts" <timw@xxxxxxx>
Date: Tue, 17 Jul 2001 11:12:43 +1000
Thanks Dimitre,

for the more terse code.

Unfortumatly I do not know the max value (N) so the code won't be usefull
for me this time.

Also, just one small error in the code... the select in

<xsl:variable name="maxString" select="*************"/>
should be
<xsl:variable name="maxString" select="'*************'"/>
---------------------------------------^-------------^

or it is going to look for an element called *************

Cheers,

Tim ;)

-----Original Message-----
From: Dimitre Novatchev

Tim Watts wrote:

[snip]

> The EXSLT function <xsl:value-of select="str:padding(10, '*')" /> function
> is the sort of thing I hoped might exist in *standard* XSLT.
>
> Since there isn't I'll use the template that you pointed me to instead.
> (Thanks for saving me from writing it! :) )
>
> I was hoping that there might me a less verbose way of doing what really
is
> quite a simple task.

This template is "verbose" by necessity -- it solves the ***general*** case,
when
neither the filling characters, nor an upper limit for the length are known
in
advance.

It is also quite space-consuming (and time) -- because the string length is
doubled
until a larger string is constructed, this will use twice as much memory, as
necessary for the resulting string.

In many cases one knows in advance that he'll only need a string of upto N
characters.

[snip]

Cheers,
Dimitre Novatchev.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread