<xsl:if test="string-contains(//ns0:elem/value, 'sth')">
</xsl:if>
<xsl:variable name="alpha"
select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:if test="string-length(translate(., $alpha, '')) > 0">
<!-- context node contains non-alpha characters -->
</xsl:if>
<xsl:if test="translate(., $alpha, '')">
<xsl:if test="translate(., translate(., $alpha, ''), '')">
<!-- context-node contains characters on the blacklist (in $alpha) -->
</xsl:if>
not(string-length(translate(., $alpha, ''))=string-length())
<xsl:if test="translate(., $alpha, '')">
[contains some characters not on the list]
</xsl:if>
<xsl:if test="not(translate(., $alpha, ''))">
[contains only characters on the list]
</xsl:if>
<xsl:if test="translate(., translate(., $alpha, ''), '')">
[contains some characters on the list]
</xsl:if>
<xsl:if test="not(translate(., translate(., $alpha, ''), ''))">
[contains only characters not on the list]
</xsl:if>
translate(., translate(., $vAlpha, ''), '')
string-length(translate($str, $vAlpha, '')) = 0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:variable name="vUpper" select=
"'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="vLower" select=
"'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="vAlpha" select=
"concat($vUpper, $vLower)"/>
<xsl:variable name="vStr" select="'A12B_..c02d'"/>
<xsl:template match="/">
<xsl:value-of select=
"translate($vStr,
translate($vStr, $vAlpha, ''), '')
"/>
The string <xsl:value-of select="$vStr"/> has <xsl:text/>
<xsl:value-of select=
"string-length(translate($vStr, $vAlpha, ''))"/> <xsl:text/>
non-letters
</xsl:template>
</xsl:stylesheet>
ABcd
The string A12B_..c02d has 7
non-letters