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

RE: count element content length

Subject: RE: count element content length
From: Jarkko.Moilanen@xxxxxx
Date: Tue, 16 Apr 2002 09:41:13 +0300 (EEST)
xsl len length
Lainaus Jarno.Elovirta@xxxxxxxxx:

> Heppa,
> 
> > Is there some method to count the elements content length and when 
> > for example the 20th character is met, then it would stop showing 
> > the rest and put ... after that. Because of my lowsy english, here
> > is one example:
> > 
> > elements content:
> > <Subject id="0000000002">Chattaamaan city chattiin ke klo 12</Subject>
> > 
> > the result should be:
> > <p>Chattaamaan city cha...</p>
> 
> <xsl:template match="Subject">
>   <p>
>     <xsl:value-of select="concat(substring(., 1, 20),'...')" />
>   </p>
> </xsl:template>
> 
> But you might want to consider breaking the string at word boundary

You are right, but I am not at that level yet =)
But hey! If I do like Santtu suggested, the result is a bit wrong since
it adds "..." also to elements that are shorter than 20 characters. What to do?

Cheers Jarkko

> 
> Cheers,
> 
> Santtu
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 



*******************************************************************
Jarkko Moilanen         *You are wise, witty, and wonderful,      *
Researcher/ ITCM        *but you spend too much time              *
jarkko.moilanen@xxxxxx  *reading this sort of trash.              *
www.uta.fi/~jm60697     *                                         *
GSM: +358 50 3766 927   *                                         *
*******************************************************************
* ITCM Information Technology and Crisis Management               *
*******************************************************************

 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.