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

xslt 2.0 regex

Subject: xslt 2.0 regex
From: davep <davep@xxxxxxxxxxxxx>
Date: Sat, 17 Mar 2012 13:37:15 +0000
 xslt 2.0 regex
I believe variable names follow the name construct
http://www.w3.org/TR/REC-xml/#NT-Name  [5] less the :

Trying to interpret this in xslt

<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,")*")'/>

then in use

<xsl:template match="*">
 <xsl:if test="matches(@select, $Name.re,'x') ">
      <xsl:message>
	<xsl:value-of select="name()"/><xsl:text> </xsl:text>
	<xsl:value-of select="@select"/>
<xsl:text>
</xsl:text>
      </xsl:message>
    </xsl:if>

...

For some reason the regex is matching on other than $....
and I can't see why?

Any suggestions please.


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.