<?xml version="1.0" encoding="UTF-8" ?>
<!--
	XPath engine test:  ".//a/*/b" and use of "." for both selector and field.
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
		targetNamespace="http://www.publishing.org"
		xmlns="http://www.publishing.org"
		elementFormDefault="qualified">
	
	<xsd:element name="root">
		<xsd:complexType>
			<xsd:sequence>
				<!-- define keys in this element -->
				<xsd:element name="keys">
					<xsd:complexType>
						<xsd:sequence>
							<xsd:any processContents="skip" maxOccurs="unbounded" />
						</xsd:sequence>
					</xsd:complexType>
				</xsd:element>
				
				<!-- define keyrefs in this element -->
				<xsd:element name="keyref" maxOccurs="unbounded" minOccurs="0" type="xsd:string" />
			</xsd:sequence>
		</xsd:complexType>
		
		<xsd:key name="trickyKey">
			<xsd:selector xpath=".//keys/a/*/b|.//keys/a/*/*/b" />
			<xsd:field    xpath="@id" />
		</xsd:key>
		
		<xsd:keyref name="trickeyRef" refer="trickyKey">
			<xsd:selector xpath=".//keyref|.//keyref|./keyref|./keyref" />
			<!-- should be considered equal to "." -->
			<xsd:field    xpath=".|.|." />
		</xsd:keyref>
		
	</xsd:element>
</xsd:schema>

