On this website http://gskinner.com/RegExr/ (which is a RegEx test website) this regex match works
Match:
[^\x00-\xff]
Sample Text: test123 或元件数据不可用
But if I have this input XML:
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<node>test123 或元件数据不可用</node>
</root>
and I try this XSLT 2.0 stylesheet with Saxon 9:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/root/node">
<xsl:if test="matches(., '[^\x00-\xff]')">
<xsl:text>Text has chinese characters!</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Saxon 9 gives me following error output:
FORX0002: Error at character 3 in regular expression "[^\x00-\xff]": invalid escape sequence
Failed to compile stylesheet. 1 error detected.
How to check for chinese characters inside XSLT 2.0 ?