Specifies that an attribute or element value (or set of values) correspond to those of the specified key or unique element.
<keyref id = ID name = NCName refer = QName {any attributes with non-schema Namespace}…> Content: (annotation?, (selector, field+)) </keyref>
Optional.
The name must be unique within an identity constraint set.
Required.
Required.
Number of occurrences | One time |
Parent elements | element |
Contents | annotation, field, selector |
The keyref element must contain the following elements in order.
selector | The selector element contains an XML Path Language (XPath) expression specifying the set of elements across which the values specified by field must be unique.
There must be one and only one selector element. |
field | Each field element contains an XPath expression specifying the values (attribute or element values) that must be unique for the set of elements specified by the selector element.
If there is more than one field element, the combination of the field elements must be unique. In this case, the values for a single field element may or may not be unique across the selected elements but the combination of all the fields must be unique. There must be one or more field elements. |
For an example, see key.
XML Schema Reference (XSD) | XML Schema Elements
For more information, see the W3C XML Schema Part 1: Structures Recommendation at http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-keyref.
W3C Namespaces in XML Recommendation