jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Betheuil" <Nicolas.Bethe...@europe.adp.com>
Subject RE: XPath query: check if child-node does not exist
Date Wed, 01 Dec 2010 13:47:57 GMT
Hi,

Only to tell you where i'm gone because i ever try this
http://dev.day.com/discussion-groups/content/lists/jackrabbit-users/2010-11/2010-11-23_Re_xpath_query_of_subnode_Alexander_Klimetschek.html

You will not succeed to do what you want. The xpath implementation is very far to be exaustive
as all the documentation tell it. Think about going back to whiteboard to try to find a workaround
to your problem.

The conditions (between []) can only test properties on same node, not child nodes even is
sql2.

-----Message d'origine-----
De : Stefan Hagedorn [mailto:nachteilhaft@gmx.de] 
Envoyé : mercredi 1 décembre 2010 14:39
À : users@jackrabbit.apache.org
Objet : XPath query: check if child-node does not exist

Hi,

I am trying to build a XPath query that gets all nodes that do not have 
a certain (grand)child node but do have a property with a certain value

example

node1 (property=test)
  + child
     + grandchild1
     + grandchild2


node2 (property=test)
  + child
     + grandchild1


With my query I would like to find all nodes ("nodeX") that do not have 
a grandchild "grandchild2" but do have a property "property" with value 
"test".

i.e. in the example above I would like the query to return node2 (since 
node1 has a grandchild "grandchild2".

It doesn't matter to me if "grandchildX" is the name of the 
grandchild-node, or if it was in an extra name-property of the grandchild.

I tried with the grandchild names as a property (all grandchildren have 
the same node name) and have the following sample:
//element(*,mynode)[child/grandchild/@name!='grandchild2' and 
@property='test']

But this also returns node1 as this has a granchild which is not 
grandchild2 ...


Is this possible with Jackrabbit/XPath and could someone please show me 
how? ;)

Thanks in advance,
Stefan

Mime
View raw message