You can try “\expdoifnot{\xmlatt{#1}{color}}{}{backgroundcolor=\xmlatt{#1}{color}}” but I can’t say for sure without a example.