選擇文字

對於示例 XML(沒有名稱空間):

這個 XPath,

/r/f/text()

將選擇具有此字串值的文字節點:

"Text 1"

而這個 XPath,

string(/r/f)

將返回 f 的字串值,它也是:

"Text 1"