如何使用带有属性值的开始? [英] How do I use starts-with with an attribute value?
本文介绍了如何使用带有属性值的开始?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的 xml 看起来有点像这样...
My xml look a bit like this ...
<DataItems>
<DataItem name="Order Number" type="string">ABC1234</DataItem>
<DataItem name="Customer Id" type="integer">667744</DataItem>
<DataItem name="Customer Name" type="string">Ronnie Pickering</DataItem>
</DataItems>
我正在尝试使用 XPath 1.0 根据订单号是否以某个字符串开头来返回一个布尔值 - "ABC"
I'm trying to use XPath 1.0 to return a boolean based on whether the Order Number start with a certain string - "ABC"
我完全想不通.请帮忙.
I can't figure it out at all. Help, please.
推荐答案
这个 XPath,
//DataItem[@name='Order Number' and starts-with(., 'ABC')]
将返回名称为 'Order Number'
且字符串值以 'ABC'
开头的所有 DataItem
元素.
will return all DataItem
elements whose name is 'Order Number'
and whose string value starts with 'ABC'
.
这篇关于如何使用带有属性值的开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文