Maybe we should have an x-path challenge cup on the community day?
Cheers
- Boris
On Aug 28, 2009, at 1:31 PM, Will Scheidegger wrote:
Dear Magnolians
I've got an Xpath challenge for you! Consider this tree :
<A>
<B id="1">
<C attr1="1" attr2="10 />
<C attr1="4" attr2="12 />
<C attr1="8" attr2="9 />
<C attr1="1" attr2="2 />
</B>
<B id="2">
<C attr1="7" attr2="10 />
<C attr1="4" attr2="6 />
</B>
<B id="3" />
<B id="4">
<C attr1="8" attr2="10 />
<C attr1="3" attr2="9 />
<C attr1="10" attr2="2 />
</B>
</A>
I need an xpath query which returns all "B" elements having either
no C-subelements or not having any C-subelements where attr1 < 4 and
attr2 > 7. So in my case this would be
- <B id="2"/>
- <B id="3"/>
The other way around would be rather easy:
//element(*,B)//element(*,C)[...@attr1 > 4 and @attr2 < 7]
But how do I get the Bs that don't have any Cs at all? I don't see
how the "not()" function can be used... so your input is warmly
appreciated!
Thanks.
-will
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------