Note however that the function actually only returns the first invalid bind at the moment, not all of them. So this works for scenarios where error messages go from general to specific.

xxf:type()

xxf:type(
$node as node()?
) as xs:QName?

The xxf:type() function returns the type of the instance data node passed as parameter. If an empty sequence is passed, the function returns an empty sequence. Otherwise, the type of the instance data node is searched. If no type information is available, the function returns an empty sequence. Otherwise, a QName associated with the type is returned.

xxf:valid()

xxf:valid() as xs:boolean
xxf:valid($item as xs:item*) as xs:boolean
xxf:valid($item as xs:item*, $recurse as xs:boolean) as xs:boolean
xxf:valid($item as xs:item*, $recurse as xs:boolean, $relevant) as xs:boolean

The xxf:valid() function returns the validity of an instance data node or of a subtree of instance data specified by the first argument.

If the first argument is specified, its first item is obtained, if any.

If the first argument is not specified, the context item is used, if any

If the second argument is specified and true(), the function recurses into attributes and descendant nodes.

If no item is available, or if the item is an atomic value, the function returns true().

If the optional third argument is specified and set to true(), non-relevant nodes are ignored, as in the case of xf:submission.

Because of the way the XForms processing model is defined, the evaluation of calculate, required, readonly and relevant takes place during the processing of the xforms-recalculate event, which generally takes place before the processing of validation with the xforms-revalidate event. This means that by default using xxf:valid() to control, for example, whether a button is read-only or relevant will not work.