W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2002

How to enumerate possible values for an attribute from another file?

From: vze3y7w8 <boris.kortiak@verizon.net>
Date: Sat, 30 Nov 2002 18:11:15 -0500
To: <xmlschema-dev@w3.org>
Message-ID: <000b01c298c5$c8b59d80$33fc5044@VAIO590G01>
Actually, there is more to this question than stated in the subject; if
necessary, I will post them separately.

 

I have defined an XSD with a tag (I know that isn't the right word, but
it has slipped my mind at the moment) that has the attribute "Language".

 

.
                <xs:element name="uTitle" minOccurs="0"
maxOccurs="unbounded">

              <xs:complexType>

                    <xs:simpleContent>

                           <xs:extension base="xs:string">

                                  <xs:attribute name="Language"
type="xs:language" use="required"/>

                           </xs:extension>

                    </xs:simpleContent>

              </xs:complexType>

       </xs:element>

.

 

Separately, I have created an XML document that looks something like
this:

 

<Languages>

            <Language>

                        <Abbreviation>aa</Abbreviation>

                        <Name>Afar</Name>

            </Language>

            <Language>

                        <Abbreviation>ab</Abbreviation>

                        <Name>Abkhazian</Name>

            </Language>

.

            <Language>

                        <Abbreviation>zh</Abbreviation>

                        <Name>Chinese</Name>

            </Language>

            <Language>

                        <Abbreviation>zu</Abbreviation>

                        <Name>Zulu</Name>

            </Language>

</Languages>

 

What I would like to do, is have the list of possible values for the
"Language" attribute restricted to the values in the "Abbreviation"
elements of the "Languages" document.

 

The other half of this question is more of XSD design problem.  When I
started this I just added this attribute to a variety of elements.  This
has now become unwieldy to use.  Is there a way to define an attribute
globally for use in a variety of elements, such that it keeps the
enumerated list of values intact?

 

TIA

--
boris@kortiak.com
http://www.boriskortiak.com/

 
Received on Saturday, 30 November 2002 18:11:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:35 GMT