开发者

how to check if xpath node contains part of a string or many strings and get innerHTML?

how can i express in xpath

a) need select elements which contains specified keyword. (how to make it case insensitive?)

z/x/c/v/a[normalize-space(text())='keyword']

b) need to select elements which contains any of given text() (case 开发者_如何学JAVAinsensitive?)

z/x/c/v/a[normalize-space(text())='keyword|keyword2|keyword3']

Lastly,

a) how to express the node's innerHTML ?

z/x/c/v/a[normalize-space(text())='keyword'].innerHTML ?

NOTE: i am using a html parser.


There is no direct way to do case insensitive lookup in XSL. You need to convert the data in lower case or upper case and then do the lookup.

You can use the translate function to do that, something like this translate(text(), ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’, ‘abcdefghijklmnopqrstuvwxyz’), this will convert the data to lower case.

Not sure if lower-case or upper-case kind of function are available now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜