xsl-list
[Top] [All Lists]

Re: [xsl] xslt 2.0 regex

2012-03-17 09:18:36


On 2012-03-17 14:37, davep wrote:
<xsl:variable name='Name.re'
select='concat($NameStartChar.re,
"(", $NameChar.re,")*")'/>

then in use

<xsl:template match="*">
<xsl:if test="matches(@select, $Name.re,'x') ">

Is $Name.re supposed to match the entire @select attribute value, from start to end? Then anchoring the regex at the start/end of the string will help:

<xsl:if test="matches(@select, concat('^', $Name.re, '$'),'x') ">

or alternatively

<xsl:variable name='Name.re'
select='concat("^", $NameStartChar.re, "(", $NameChar.re,")*$")'/>

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