xpath expression to remove whitespace

You can use XPath's normalize-space() as in //a[normalize-space()="16 : 00"]


Please try the below xpath expression :

//td[@class='score-time status']/a[normalize-space() = '16 : 00']

I. Use this single XPath expression:

translate(normalize-space(/tr/td/a), ' ', '')

Explanation:

  1. normalize-space() produces a new string from its argument, in which any leading or trailing white-space (space, tab, NL or CR characters) is deleted and any intermediary white-space is replaced by a single space character.

  2. translate() takes the result produced by normalize-space() and produces a new string in which each of the remaining intermediary spaces is replaced by the empty string.


II. Alternatively:

translate(/tr/td/a, ' 	
&#13', '')

Tags:

Xpath