RE: [xsl] creating a string of repeated charactors

Subject: RE: [xsl] creating a string of repeated charactors
From: "Tim Watts" <timw@xxxxxxx>
Date: Mon, 16 Jul 2001 17:20:52 +1000
Thanks Jim,

for the link to

It seems that repeating charactors isn't a part of XSLT at this stage - not
as a function

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.


For others interested, but don't feel like checking the links, the template

<xsl:stylesheet version="1.0"
xmlns:str=""; extension-element-prefixes="str">
  <xsl:template name="str:padding">
  <xsl:param name="length" select="0" />
  <xsl:param name="chars" select="' '" />
      <xsl:when test="not($length)" />
      <xsl:when test="string-length($chars) >= $length">
        <xsl:value-of select="substring($chars, 1, $length)" />
        <xsl:call-template name="str:padding">
          <xsl:with-param name="length" select="$length" />
          <xsl:with-param name="chars" select="concat($chars, $chars,
$chars)" />

-----Original Message-----
From: cutlass

there are many ways of doing this, try looking at the link below

here is the link to the xslt template u may use

u can directly use this individual template by either cutting and pasting or
xsl:import ( u have to remember to either use the correct namespace if
importing ).

----- Original Message -----
From: "Tim Watts" <timw@xxxxxxx>
To: "XSL Mailing List (E-mail)" <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, July 16, 2001 5:10 AM
Subject: [xsl] creating a string of repeated charactors

> I'm sure this must be a simple command, but how would something like a
> string of 8 charactors be output in XSLT.
> In ASP it might look something like
> String(8, "*")

 XSL-List info and archive:

Current Thread