I did not know what to do with such attributes as role, whose range of values is not constrained. Luigi's remark gives me an idea: I should put a hook in the stylesheet for the user's own formatting command. Something like \attributeaction[para][role]. The user could define such an action with something like \defineXMLattributeaction[para][role].
The attribute action should be invoked within a group in order to allow the user to change fonts etc. for this element. Therefore context cannot invoke the attribute action automatically, because it cannot know where it should do so. For example, some mappings for the opening tag invoke \egroup; if the attribute action had been invoked automatically, its scope would be ended immediately. When I just start to play with xml/context, I realize a test for table (i'm still playing with it) in which I write something like
<table> <!-- ... other elements --> <row> <entry role="setupentry[nx=2,background=color,backgroundcolor=red]"> blahh blahh </entry> <!-- ... other elements --> </row> <!-- ... other elements --> </table> and define \defineXMLpickup [entry] [role=]% %%Open tag {\expanded{\beforesplitstring{\XMLpar{entry}{role}{}}}\at [\to\Type% % get ..options..] \expanded{\aftersplitstring{\XMLpar{entry}{role}{}}}\at [\to\rawOptions% % get ..options.. \expanded{\beforesplitstring{\rawOptions}}\at ]\to\Options% \doifelse{\Type}{setupentry}% {%then \expanded{\bTD[\Options]} }{%else \bTD% }}% %%Close tag {\eTD} Is your way, Simon ?