XPath:你如何在xpath中进行小写调用 [英] XPath: How do you do a lowercase call in xpath

查看:110
本文介绍了XPath:你如何在xpath中进行小写调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Firefox的XPath检查器,无法获得正确的语法。我有一个链接:

 < a> LinkName< / a> 

我试着做:

  // a [lower-case(child :: text())='linkname'] 

但我有一个语法错误。我做错了什么?



谢谢

解决方案

函数在XPath 1.0中称为小写,它是Firefox中使用的XPath版本。



您需要使用丑陋的翻译函数代替: -

  translate(text(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')

...但是您需要扩展if你需要覆盖更广泛的字符集。

I'm using Firefox's XPath-checker and can't get the syntax right. I have a link:

<a>LinkName</a>

and I try doing:

//a[lower-case(child::text())='linkname']

but I have a syntax error. What am I doing wrong?

Thanks

解决方案

There is no function called lower-case in XPath 1.0 which is the version of XPath used in Firefox.

You need to use the ugly translate function instead:-

  translate(text(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')

...but of course you would need to extend this if you need coverage of a wider character-set.

这篇关于XPath:你如何在xpath中进行小写调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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