Re: [xsl] Using XSL variable in XQuery regular expression

Subject: Re: [xsl] Using XSL variable in XQuery regular expression
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 16 Dec 2010 18:36:49 +0000
On 16/12/2010 18:30, mlcook@xxxxxxxxxx wrote:
Dear List,

Is it possible to use an XSL variable in a regular expression when using the "matches" function in an XSL transformation?

Say I have
<xsl:variable name="Prefix" as="xs:string" select="'PR'"/>


the rege argument is a normal string so can be constructed by any string operation, such as concat() or string-join()
Then I want to use $Prefix in my regular expression like I might use XSL variables elsewhere:
matches(normalize-space(text()[1]), '^(optional beginning text)*$Prefix: [a-zA-Z ]*')


matches(normalize-space(text()[1]), concat( '^(optional beginning text)*', $Prefix, ': [a-zA-Z ]*'))

David

Current Thread