[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: String matching without regex

Subject: RE: String matching without regex
From: Marcel Stör <marcel@xxxxxxxxxxxxxx>
Date: Tue, 1 Feb 2005 00:15:22 +0100
xslt string match
Wendell Piez <mailto:wapiez@xxxxxxxxxxxxxxxx> wrote:
> 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).

It's not useless at all - very helpful. I knew the code to achieve what I
need would probabely turn out to be very ugly. I didn't expect it to be that
bad, though ;-)
Although I'm knew to XSLT I'll go down that road.

Regards,
Marcel

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.