Re: Regular expression functions (Was: Re: [xsl] comments on Dece mber F&O draft)

Subject: Re: Regular expression functions (Was: Re: [xsl] comments on Dece mber F&O draft)
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 11 Jan 2002 16:36:07 +0000
Hi Peter,

> I'm sort of barely able to keep up with it. I comfortable with both
> regexp and XSLT but I've never tried to marry the two. I guess my
> vision of regexp in XSLT is as a way of selecting nodes and not as a
> way of selecting strings. As such, I don't expect a way of tracking
> or naming substrings. If I want to manipulate substrings of the
> output document, then I'd expect to do that after the XSLT was done
> it's work, using the serialized output?

The kind of use case I see for getting the results of the match is if
you have a date in a nice localised format:

  <date>11th January, 2002</date>

and you wanted to convert this into an xs:date (2002-01-11).

Now you could do that with a lot of fiddly string manipulation
functions, but it would be a lot easier to create a regular
expression:

  ([0-9]{2}) (\w+), ([0-9]{4})

and use the results of the subexpression matches to give you the date,
month and year.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread