0 Replies Latest reply on Nov 2, 2011 1:24 PM by my600080

    JCR xpath query

    my600080

      Hi, I have a question regarding a jcr xpath query. Here is an example similar to the one on jboss's website:

       

       

      //element(*,my:type)[./*/*/@id=1 and ./*/*/@name='test']

       

      This xpath query is equivillent to the following sql select statement:

      SELECT * FROM [my:type]

      JOIN [nt:base] as nodeSet1 ON ISCHILDNODE(nodeSet1,[my:type])

      JOIN [nt:base] as nodeSet2 ON ISCHILDNODE(nodeSet2,nodeSet1)

      WHERE nodeSet2.id = 1 and nodeSet2.name = 'test'

       

      What I want to achieve is to get all entries from my:type that have a two level down childnode with id = 1 AND name = 'test'. So, these two constraints have to be met on any ONE child node.

       

      But this query will actually do this: any two level down childnode contains id = 1 or name = 'test'.  The childnode can be different childnode as long as one meets id = 1 and the other one meets name = 'test'.

       

      How can I achive my goal with xpath query?

       

      Thanks a lot!

       

      Ming