[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] xslt 2.0 regex


Subject: [xsl] xslt 2.0 regex
From: davep <davep@xxxxxxxxxxxxx>
Date: Sat, 17 Mar 2012 13:37:15 +0000

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
Keywords