saxon:type-annotation

Returns the name of the type annotation of a node or atomic value.

type-annotation($item as item()?) ➔ xs:QName?

Arguments

 

$item

item()?

The item whose type is required

Result

xs:QName?

Namespace

http://saxon.sf.net/

Saxon availability

Requires Saxon-PE or Saxon-EE.

Notes on the Saxon implementation

Available since around Saxon 8.0(?). The newer saxon:type() function provides more information.

Details

This function takes an item as argument.

If the argument is an element or attribute node, the function returns the type annotation of the node, as a QName. If the type is anonymous, this will be a system-generated internal name.

If the argument is a document node, the function returns xs:anyType if the document has been schema-validated, or xs:untyped otherwise.

For a text node, the function returns xs:untypedAtomic, and for comment, processing-instruction, and namespace nodes, it returns xs:string.

If the argument is an atomic value, the function returns the type label of the atomic value, again as a QName.

If the argument is an empty sequence, the function returns an empty sequence.

The prefix of the returned QName should not be treated as significant.

See also:

saxon:type()