Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 XML 格式是这样的。
<Rule id="MyRule"> <SubRule type="min" id="50" /> </Rule>
我编写了获取id大于等于50的每个节点的路径
Rule[@id='MyRule']/subrule[@type='min' and @id>='50']
但我没有得到我想要的,它只是返回了所有节点。
您是否尝试过以下操作(更改 SubRule 和字符串比较的大小写)?
Rule[@id='MyRule']/SubRule[@type='min' and compare(@id,'50')>=0]
你所有的数字都是两位数吗?(我猜 '7' > '50', '100' < '50' )
如果你只是想比较数字,你可以试试
Rule[@id='MyRule']/SubRule[@type='min' and number(@id)>=50]