XPath: How do you do a lowercase call in xpath

后端 未结 2 1614
[愿得一人]
[愿得一人] 2020-12-17 08:55

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

LinkName

and I try doing:

         


        
相关标签:
2条回答
  • 2020-12-17 09:35

    You can Use Translate

    //a[translate(text(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'linkname']
    
    0 讨论(0)
  • 2020-12-17 09:40

    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.

    0 讨论(0)
提交回复
热议问题