You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Jaco Prinsloo <ja...@gmail.com> on 2008/11/19 06:49:24 UTC
Query on child node returning parent node
Hi All,
Is there anyway for me to create a query (XPath preferably) that will check
some criteria against a node, and if it matches return the parent node?
What I want to do is check in my jcr:content nodes for all files created
before a certain date and then return the nt:file node, something like this:
/jcr:root//jcr:content[@jcr:lastModified < date]/..
(in regular XPath '..' returns the parent)
Thank you,
Re: Query on child node returning parent node
Posted by Jaco Prinsloo <ja...@gmail.com>.
Thanks Alessandro, that should work!
On Wed, Nov 19, 2008 at 8:12 AM, Alessandro Bologna <
alessandro.bologna@gmail.com> wrote:
> Unfortunately the parent axis is not supported, as far as I know at least.
>
> You could use this query instead (replace with your date of course):
>
> /jcr:root//element(*,nt:file)[jcr:content/@jcr:lastModified <
> xs:dateTime('2008-10-13T08:30:25.841-04:00')]
>
> which uses a predicate on a child node (which seems to be supported) to
> obtain the same result.
>
> Alessandro
>
>
> On Nov 19, 2008, at 12:49 AM, Jaco Prinsloo wrote:
>
> Hi All,
>>
>> Is there anyway for me to create a query (XPath preferably) that will
>> check
>> some criteria against a node, and if it matches return the parent node?
>> What I want to do is check in my jcr:content nodes for all files created
>> before a certain date and then return the nt:file node, something like
>> this:
>>
>> /jcr:root//jcr:content[@jcr:lastModified < date]/..
>>
>> (in regular XPath '..' returns the parent)
>>
>> Thank you,
>>
>
>
Re: Query on child node returning parent node
Posted by Alessandro Bologna <al...@gmail.com>.
Unfortunately the parent axis is not supported, as far as I know at
least.
You could use this query instead (replace with your date of course):
/jcr:root//element(*,nt:file)[jcr:content/@jcr:lastModified <
xs:dateTime('2008-10-13T08:30:25.841-04:00')]
which uses a predicate on a child node (which seems to be supported)
to obtain the same result.
Alessandro
On Nov 19, 2008, at 12:49 AM, Jaco Prinsloo wrote:
> Hi All,
>
> Is there anyway for me to create a query (XPath preferably) that
> will check
> some criteria against a node, and if it matches return the parent
> node?
> What I want to do is check in my jcr:content nodes for all files
> created
> before a certain date and then return the nt:file node, something
> like this:
>
> /jcr:root//jcr:content[@jcr:lastModified < date]/..
>
> (in regular XPath '..' returns the parent)
>
> Thank you,