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

Only to tell you where i'm gone because i ever try this

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

-----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


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


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 

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 

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,

View raw message