the typical way to solve this is to combine schematron with relax ng or w3c xml schema. there are several schema processors available for both languages that support this combined form. this allows schematron rules to specify additional constraints to the structure defined by w3c xml schema or relax ng.