|
[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?
Hi Michael, > You don't need substring() to implement index-of(). To expand DC's response, > here it is: I don't think I was clear in my warning. The original poster wanted an index-of() to do the below (from his original post): >Want to do something like this... >substring($titleText, >indexOf($titleText, ' findThisTextsIndex ')+5 , >indexOf($titleText, 'toHere') ) I was just pointing out that he might get unexpected results if he created a function and used it in the manner he originally posted, without accounting for the fact that call to substring would be wrong since the third argument of substring is length, not index of the start of the terminating pattern. That's why I mentioned difference (haven't done a lot of function building in XSLT 2.0 so you'll just have to accept the pesuedo-code. Sorry, but I'm planning on playing around more whenever I get another free weekend). If you have the function eg:index-of, you'll still need the second that takes in the third argument as the index-of the string instead of the length. Ie if this was some method substring-using-indexes(string,start_index,end_index) { return substring(string,start_index, end_index - start_index); } or something along those lines (might have a off by one here, trying to cook dinner and answer email at the same time ;) ). Jon Gorman
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Cast Your Vote
We need your help – Vote for DataDirect XML Products!
Winners and finalists announced at SOA World Conference in November. 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
|







