Re: [xsl] xslt 2.0 regex

Subject: Re: [xsl] xslt 2.0 regex
From: "Tony Graham" <tgraham@xxxxxxxxxx>
Date: Sat, 17 Mar 2012 16:29:29 -0000 (GMT)
On Sat, March 17, 2012 4:14 pm, davep wrote:
...
> It's still not working
>
> <xsl:variable name="NameStartChar.re" as="xs:string">
>   &#x024;[A-Z]|_|[a-z] |
>   [&#xC0;-&#xD6;] | [&#xD8;-&#xF6;] |
>   [&#xF8;-&#x2FF;] | [&#x370;-&#x37D;] |
>   [&#x37F;-&#x1FFF;] | [&#x200C;-&#x200D;] |
>   [&#x2070;-&#x218F;] | [&#x2C00;-&#x2FEF;] |
>   [&#x3001;-&#xD7FF;] | [&#xF900;-&#xFDCF;] |
>   [&#xFDF0;-&#xFFFD;] | [&#x10000;-&#xEFFFF;]
> </xsl:variable>
>
> <xsl:variable name="NameChar.re"  as="xs:string"
> 	      select="concat($NameStartChar.re,' |
> - | \. | [0-9] | &#xB7; | [&#x0300;-&#x036F;] |
> [&#x203F;-&#x2040;]')"/>
>
>
> <xsl:variable name='Name.re'
> 	      select='concat($NameStartChar.re,
> "(", $NameChar.re,")*")'/>

Why not use '\i' and '\c' from
http://www.w3.org/TR/xmlschema-2/#charcter-classes?

Otherwise, you may want '(' and ')' around $NameStartChar.re in $Name.re,
otherwise (to mix variable expansions) it looks like
'...|[&#x203F;-&#x2040;]($NameChar.re)*" and you'll only match
multi-character names when they begin with a character in the range
[&#x203F;-&#x2040;].

Regards,


Tony Graham                                   tgraham@xxxxxxxxxx
Consultant                                 http://www.mentea.net
Mentea       13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
 --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
    XML, XSL-FO and XSLT consulting, training and programming

Current Thread