You will need both an extension (since you have the attribute id
) and a restriction (since you have the constraint on the content of floatOutput
). One approach that I know of is to create a simple type with the constraint and then extend this type with the attribute. So something like the following.
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:simpleType name="floatOutputType">
<xs:restriction base="xs:integer">
<xs:minInclusive value="-50"/>
<xs:maxInclusive value="50"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="floatOutput">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="floatOutputType">
<xs:attribute name="id" type="xs:byte" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>