I've published example #124 to illustrate a technique for validating and rendering attributes which are conditionally mandatory.