Quiero seleccionar nodos para los que no existe un atributo específico. Probé la función Not(), pero no funciona. ¿Hay alguna manera de esto?Pregunta Xpath para seleccionar el nodo cuando el atributo no existe?
Ejemplo: La siguiente consulta XPath:
group/msg[not(@owner)]
En caso de recuperar el primer nodo, pero no el segundo uno. Sin embargo, tanto SketchPath (herramienta para probar consultas Xpath) como mi código C# consideran que los 2 nodos están bien.
<group>
<msg id="EVENTDATA_CCFLOADED_XMLCONTEXT" numericId="14026" translate="False" topicId="302" status="translated" >
<text>Context</text>
<comment></comment>
</msg>
<msg id="EVENTDATA_CCFLOADED_XMLCONTEXT_HELP" numericId="14027" translate="False" topicId="302" status="translated" owner="EVENTDATA_CCFLOADED_XMLCONTEXT" >
<text>Provides the new data displayed in the Object.</text>
<comment></comment>
</msg>
</group>
De hecho, la función no() funciona correctamente, es sólo que yo tenía otras condiciones y los paréntesis no se han configurado correctamente. errare humanum est.
Si es así, por favor CIERRE la pregunta: es engañosa y consume mucho tiempo para otras personas. –
Cerré la pregunta como "ya no es relevante", si no te importa. – PhiLho
no 'group/msg [not (@owner) or @ otherAttribute =" true "]' ¿funcionó para usted? –