This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: count string-length without white-space and breaking if white-space exists after 126 characters
- From: "Braumüller, Hans" <h dot braumueller at hanseorga dot de>
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 21 Jun 2002 09:34:16 +0200
- Subject: Re: [xsl] count string-length without white-space and breaking if white-space exists after 126 characters
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi,
thanks David and Vavu.
I prefer the solution of David, because it is shorter.
Now it put´s the <br /> after 126 characters.
How can i test, when after 126 characters comes a white-space to put the <br
/>
element, to avoid :
word10 word11 resulting in wor<br>d10 word11
--------------------------------------------^----------------------
------ this is character 126 -------^
but i want
word10<br>word11
The text-node from memotext is always different, depending on the request.
Thanks,
Hans Braumüller
>
>
>
> <xsl:if test="string-length((../memotext) > 126)"> <br /></xsl:if>
>
> (../memotext) > 126
>
> will take the string value of that element convert it to a number
> (probably getting NaN) and then compare with 126
>
> so this is probably false
>
> string-length((../memotext) > 126)
>
> first converts its argument to a string, "false" and then takes its
> length so this is 5
>
> using a number in a test attribute it's true if the number isn't zero.
>
> You have the brackets in the wrong place...
>
> test="string-length(../memotext) > 126">
>
> David
>
> _____________________________________________________________________
> This message has been checked for all known viruses by Star Internet
> delivered through the MessageLabs Virus Scanning Service. For further
> information visit http://www.star.net.uk/stats.asp or
> alternatively call
> Star Internet for details on the Virus Scanning Service.
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list