使用XPATH子字符串函数 [英] Using a XPATH substring function

查看:151
本文介绍了使用XPATH子字符串函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助弄清楚这个XPATH子字符串函数,该函数我无法使用.我已经尝试过各种变体:

I need help figuring out this XPATH substring function, which I cannot get to work. I have tried all kinds of variations of this:

.//a[contains(text(),'Home')]/@href[substring('jsessionid',12)]

尝试从此标记获取jsessionid值:

Trying to get the jsessionid value from this tag:

<a href="/myapp/home;jsessionid=521EFCEE442922CF84C0FCC2809EC143">Home</a>

我尝试的所有方法均无效.有什么想法吗?

Nothing I try works. Any thoughts?

推荐答案

使用

Using this method, you can get the jsessionid from the 24th index of the @href attribute like this:

substring(//a[contains(text(),'Home')]/@href, 24)

示例

这篇关于使用XPATH子字符串函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆