In a bug thread on the polyglot spec
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11064#c10
The question came up as to whether the constraints in that spec could or
should be checked mechanically.
The attached is a first stab at such a mechanised check.
I believe (modulo a few bugs here and there) that a conforming html5
document that is well formed xml meets the conditions of being a
polyglot document just if the attached schematron file reports no errors.
there are two constraints not checked,
6.3.3 Attribute Values
7. Attributes
6.33 is a cross constraint between the document and any css or
javascript that may interact with it, so may not be mechanicaly
checkable, and is certainly not checkable with the tools being used here,
explict newlines in attributes are not visible to xml processing so can
not be checked using tools based on xml parsing.
David