xml - 'Characters only' check in xsl string? -
how can check if string include characters (xslt file)?
<xsl:variable name="isvalid1"> <xsl:choose> <xsl:when test="string-length(//firstname) > 0 , string-length(//lastname) > 0 , substring(//firstname, 1, 3) != 'tst' , xxxx//firtname charactersxxxxx "> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </xsl:variable>
in xpath 1.0 (xslt 1.0) can use contains()
. in xpath 2.0 (xslt 2.0) use matches()
.
you may want example check alphabetic characters (no numerics, no other signs, no spaces):
matches(//firstname, '^[a-za-z]+$')
or alphanumeric,
matches(//firstname, '^[a-za-z0-9]+$')
Comments
Post a Comment