I have this dtd:
<!ELEMENT db (obj, prop*)>
<!ELEMENT obj (obj*)>
<!ATTLIST obj
id ID #REQUIRED
>
<!ELEMENT prop (#PCDATA)>
<!ATTLIST prop
objs IDREFS #REQUIRED
>
I need to write a xPath, which return all “prop”s, where “objs” contains of “obj”s with children.
For example:
<db>
<obj id="a007">
<obj id="a008"> </obj>
<obj id="a009">
<obj id="a011"> </obj>
</obj>
</obj>
<obj id="a011"> </obj>
<prop objs="a007 a011">
"first"
</prop>
<prop objs="a007">
"second"
</prop>
<prop objs="a009 a007">
"third"
</prop>
</db>
a want it return second and third.
Try the path
/db/prop[not(id(@objs)[not(obj)])], it selects thosepropelement child nodes of thedbroot element whereid(@objs)does not find an element not having anobjchild.