How to restrict the values of attributes in my own element declarations when they are defined in another namespace

I am trying to find a way to restrict the value of an xlink:type attribute
depending on the element in which it is used.

 

The xlink:type attribute is defined in a schema like: 

 

<schema targetNamespace="http://www.w3.org/1999/xlink" 

      xmlns:xlink="http://www.w3.org/1999/xlink" 

      xmlns="http://www.w3.org/2001/XMLSchema" 

      elementFormDefault="qualified"> 

 

      <simpleType name="typeEnum">

            <annotation>

                  <documentation>

            Enumeration of values for the type attribute

            </documentation>

            </annotation>

            <restriction base="string">

                  <enumeration value="simple"/>

                  <enumeration value="extended"/>

                  <enumeration value="locator"/>

                  <enumeration value="arc"/>

                  <enumeration value="resource"/>

                  <enumeration value="title"/>

            </restriction>

      </simpleType>

 

      <attribute name="type" type="xlink:typeEnum"/>

</schema>

 

I am then trying to define extended link, locator, resource etc elements in
my own namespace and determine which of these enumerated values are legal
for the specific elements.

 

Thus, the schema in my own namespace looks like:

 

<schema targetNamespace="http://www.xbrl.org/2001/XLink" 

      xmlns:xlink="http://www.w3.org/1999/xlink" 

      xmlns:xl="http://www.xbrl.org/2001/XLink" 

      xmlns="http://www.w3.org/2001/XMLSchema" 

      elementFormDefault="qualified" 

      attributeFormDefault="unqualified">

 

      <import namespace="http://www.w3.org/1999/xlink" 

            schemaLocation="xlink.xsd"/>

 

      <complexType name="locatorType">

            <annotation>

                  <documentation>

                  Generic locator type.

                  </documentation>

            </annotation>

            <complexContent>

                  <restriction base="anyType">

                        <sequence>

                              <element ref="xl:title" minOccurs="0"
maxOccurs="unbounded" />

                        </sequence>

                        <attribute ref="xlink:type" use="required">

                              <annotation>

                                    <documentation>

                                    This attribute must have a value of
"locator".

                                    </documentation>

                              </annotation>

                        </attribute>      

                        <attribute ref="xlink:href" use="required" />

                        <attribute ref="xlink:label" use="required" />

                        <attribute ref="xlink:role" use="optional" />

                        <attribute ref="xlink:title" use="optional" />

                  </restriction>

            </complexContent>

      </complexType>

      <element name="myLocator" type="xl:locatorType" />

</schema>

 

Any suggestions on how to impose this kind of restriction would be
gratefully received,

 

Regards

 

Geoff Shuetrim

 

Received on Wednesday, 30 July 2003 06:00:25 UTC