This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Regular expression functions (Was: Re: comments on Dece mber F&O draft)
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: "Hunsberger, Peter" <Peter dot Hunsberger at stjude dot org>
- Cc: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 11 Jan 2002 16:36:07 +0000
- Subject: Re: Regular expression functions (Was: Re: [xsl] comments on Dece mber F&O draft)
- Organization: Jeni Tennison Consulting Ltd
- References: <601F6322AD71D5118D6C0003472515290227981E@sjmemexc1.stjude.org>
- Reply-to: xsl-list at lists dot mulberrytech dot com
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