I’m trying to match a pattern into a string in XSLT/XPath using the matches function, as follows:
<xsl:when test="matches('awesome','awe')">
...
</xsl:when>
However, in both Firefox 3.5.9 and IE8, it doesn’t show up. IE8 tells me that “‘matches’ is not a valid XSLT or XPath function.” Is this due to XSLT 2.0 not being supported, and is there a way around this?
Regular Expressions are supported only in XSLT 2.x/XPath 2.x.
As at this date, no publicly available browser supports XSLT 2.x/XPath 2.x.
In your concrete case you can use:
other useful XPath 1.0 functions are:
contains()substring()substring-before()substring-after()normalize-space()translate()string-length()