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) &gt; 0 , string-length(//lastname) &gt; 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

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -