This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates 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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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.
 
Consider Paul's rocket mass heater.
 
subject: Count no. of characters in xsl variable