[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xslt 2.0 regex

Subject: Re: xslt 2.0 regex
From: davep <davep@xxxxxxxxxxxxx>
Date: Sat, 17 Mar 2012 16:43:09 +0000
Re:  xslt 2.0 regex
On 17/03/12 16:29, Tony Graham wrote:
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?

For which range please Tony? Err....


\i includes : which is wrong?
\c looks good though! Ah no. Again it's NameChar from
http://www.w3.org/TR/2000/WD-xml-2e-20000814#NT-NameChar
which is more than allowed for xsl:variable @name?


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;].

As I read it (or more accurately fail to read it correctly) It's NameChar less : followed by (Name less :)+

Simpler version [A-Za-z0-9]+ and the i18N additions,
but I can't get the simpler one working.





It's only matching on the first letter of a variable currently....

<xsl:variable select="$fred"/>

Produces
"xsl:variable"
      	    [f]
"xsl:variable"
      	    [r]
 "xsl:variable"
      	    [e]
 "xsl:variable"
      	    [d]

so something is seriously wrong.



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





regards


--
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.