<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           elementFormDefault="qualified">


    <xs:element name="Book">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Title" type="xs:string"/>
                <xs:element name="Author" type="xs:string"/>
                <xs:element name="Date" type="xs:gYear"/>
                <xs:element name="ISBN" type="xs:string"/>
                <xs:element name="Publisher">
                    <xs:complexType>
                        <xs:simpleContent>
                            <xs:extension base="xs:string">
                                <xs:attribute name="storename" type="xs:string" />
                                <xs:assert test="if (@storename = 'Barnes and Noble') then 
                                                     text() = ('Wrox Press', 'New Riders')
                                                 else if (@storename = 'Barnes and Noble') then 
                                                     text() = ('friendsofed', 'Norton Press')
                                                 else false()"/>
                            </xs:extension>
                        </xs:simpleContent>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="BookStore">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="Book" maxOccurs="unbounded" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

</xs:schema>