Using xs:extension & xs:restriction together?

Viewed 11380

While writing an XML schema, I am attempting to do something like this

<xs:complexType name="ValueWithUnits">
    <xs:simpleContent>
        <xs:extension base="xs:double">
            <xs:attribute name="uom" fixed="second"/>
            <xs:minInclusive="0"/>
            <xs:maxInclusive="10"/>
        </xs:extension>
    </xs:simpleContent>
</xs:complexType>

Unfortunately, xs:attribute is allowed on xs:extension while xs:minInclusive & xs:maxInclusive are allowed on xs:restriction, but not together.

What is the best way to structure this? Do I have to define an extension with the appropriate units & then restrict it with my min & max values?

1 Answers
Related