db.book = [ s:rule [ context = "/db:book" s:assert [ test = "@version" "The root element must have a version attribute." ] ] ] element book { book.attlist, book.info, (navigation.components | components | divisions)+ }
There are validators that will enforce both sets of constraints.