本文介绍了Relax-ng compact:名称与reg-ex匹配的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
relax-ng中是否有一种方法可以指定属性名称必须与reg-ex匹配.例如html5中的数据属性.
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 } )
)
推荐答案
http://books.xmlschemata.org/relaxng/relax-CHP-9.html 描述了RELAX NG中的正则表达式支持.据我所知,RELAX NG中的正则表达式仅限于属性值和元素内容,并不涵盖属性名称.
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.
这篇关于Relax-ng compact:名称与reg-ex匹配的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!