是否可以在下面的XML中使用XPath計算以下TRUE節點(具有不同的名稱)?XPath:計算具有不同名稱的真正的子節點?
<my:templateBase>
<my:executive>true</my:executive>
<my:seniorManager>false</my:seniorManager>
<my:manager>false</my:manager>
<my:supervisor>false</my:supervisor>
<my:directReport>false</my:directReport>
</my:templateBase>
我似乎無法解決XPATH問題,例如, count(templateBase/*[?=true()])
。
你試過//我:templateBase/COUNT(* [文本()= '真']) ? –
這將返回XPath 2.0中每個元素名稱的個別計數(InfoPath不支持)。在XPath 1.0中,不能在軸步驟中調用函數。 –