relax-ng compact: attribute whose name matches a reg-ex

Deadly 提交于 2019-12-13 21:52:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!