stripping a text string to one character

Here should go questions about transforming XML with XSLT and FOP.
greenday45
Posts: 1
Joined: Thu Sep 14, 2006 10:55 pm

stripping a text string to one character

Post 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!!!!
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post 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
Post Reply