To test whether the string consists entirely of digits, use
matches($in, '^[0-9]*$')
or perhaps more simply
($in castable as xs:integer)
To test whether it contains at least one digit, use
matches($in, '[0-9]')
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference