簡體   English   中英

XPath用於查找屬性包含文本的元素,不區分大小寫?

[英]XPath to find an element whose attribute contains a text, case-insensitively?

    <root>
// other nodes
    <a href="/PatternFramework/Pages/LogOut.aspx?np=/sites/novatestsite/Home.aspx" slick-uniqueid="92">Sign out</a>
    </root>

如何編寫一個返回其href包含“logout.aspx” a標簽的xpath?

比如像

//a[@href[contains[., "logout.aspx"]]

區分大小寫:

//a[contains(@href,'logout.aspx')] 

對XPath 2.0不區分大小寫:

//a[contains(lower-case(@href),'logout.aspx')] 

對XPath 1.0不區分大小寫:

//a[contains(translate(@href, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'),'logout.aspx')] 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM