my only idea how to do it is what you quoted in your post, I still think that should do the job, or at least I don't think we can do better without Rothgar's DD.
PS: On conditionals and operators there are some useful stickies in the XML modding forum, that's where I learned from as well.