Consider simple XML document:
<html><body>
<table>
<tr><td> Item 1</td></tr>
<tr><td> Item 2</td></tr>
</table>
</body></html>
Using XPath /html/body/table/tr/td/text()
we will get
[" Item 1", " Item 2"].
Is it possible to trim white space, for example using normalize-space()
function to get this?
["Item 1", "Item 2"]
normalize-space(/html/body/table/tr/td/text())
yields trimmed contents of only the first td tag ["Item 1"]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…