The string-length function returns the number of characters in the string. You must use < as a substitute for < and > as a substitute for > .
//*[string-length(name()) = 3]
Select elements with three-letter name
<AAA>
<Q/>
<SSSS/>
<BB/>
<CCC/>
<DDDDDDDD/>
<EEEE/>
</AAA>
//*[string-length(name()) < 3]
Select elements name of which has one or two characters
<AAA>
<Q/>
<SSSS/>
<BB/>
<CCC/>
<DDDDDDDD/>
<EEEE/>
</AAA>
//*[string-length(name()) > 3]
Select elements with name longer than three characters
<AAA>
<Q/>
<SSSS/>
<BB/>
<CCC/>
<DDDDDDDD/>
<EEEE/>
</AAA>