xsl-list
[Top] [All Lists]

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

2010-12-16 12:37:01
On 16/12/2010 18:30, mlcook(_at_)Wabtec(_dot_)com 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

--~------------------------------------------------------------------
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>