xsl-list
[Top] [All Lists]

[xsl] xslt 2.0 regex

2012-03-17 08:37:29
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>