I would like to create an XSD that defines an attribute which can be placed on elements from other schemas, or elements that are not in any schema. For example, the schema
I had to add a wrapper, to import the two different schema into one (because xmllint only accepts a single xml schema):
The only way I could get something like the Question to work was to edit OtherSchema,xsd (which is not allowed by the question), so append an attribute wildcard (after the existing one):
I'm not enough of an expert of XML Schema to say "this is impossible", but it seems impossible to me.
One problem with your proposal is that you don't specify where the new attribute should appear. Usually, if you declare an attribute (or a complexElement, modelgroup etc), you are free to refer to it or not. If you don't explicitly refer to it, it has no effect. Therefore, I think your proposal will be treated as an attribute that is declared, but not referred to.
What you really want is a way to say "add this attribute to every existing complexType" - but you don't say this. And, unfortunately, there doesn't seem to be a way to say this. (there isn't even a way to say "add this attribute to this specific existing complexType" - you have to include it in the original definition or not at all.)
One way to partly do it is to
types in another schema - I'll add this in a second answer.