Enumeration types

An enumeration type defines a set of permitted xs:string values. For example, an enumeration type might be defined as:

enum("red", "green", "blue")

The values conforming to an enumeration type are strings: the expression $S instance of enum(A, B, C) is true if $S is an instance of xs:string (note: not xs:untypedAtomic or xs:anyURI) and is equal (under codepoint collation) to one of A, B, or C.

A typical use case is in a function signature. For example the function signature of fn:normalize-unicode() could be restated as:

function($s as xs:string, $form as enum("NFC", "NFD", "NFKC", "NFKD")) as xs:string