El Keyref
# XML Schema keyref Element
* * Complete XML Schema Reference](#)
* * *
## Definition and Usage
The keyref element specifies that an attribute or element value (or set of values) must correspond to the values of a specified key or unique element.
The keyref element must contain the following elements in order:
* There must be one and only one selector element.
* The selector element contains an XPath expression that specifies a set of elements where the values specified by field must be unique.
### Element Information
* **Parent element:** element
### Syntax
(annotation?,(selector,field+))
(The ? symbol declares that in the key element, the element may appear zero or one time, and the + symbol declares that the element must appear one or more times.)
| Attribute | Description |
| --- | --- |
| id | Optional. Specifies a unique ID for the element. |
| name | Required. Specifies the name of the key element. |
| refer | Required. Specifies the name of a key or unique element defined in this schema (or in another schema indicated by the specified namespace). The refer value must be a qualified name (QName). The type may include a namespace prefix. |
| any attributes | Optional. Specifies any other attributes with non-schema namespaces. |
* * Complete XML Schema Reference](#)
YouTip