This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Count no. of characters in xsl variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Count no. of characters in xsl variable" Watch "Count no. of characters in xsl variable" New topic
Author

Count no. of characters in xsl variable

Sunetra Saha
Ranch Hand

Joined: Feb 25, 2001
Posts: 77
Hi, can anybody tell me how to count the number of characters in an xslt variable? I need this so that I can truncate a string if its length exceeds a certain number.
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
You can use function string-length($varName)


Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Sunetra Saha
Ranch Hand

Joined: Feb 25, 2001
Posts: 77
Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Count no. of characters in xsl variable
 
Similar Threads
Number of characters per number of pixels
Problems with counting short and long words
Command to count the lines of code
Filling an ArrayList
Regular expression - count newline characters