[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: count string-length without white-space and breaki

Subject: Re: count string-length without white-space and breaking if white-space exists after 126 characters
From: "Braumüller, Hans" <h.braumueller@xxxxxxxxxxxx>
Date: Fri, 21 Jun 2002 09:34:16 +0200
count string
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) &gt; 126)"> <br /></xsl:if>
> 
> (../memotext) &gt; 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) &gt; 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) &gt; 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.