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