jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Waschkowski" <mwaschkow...@gmail.com>
Subject Re: predicate with descendant child
Date Mon, 05 Nov 2007 20:51:51 GMT
Hi Dan,

Thanks, but no. You can include "/" inside predicates, I have a
working example of such:

  documents[*/*/@yearBuilt = '2001']

That query gives me the document node for something that is two levels
down that has the yearBuilt attribute set to 2001.

Regards,

Mark


On Nov 5, 2007 2:15 PM, Dan Diephouse <dan.diephouse@mulesource.com> wrote:
> "/"s can not go inside the brackets. They must always go outside i.e.
> parents//*[@years='10'].
>
> - Dan
>
>
>
> Mark Waschkowski wrote:
> > Hi Dan,
> >
> > Doh, I forgot to mention that I need a particular branch, and realized
> > my example isn't very good. I'll try again.
> >
> > I have the following:
> >
> > /parent1/childJack/years=10
> > /parent2/childJill/years=12
> > /parent3/childJohn/years=35
> > /parent3/childJohn/childSuzy/years=10
> >
> > I need the _adults_ that have children or grandchildren that are 10
> > years old because we are running a special promotion for 10 year olds,
> > and need to notify the adults of it.
> >
> > I would like to write this:
> >
> >   parents[//@years= '10']
> >
> > but no go.
> >
> > Any ideas?
> >
> > Thanks,
> >
> > Mark
> >
> >
> >
> >
> >
> > On Nov 5, 2007 1:51 PM, Dan Diephouse <dan.diephouse@mulesource.com> wrote:
> >
> >> Mark Waschkowski wrote:
> >>
> >>> Hi,
> >>>
> >>> I'm trying many different combinations to specify a predicate where
> >>> ALL child nodes have some particular value. In other words, I would
> >>> like to get all regions that have any children nodes that have a
> >>> yearBuilt attribute of 2001.
> >>>   ie. documents/regions[//@yearBuilt = '2001']
> >>>
> >>> I tried different combinations of factors but could only make the
> >>> predicate apply if I knew what level the child was at:
> >>>   ie. documents/regions[*/@yearBuilt = '2001']
> >>>
> >>> but in our case we don't always know the level, hence the need to
> >>> apply a predicate using a descendant node. Is this possible? If not,
> >>> are there any workarounds?
> >>>
> >>> Thanks,
> >>>
> >>> Mark
> >>>
> >>>
> >> I think the correct xpath syntax is: documents/regions//*[@yearBuilt =
> >> '2001'].
> >> Cheers,
> >> - Dan
> >>
> >> --
> >> Dan Diephouse
> >> MuleSource
> >> http://mulesource.com | http://netzooid.com/blog
> >>
> >>
> >>
>
>
> --
>
> Dan Diephouse
> MuleSource
> http://mulesource.com | http://netzooid.com/blog
>
>

Mime
View raw message