Ok, fixed. I do however not evaluate the conditional attribute, but just remove any empty attribute, I guess that makes more sense.