xsl-list
[Top] [All Lists]

RE: [xsl] Using parameter as regex in matches() function

2008-05-29 15:23:46
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com]
Sent: Thursday, May 29, 2008 6:10 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Using parameter as regex in matches() function

You want

matches(., concat('^', $criteria_name, '$'))

Assuming that $criteria_name doesn't include any regular expression meta 
characters.  Unfortunately, XSL doesn't have the Perl equivalent of quotemeta() 
built into the library.  Certainly you can write a replace() to do it and 
create a quotemeta() function to wrap it, but it would have been nice to say:

matches(.,concat('^',quotemeta($criteria_name),'$'))


Andy.



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>