xsl-list
[Top] [All Lists]

Re: [xsl] concatinating a varying number of whitespace characters

2008-03-19 10:30:24
string-join(for $i in 1 to $space-count return ' ' , '')

On Wed, Mar 19, 2008 at 8:10 PM, Michael Kay <mike(_at_)saxonica(_dot_)com> 
wrote:
The easiest way to do this is using substring. Create a string containing
 more space characters than you will ever need (40?), and then use
 substring($fortySpaces, 1, $n) to create a string of $n spaces.

 Michael Kay
 http://www.saxonica.com/



 > -----Original Message-----
 > From: Adil Ladhani [mailto:dillio(_at_)gmail(_dot_)com]
 > Sent: 19 March 2008 16:39
 > To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
 > Subject: [xsl] concatinating a varying number of whitespace characters
 >
 > Hi XSL gurus,
 >
 > I have a quick question about the concat() function. I need
 > to re-create a line from some XML, and the line should be of
 > the format:
 > <Type><whitespace><Tail>
 >
 > where <Type> and <Tail> are known, and the <whitespace> needs
 > to be detemined. <Tail> is always the same number of
 > characters (i.e. 17) and <Type> can vary in length. Since a
 > line is always 40 characters, I know that I need <Type> and
 > <whitespace> to add up to 23 chars.
 > Furthermore,  I know I can determine the number of whitespace
 > chars by subtracting string-length(Type) from 23 (which is 40
 > - length(tail)), but how can I use this within a concat?
 >
 > Sorry if this is unclear, I can clarify if necessary.
 >
 > Thanks,
 >
 > Adil
 >
 > --~------------------------------------------------------------------
 > XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
 > To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
 > or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
 > --~--
 >


 --~------------------------------------------------------------------
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
 To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
 or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
 --~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>