Subject: Re: [xsl] xslt 2.0 regex From: davep <davep@xxxxxxxxxxxxx> Date: Sat, 17 Mar 2012 16:14:27 +0000 |
It seems to me that in this subexpression:
| - | . | [0-9]
The dot needs to be escaped. Dot is a special character and in its unescaped form means "accept any character at the current position". On the other side:
\.
means literally the dot character.
Cheers, Dimitre
Good catch Dimitre. Thanks. It's still not working
<xsl:variable name="NameStartChar.re" as="xs:string"> $[A-Z]|_|[a-z] | [À-Ö] | [Ø-ö] | [ø-˿] | [Ͱ-ͽ] | [Ϳ-῿] | [‌-‍] | [⁰-↏] | [Ⰰ-⿯] | [、-퟿] | [豈-﷏] | [ﷰ-�] | [𐀀-] </xsl:variable>
<xsl:variable name="NameChar.re" as="xs:string" select="concat($NameStartChar.re,' | - | \. | [0-9] | · | [̀-ͯ] | [‿-⁀]')"/>
<xsl:variable name='Name.re' select='concat($NameStartChar.re, "(", $NameChar.re,")*")'/>
<xsl:template match="*[@select]"> <xsl:variable name='this' select="."/> <xsl:if test="contains(@select,'$')"><!-- concat('(',$Name.re,')') --> <xsl:analyze-string select="@select" regex="{$Name.re}" flags="x"> <xsl:matching-substring> <xsl:message> "<xsl:value-of select="name($this)"/>"<xsl:text> </xsl:text> [<xsl:value-of select="regex-group(0)"/>] <xsl:text> </xsl:text> </xsl:message> </xsl:matching-substring> <xsl:non-matching-substring> </xsl:non-matching-substring> </xsl:analyze-string> </xsl:if> <xsl:apply-templates select="*"/> </xsl:template>
The regex-group(0) isn't reporting the variable name? Surrounding with () hasn't helped, to use -group(1) either.
-- Dave Pawson XSLT XSL-FO FAQ. http://www.dpawson.co.uk
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xslt 2.0 regex, Dimitre Novatchev | Thread | Re: [xsl] xslt 2.0 regex, Tony Graham |
Re: [xsl] xslt 2.0 regex, Dimitre Novatchev | Date | Re: [xsl] xslt 2.0 regex, Tony Graham |
Month |