Can't use key and keyref with an attribute in a group

Discussion in 'XML' started by J E E, Nov 7, 2003.

  1. J E E

    J E E Guest

    Hi,

    Why can't I create a key and keyref with an attribute declared in an
    attribute group? Code below describes what I'm trying to accomplish.

    <!-- An attribute group -->
    <xs:attributeGroup name="AttGMain">
    <xs:attribute name="Name" type="xs:string" />
    <xs:attribute name="Type" type="xs:string" />
    </xs:attributeGroup>

    <!-- CT using group above -->
    <xs:complexType name="ctView">
    <xs:all>
    <xs:element name="Control" type="ctControl" />
    <xs:element name="InfoView" type="ctInfoView" />
    </xs:all>
    <xs:attributeGroup ref="AttGMain" />
    </xs:complexType>

    <!-- CT using CT above for View element -->
    <xs:complexType name="ctViewGroup">
    <xs:sequence>
    <xs:element name="View" type="ctView">
    <xs:key name="ViewPK">
    <xs:selector xpath="." />
    <xs:field xpath="@Name" />
    </xs:key>
    <xs:keyref id="ViewFK" refer="ViewPK">
    <xs:selector xpath=".//View" />
    <xs:field xpath="@Name" />
    </xs:keyref>
    </xs:element>
    </xs:sequence>
    </xs:complexType>

    No relations are defined when I use Name attribute in a group, but
    works when Name is declared local in ctView.

    Regards,
    J E E
    J E E, Nov 7, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. peterpeter
    Replies:
    0
    Views:
    927
    peterpeter
    Feb 11, 2004
  2. Russell O'Connor

    Key-keyref to attribute in root element

    Russell O'Connor, Mar 5, 2004, in forum: XML
    Replies:
    5
    Views:
    986
    Henry S. Thompson
    Apr 27, 2004
  3. John Carron
    Replies:
    0
    Views:
    471
    John Carron
    Sep 1, 2005
  4. Mike

    key and keyref

    Mike, Sep 23, 2005, in forum: XML
    Replies:
    3
    Views:
    633
    JAPISoft
    Sep 27, 2005
  5. peterpeter
    Replies:
    0
    Views:
    732
    peterpeter
    Feb 12, 2007
Loading...

Share This Page