XML 文件
<Bookstore>
<Book>
<title lang = "en" cover = "hard"> HP </title>
<title lang = "en" cover = "soft"> HM </title>
<Book>
<Bookstore>
如何使用 last() 谓词获取属性“cover”的值?XPath 规范允许在 XPath 语句中使用“谓词”。例如,last() 谓词将从一组/值列表中选择最后一个值。
我尝试使用 /Bookstore/Book/title[last()]/@cover。但是我得到错误,这个 XPATH 无法解析包含 XPath 谓词 last() 的 XPath。我哪里错了?
谢谢!