Xpath matches againt items

≡放荡痞女 提交于 2019-12-11 05:07:52

问题


The matches function acts against a string (where the result is a single item of type string). Looking for a way with XPath to do the same regular expression matches but against items (result is a sequence of nodes/items)?


回答1:


//foo/bar[matches( ., 'regexp' )]

Is this what you're looking for or am I misunderstanding your question. This filters the //foo/bar nodelist based on the string value of every node. (The string value of elements is the concatenation of all the text nodes within it.)



来源:https://stackoverflow.com/questions/5147120/xpath-matches-againt-items

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