Page 1 of 1

stripping a text string to one character

Posted: Thu Sep 14, 2006 10:57 pm
by greenday45
hello...I am a complete noob to xslt and I need to know how to take a string of text and output it so only the first character is output. I've looked all over the web but I must not be searching for the right thing...Please help!!!!

Posted: Fri Sep 15, 2006 11:56 am
by sorin_ristache
Hello,

For example if you want to output the first character of the string value of the element elem you can use substring(elem, 1, 1) in an XPath expression (the select, test, etc. attributes). If you have a variable var that binds to the string you must use substring($var, 1, 1). Without knowing more about your input and output I cannot give you more help.


Regards,
Sorin