如何限制attributeGroup中的属性?

How to restrict attributes in attributeGroup?

我有这个attributeGroup:

<attributeGroup name="date">
  <attribute name="year" type="int"/>
  <attribute name="month" type="int"/>
  <attribute name="day" type="int"/>
</attributeGroup>

我想对每个属性进行限制:

例如,

<releaseDate year="2013" month="12" day="11"/>

通过 xs:restriction 使用 xs:minInclusivexs:maxInclusive:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:attributeGroup name="dateAttrGroup">
    <xs:attribute name="year">
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:minInclusive value="1900"/>
          <xs:maxInclusive value="2020"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="month">
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:minInclusive value="1"/>
          <xs:maxInclusive value="12"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="day">
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:minInclusive value="1"/>
          <xs:maxInclusive value="31"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:element name="releaseDate">
    <xs:complexType>
      <xs:attributeGroup ref="dateAttrGroup"/>
    </xs:complexType>
  </xs:element>

</xs:schema>