[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: is there a String indexOf() function in Xpath?
> Want to do something like this... > substring($titleText, > indexOf($titleText, ' findThisTextsIndex ')+5 , > indexOf($titleText, 'toHere') ) > An index of function would be nice, but it's not clear it's needed. Perhaps a description of your problem would be more helpful then what you are trying to do. In any case, I'll give it a stab below. Why not just do some combination of substring, substring-before and substring-after? I'm going to create an entirely fictional example I have some string of characters that contain two indicators of a special sequence of text, START and END. In addition, there are always five characters after START that are always the same. (It may be you're using the +5 to try to avoid the starting characters, but who knows since you didn't give us that information.) Example string: It was a dark and stormy night START00123Needs a little more punch, how about it was a very, very dark and very, very stormy nightEND which would be the night of a most... substring-after(TheString,"START") gives us everything after START ie 00123Needs a little more punch, how about it was a very, very dark and very, very stormy nightEND which would be the night of a most... substring(substring-after(TheString,"START"),6) gives us the string starting with the 6th character after START Needs a little more punch, how about it was a very, very dark and very, very stormy nightEND which would be the night of a most... substring-before(substring(substring-after(TheString,"START"),6),"END") gives us the string starting with the 6th charcter after START but before END Needs a little more punch, how about it was a very, very dark and very, very stormy night Is that something like what you're looking for? Jon Gorman ps. Feels like I'm abusing substring-after and substring-before lately and it's been a while since I've even used them in my own code.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|