|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: String matching without regex
Marcel:
At 07:11 AM 1/31/2005, Jon wrote: I am a newbie as well, but have found some good tools from the XSLT Standard Library. http://xsltsl.sourceforge.net/ I'm not a newbie, and I think this is an excellent answer. Marcel, look at this, and also take a look at resources such as the XSL FAQ on strings, Sal Mangano's "XSLT Cookbook" (O'Reilly), maybe Jeni Tennison's "XSLT On the Edge". The reason your question is hard to answer is that the kind of processing you are asking about is somewhat outside what XSLT 1.0 is designed to do ("introspecting" into string values, not simply driving behavior from markup), and therefore involves a fair amount of what Tommie (the list owner) describes as "scratching your ear with your elbow". It's not impossible: you can use a combination of translate(), string-length(), string-before() and contains() to do it. But it's not pretty either. For example: to express "'.' followed by two digits" you first have to do something like translate($string,'#0123456789','-##########') to turn strings like "here's a #6 and a currency value $99.99" into "here's a -# and a currency value $##.##" -- then you can use contains() or substring($newstring, string-length($newstring - 3)) to find out if ".##" is in it, or ends it -- because XSLT 1.0 has no notion of what's a digit. It's all a little much to ask someone to write for free: a bit pesky, yet not terribly interesting either. But no one wants to give an unhelpful answer (so we don't). I hope that isn't totally useless. Check out the online resources: this kind of thing *has* been done before (and I've just given you some tips, despite myself). Cheers, Wendell
|
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
|

Cart








