假设我有这样的 XML:
<Entity>
<Record name="My Record 1" id="3a41b5c1-2462-e211-8a1c-005056b02dd2" count="1">
<Data name="ec_name" value="My Name 1" linked="false" />
<Data name="ec_allteams" value="100000000" linked="false" />
<Data name="ec_teamtype" value="100000001" linked="false" />
</Record>
<Record name="My Record 2" id="3a41b5c1-2462-e211-8a1c-005056b02dd3" count="2">
<Data name="ec_name" value="My Name 2" linked="false" />
<Data name="ec_allteams" value="100000002" linked="false" />
<Data name="ec_teamtype" value="100000003" linked="true" />
</Record>
<Record name="My Record 3" id="3a41b5c1-2462-e211-8a1c-005056b02dd4" count="3">
<Data name="ec_name" value="My Name 3" linked="false" />
<Data name="ec_allteams" value="100000004" linked="false" />
<Data name="ec_teamtype" value="100000005" linked="false" />
</Record>
</Entity>
什么是 XPath 只返回链接 ='true' 的记录 + 数据子节点?例如,我想得到以下结果:
<Record name="My Record 2" id="3a41b5c1-2462-e211-8a1c-005056b02dd3" count="2">
<Data name="ec_teamtype" value="100000003" linked="true" />
</Record>
这在 XPath 中可行吗?