There's no intrinsic support for this, you'll either have to call an extension function in Java/Javascript etc, or code it up for yourself. It's not too difficult, you can start with
string-length(substring-before("0123456789ABCDEF", $x)), which converts a hex digit in $x to its decimal value.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference