我正在尝试编写一个条件,如果元素包含预定义列表中的所有属性但我似乎无法正确获取 XPath。
示例数据:
let $element := <country type="" class="" ref="" ana=""/>
return
if($element/@*[local-name() = ('type', 'class', 'ref', 'ana')]) then
'All attributes are present'
else 'You can add attributes'
如果存在任何属性,第一个条件返回 true,我不确定正确的 XPath 是什么以确保它们都存在。
谢谢, 薇诺娜