为什么不能用xidel提取数据?

Why can't extract data with xidel?

显示books.xml中的内容。

cat  books.xml
<?xml version="1.0" encoding="UTF-8"?>
<books>   
   <book category="JAVA">
      <title lang="en">Learn Java in 24 Hours</title>
      <author>Robert</author>
      <year>2005</year>
      <price>32.00</price>
   </book>
   <book category="XML">
      <title lang="en">Learn XPath in 24 hours</title>
      <author>Jay Ban</author>
      <year>2010</year>
      <price>16.50</price>
   </book>   
</books>

xquery 字符串:

xstring='''
for $x in doc("books.xml")/books/book
where $x/price>30
return $x/title'''

为什么用xidel提取不到价格大于30的书名?

where $x/price>30where $x/price/text)>30都不能生效

假设您的 xml 存储在 file.xml 中,这应该有效:

xidel file.xml --xquery 'for $x in //book where $x/price/text() gt 30 return $x/title'

我的输出:

Learn Java in 24 Hours
xquery='''
for $x in doc("books.xml")/books/book
where $x/price/text() >30
return $x/title'''

bash命令:

xidel books.xml --xquery  "$xquery"