xslt - XSL substring and indexOf -


i'm new xslt. wonder if possible select substring of item. i'm trying parse rss feed. description value has more text want show. i'd subtring of based on index of substring. basically, want show result of substring call passing indxof('some_substring') , length parameters. possible?

from comments:

i want select text of string located after occurrence of substring

it's not clear want index of substring [update: clearer - thanks] may able use function substring-after or substring-before:

substring-before('my name fred', 'fred') 

returns 'my name '.

if need more detailed control, substring() function can take 2 or 3 arguments: string, starting-index, length. omit length whole rest of string.

there no index-of() function strings in xpath (only sequences, in xpath 2.0). can use string-length(substring-before($string, $substring))+1 if need position.

there contains($string, $substring). these documented here. in xpath 2.0 can use regular expression matching.

(xslt uses xpath selecting nodes , processing values, more of xpath question. tagged thus.)


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -