Reputation: 2446
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.
Upvotes: 0
Views: 506
Reputation: 167696
Try the path /db/prop[not(id(@objs)[not(obj)])]
, it selects those prop
element child nodes of the db
root element where id(@objs)
does not find an element not having an obj
child.
Upvotes: 1