问题
Is there a way in relax-ng to specify that an attribute's name must match a reg-ex. for example the data-attributes in html5.
<link rel="some-relation" href="/its-location/" data-color="blue" />
I'm hoping I can do something like...
LinkType |= (
attribute rel { text },
attribute data-* { text }*,
( attribute href_template { UriTemplate } | attribute href { Uri } )
)
回答1:
http://books.xmlschemata.org/relaxng/relax-CHP-9.html describes regular expression support in RELAX NG. To my knowledge regular expressions in RELAX NG are limited to attribute values and element content, and don't cover attribute names.
来源:https://stackoverflow.com/questions/16854390/relax-ng-compact-attribute-whose-name-matches-a-reg-ex