Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - XML Schemas

selector

Specifies an XML Path Language (XPath) expression that selects a set of elements for an identity constraint (unique, key, and keyref elements).

<selector
  id = ID 
  xpath = a subset of XPath expression 
  {any attributes with non-schema Namespace}…>
Content: (annotation?)
</selector>

Attributes

id
The ID of this element. The id value must be of type ID and be unique within the document containing this element.

Optional.

xpath
An XPath expression that is relative to the element being declared. This expression identifies the child elements (of the element being declared) to which the identity constraint applies.

Required.

Element Information

Number of occurrences One time
Parent elements key, keyref, unique
Contents annotation

Remarks

Selector ::= Path ( '|' Path )*  
Path ::= ('.//')? Step ( '/' Step )*  
Step ::= '.' | NameTest  
NameTest ::= QName | '*' | NCName ':' '*'  
Note   When using XPath, you must use fully qualified names. For example, myNS:localName instead of localName.

Example

The following fragment is a selector element that selects all expense elements with a field element that selects an approved attribute.

<selector xpath=".//expense"/>
<field xpath="@approved"/>

See Also

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-selector.