I\'m working with an XSD such as:
In order to have an attribute on an element with restricted content, define a new xs:simpleType and then use xs:extension to extend it with an attribute:
Note also that I've simplified your regex pattern in the first case and used minInclusive/maxInclusive to more naturally express your integer range in the second case.