Name

xs:unique

Attributes

name

A name for the key (not namespace-qualified)

Contents

xs:annotation?, (xs:selector, xs:field+)

xs:unique lets you state that parts of a document must have values unique across the set of parts for the document to be valid. An xs:unique element uses the XPath value in an xs:selector element to identify where the constraint applies and the xs:field element to specifically identify which part of the document must be unique among those values. (Values may also be missing.)

xs:unique elements may appear only as children of xs:element. The xs:selector XPaths are calculated from the element in which the key is defined, while the xs:field XPaths are calculated from the selector. The name attribute is used for identification with xs:keyref. Also, xs:unique behaves exactly like xs:key, except that xs:key requires the values it identifies to be present.

Get XML Pocket Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.