如何根据xslt中属性名称的正则表达式查找属性值?在这个片段中,我试图匹配“url.title”或“page.title”之类的属性......等等“.title”。
<attribute name="withRegexp">
<value-of select='matches(@*[name()], "\.title")'/>
</attribute>
这不起作用,任何想法要解决什么?
谢谢!
答案 0 :(得分:2)
在XPath 2.0中,您可以将名称以.title
结尾的属性节点与:
@*[matches(name(), '\.title$')]
在XPath 1.0中,没有正则表达式匹配函数。要获取名称包含子串.title
的属性节点,您可以使用:
@*[contains(name(), '.title')]