One possibility is to allow the style sheet language to be parametrized with the name of the attribute that is to be treated specially. Attributes that are declared as IDs are also likely to play special roles in selecting elements. It may be necessary to provide a short hand notation for such attributes, although it is a problem that ID's can be stored in attributes of different names and even several times in one element. The intuitive rule is that more specific selectors have priority. In these examples that rule is clear enough, but in more complex selectors there seems to be no obvious priority.
Higher numbers have higher priority.
This has the effect of giving longer selectors higher priority. Here is a formal CFG for the selectors, defining the syntax used above.