Oxygen XML Editor
 
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: RE: [xsl] Using parameter as regex in matches() function
From: "Houghton,Andrew" <houghtoa@xxxxxxxx>
Date: Thu, 29 May 2008 18:23:14 -0400

> From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
> Sent: Thursday, May 29, 2008 6:10 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> 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.


Current Thread
 
© 2002-2008 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy
This website was created & generated with <oXygen/> XML Editor
Keywords
xsl