I'm trying to validate that an element always has an href attribute in RelaxNG, and assumed you could do it with this:
<attribute name="href">
<data type="anyURI"/>
</attribute>
Only catch is, apparently anyURI considers empty strings to be valid, so href=""
passes with flying colors. Is there any easy way to fix this?
You can use the
minLength
facet. For example:See also http://www.w3.org/TR/xmlschema-2/#anyURI