It seems that depends on how the test appears. For instance in xslt, you can use normalize-space() and length() xslt functions supported in v1.0 up. As to "throws an error", xslt won't do it. You can show a message to that effect. To throw an error, it should be conditioned that the processing is in some other language which can throw exception (java/php/perl/c) or, to the same effect apart from the name, raise an error object (such a vbs/vb...)