What is the difference between using xsd:unique and xsd:key?
xsd:unique does not require the field to exist for the selector. If the field exists, its value should be unique.
xsd:key requires the field to exist for all selector results. Every element in the selector should have a key.
Note that xsd:keyref is not a requirement for xsd:key, the xsd:key can be there withoug any xsd:keyref.