Re: [xsl] xslt 2.0 regex

Subject: Re: [xsl] xslt 2.0 regex
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Sat, 17 Mar 2012 15:18:15 +0100
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,")*$")'/>


Current Thread