Xpath 仅选择属性的一部分

2024-04-06

if

/dt/@id

returns comment_34232 or comment_12我怎样才能让它返回34232 or 12(换句话说,替换'comment_' with ''

and if

/span/style

returns width: 80%;我怎样才能更换width:在那之后%;检索80

Regards


I. Part

if

/dt/@id returns `comment_34232` or `comment_12` how can I make it return

34232 or 12(换句话说 更换'comment_' with ''

Use:

substring-after(/dt/@id, '_')

II. Part

and if

/span/style returns `width: 80%;` how can I replace  `width: ` and after

that %;检索80

Use:

substring-before(substring-after(/span/style, ' '), '%')

Do note:使用标准XPath函数substring-before() http://www.w3.org/TR/1999/REC-xpath-19991116/#function-substring-before and substring-after() http://www.w3.org/TR/1999/REC-xpath-19991116/#function-substring-after .

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Xpath 仅选择属性的一部分 的相关文章

随机推荐