1<?xml version="1.0"?> 2<xs:schema 3 targetNamespace="urn:test:foo" 4 xmlns:xs="http://www.w3.org/2001/XMLSchema" 5 xmlns:foo="urn:test:foo" 6 elementFormDefault="qualified" 7 attributeFormDefault="qualified"> 8 9 <xs:element name="Link"> 10 <xs:complexType> 11 <xs:simpleContent> 12 <xs:extension base="xs:string"> 13 <xs:attribute name="linkKey" type="xs:string" use="required"/> 14 </xs:extension> 15 </xs:simpleContent> 16 </xs:complexType> 17 </xs:element> 18 19 20 <!-- --> 21 <xs:element name="Foo"> 22 <xs:complexType> 23 <xs:sequence> 24 25 <xs:element name="Def"> 26 <xs:complexType> 27 <xs:sequence> 28 <xs:element ref="foo:Link"/> 29 </xs:sequence> 30 </xs:complexType> 31 </xs:element> 32 33 <xs:element name="Ref"> 34 <xs:complexType> 35 <xs:attribute name="linkRef" use="required"/> 36 </xs:complexType> 37 </xs:element> 38 39 </xs:sequence> 40 </xs:complexType> 41 42 <xs:key name="LinkKey"> 43 <xs:selector xpath=".//foo:Link | .//foo:Link"/> 44 <xs:field xpath="@foo:linkKey"/> 45 </xs:key> 46 47 <xs:keyref name="LinkKeyRef" refer="foo:LinkKey"> 48 <xs:selector xpath=".//foo:Ref"/> 49 <xs:field xpath="@foo:linkRef"/> 50 </xs:keyref> 51 </xs:element> 52 53</xs:schema>