選擇從一長串合格文本這裏是一塊XML文檔:如何在XPath的
<book category="WEB">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<year>2003</year>
<price>49.99</price>
</book>
有人問我找出其姓氏開頭大寫字母「C」使用XPath的作者。這個問題很簡單,因爲只有一個限定條件,我可以在空格後面使用函數substring-after(),然後檢查它是否以「C」開頭。但也有可能這個傢伙有一個很長的名字,因此中間名可以出現,比如Kurt Van Persie Cagle。我怎樣才能去掉最後一個空白後的子字符串?
請解釋並使用XPath中的函數。
什麼您正在使用XPath版本? –
我認爲這是XPath 1.0 @KirillPolishchuk –